Hello,
I try to record temperature and humidity on a sd card.
For that, I bought a Leonardo, an adafruit datalogger shield and a DHT22 to record ambient temperature. The DHT is plugged (with the resistor) on digital port 2.
If I use the “software clock” based on millis() & timer it works well (attached file ieroHDT_RTC_DataLogger.ino) :
File 20150122/220659.csv created
2015/01/22 22:07:01,20.20,40.50
2015/01/22 22:07:06,21.00,40.50
2015/01/22 22:07:11,20.90,40.00
2015/01/22 22:07:16,20.90,40.90
2015/01/22 22:07:21,20.90,40.40
But when I unplug the arduino to plug it on a battery, the time is setup again to the compilation time and it is normal because it is written like this in setup() part.
So, I would like to use the RTC DS1307 clock and I changed just a little bit the file to incorporate the library as shown in the exemple (attached file ieroHDT_RTC_Hard_DataLogger.ino)
But the date is now 15 minutes too early, sometimes jump to 2165 and temperature/humidty are now “0” :
File 20150122/220112.csv created
2015/01/22 22:01:16,0.00,0.00
2015/01/22 22:01:21,0.00,0.00
2015/01/22 22:01:26,0.00,0.00
2165/165/165 165:165:85,0.00,0.00
2015/01/22 22:01:31,0.00,0.00
Do you have an idea of what can be wrong here ?
Thank you
ieroDHT_RTC_DataLogger.ino (3.76 KB)
ieroDHT_RTC_Hard_DataLogger.ino (3.85 KB)