wergeld wrote: I have it running at 8 MHz and off of 2 AA batteries plugged directly into the ardunio's VCC... In the mySensors sleep mode (power down) i draw 50 microAmps.
I am using the internal resonator and will drop this down to 1 Mhz as well.
Hi all, I have my MySensors sensor running on the ATMega328 now. I had some trouble at first, and may have "bricked" the first '328, no idea why/how. I was careful with it. It ran at first. but following a minor code modification, it refused to run or accept further uploads from the Arduinio IDE. I may try ISP programming it later, in case the bootloader got corrupted.
But the second '328 works great. Similar to wergeld, I am running the sensor directly off the batteries, but I am using 2xAAA rather than 2xAA. I have a BMP085 pressure, an SHT21 temp/humidity and an LDR connected. Also an LED which flashes once per minute as the sensors are read and the data is transmitted, which gives a reassuring "heart-beat"
Initially the whole circuit was drawing around 350~400uA during sleep, which was quite a bit more than wergeld's. With my multimeter I soon figured out why. I had the LDR, connected to +V, and a 10K resistor, connected to ground, acting as a voltage divider to feed an analog input. This combination was drawing 300~350uA. So instead of connecting the LDR to +V, I connected it to a spare output on the '328. The sketch switches that output to HIGH before reading the analog input, then back to LOW. To allow the LDR time to settle, the sketch reads the other sensors between switching the output HIGH and performing analogRead(). During sleep the current is now only 34uA!
So there is little point reducing the '328 clock to 1MHz in order to reduce current consumption. However, according to ATMEL's data sheet, the '328 needs around 2.4V to run at 8MHz and only 1.8V at 4MHz. So that should enable the sensor to run a longer on batteries. The SHT21 sensor has a minimum of 2.1V, so that would be the first thing to fail as the batteries discharge.
Running at anything below 8MHz means that the bootloader will not run. It can be recompiled to run at lower speeds, so I may look into that later.
There is another thing I had trouble with while working on this. Uploading the sketch with my new FTDI USB to serial adaptor was very unreliable. For short sketches like blink, rf24 scanner, and the test sketches for the sensors, it seemed fine. But the full MySensors sketch is 25K long. 4 times out of 5 it would fail part way through, giving a "programmer not responding" error. Any ideas why this could be?