Uno и leo +wi-fi sheld - питание от кроны (съем температуры на A0)

satory
Offline
Зарегистрирован: 11.07.2013

Доброго дня уважаемые! 

Вот уже опыта не один месяц (по тихоньку мы) и возникают непонятки некоторые... А точнее, не понятно - отчего не работает друина от кроны. Варианты подключения:

1. Uno+wi-fi shield + dht11

2. Leo+wi-fi shield + dht11

И это все пишется на СД карту (пока на вай-фай не глядим)! НО проблема - при запитке от кроны - не пишется на СД инфа, не мигают контрольные диоды (уно 13, лео 9)... В общем не пойми что, но как будто что-то не так! )

скромный код (из примеров):

/*
  SD card datalogger
 
 This example shows how to log data from three analog sensors 
 to an SD card using the SD library.
 	
 The circuit:
 * analog sensors on analog ins 0, 1, and 2
 * SD card attached to SPI bus as follows:
 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK - pin 13
 ** CS - pin 4
 
 created  24 Nov 2010
 modified 9 Apr 2012
 by Tom Igoe
 
 This example code is in the public domain.
 	 
 */

#include <SD.h>
#include <string.h>
#include <dht.h>
#define dht_dpin A0 
dht DHT;

int led = 9;           // the pin that the LED is attached to
long lcount = 0; 



// On the Ethernet Shield, CS is pin 4. Note that even if it's not
// used as the CS pin, the hardware CS pin (10 on most Arduino boards,
// 53 on the Mega) must be left as an output or the SD library
// functions will not work.
const int chipSelect = 4;

void setup()
{
    pinMode(led, OUTPUT); 
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  Serial.print("Initializing SD card...");
  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(10, OUTPUT);
  
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }
  Serial.println("card initialized.");
}

void loop()
{
    digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);   
  
  
    DHT.read11(dht_dpin);
    Serial.print("water=");
    Serial.print(DHT.humidity);
    Serial.print("%");
    Serial.print("temp =");
    Serial.print(DHT.temperature); 
    Serial.println("C  \r\n");
  //delay(60000); // every ONE min
  delay(1000); // every ONE min
  
//  myfloat = DHT.temperature;
  //  String myfloat = DHT.temperature;
        char buffer[16];
                char buffer1[16];
//char buf[8];
dtostrf(DHT.temperature,1,1,buffer);
dtostrf(DHT.humidity,1,1,buffer1);
  // make a string for assembling the data to log:
   ++lcount; // +1 counter
  String dataString = "#_"; dataString += lcount;
  dataString += "_#__t=";
   dataString += buffer; dataString +="%w="; dataString += buffer1;
   
   
  // read three sensors and append to the string:
//  for (int analogPin = 0; analogPin < 3; analogPin++) {
//    int sensor = analogRead(analogPin);
//    dataString += buffer;

 // }

  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  File dataFile = SD.open("tempoz.txt", FILE_WRITE);

  // if the file is available, write to it:
  if (dataFile) {
    dataFile.println(dataString);
    dataFile.close();
    // print to the serial port too:
//    Serial.println(dataString);

  
  }  
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");
        digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000); 
      digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000); 
      digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000); 
  } 
}







 

satory
Offline
Зарегистрирован: 11.07.2013

оу, а ошибки в сообщениях исправлять - не можно ни как ???!!

kisoft
kisoft аватар
Offline
Зарегистрирован: 13.11.2012

В первом - нет, в следующих - можно

NeiroN
NeiroN аватар
Offline
Зарегистрирован: 15.06.2013

Мне кажется что энергии "Кроны" вряд ли достаточно чтобы запитать Wi-Fi(читайте документацию на вашу модель). Нужен аккумулятор емкостью 800 mAh как миниум, а лучше 3000mAh. Емкость кроны в лучших случаях достигает 300mAh - энергии даже на загрузку вайфай не хватает, не то чтобы еще и диодами мигать.

Двух элементов Li-ion 18650 будет вполне достаточно, можно на худой конец распотрашить дохлый аккумулятор от ноута(на котором он работает хотябы 10 минут) там их штук 6 бывает обычно.

P.S. "Крона" пережиток "совка" - на ней разве что голый микроконтроллер будет работать и всякая переферия с "пониженым" потреблением.

satory
Offline
Зарегистрирован: 11.07.2013

Йоооой, да... Читаю и удивляюсь, не ужели отчего без помощи Вашей не догнал??! )))

Все предельно просто! У у опытного образца () 110-250 mA. Ну и прочие показатели из датащита.

Да ведомо пора на литий-ион переходить уже! По Вашей ссылке, вольтаж 3.7V у одной, пару зацепить и в путь! Думаю достаточно будет вполне, для датчиков мелких и ИК!

Благодарю же! ) Аж забавно!)))