The design is for a sensor board that will, periodically, send temperature, humidity and light intensity values to a local server and do so at specific intervals. Further, I want the information packet that is sent, timestamped. Also, it needs to run, unattended, on battery power for as long as possible - 6-12 months.
This is a work in progress. I have interfaced I2C sensors for all of the measures mentioned (using an Arduino), so there should be no big problems there. I have also worked with several RTC chips and there is no problem there. Although I am just starting to work with the ESP8266, I think I can manage the client/server code without too much trouble (the client being on the sensor end and the server being on a Win machine). The battery power is the juicy challenge and here is what I have come up with.
First off, I am pretty impressed by what I have read about the low-power sleep modes that the ESP8266 has – but it doesn’t shut off completely and that would be the lowest power usage. Even with the sleep modes, it is not going to cover power usage by the sensors. I also realize that the ESP8266 has some timers that can probably be used to provide some real time clock functions, although I have not actually seen that code and would imagine that an interrupt-driven RTC is going to represent some "code load". So, I have settled on a separate RTC and a separate power circuit. Here is where I am at.
For the RTC, I have chosen an MCP79410. It has some nice features: low price, I2C, some SRAM, some EEPROM, 1.8-5.5v operation, battery backup (that should last for many months), and most importantly, a nice alarm function. There are two alarm register sets and when one or both match the time registers, an interrupt occurs. This means 1/minute/hour/day/week etc .. is all very easy to code. Because you have a second alarm, combinations are also easy (e.g., twice per hour). The essential function, however, is that there is an alarm pin that will go low when an alarm occurs. It stays low until a flag is reset in software. That pin going low can sink 10 mA and it only needs the RTC battery to work – that’s a key.
Using that alarm pin (called the MF or multifunction pin) I generated the following circuit. As you can see, all of it is attached to 4 AA batteries. R1 is a 680 ohm resister that will provide 7-8 mA into the MF pin and turn on Q1 which is a 2N4403 PNP transistor that can handle up to 625 mW and has some decent gain (I also have in mind an MPSA63 Darlington with almost as much Pd and much greater hFE). That transistor turns on an MCP1702 LDO 250 mA 3.3v regulator). That regulator will supply the power to all the circuitry, the RTC, ESP, and the sensors – so I have about 250 mA to work with.
When an RTC alarm occurs, the ESP8266 and sensors power up and the ESP8266 code will read the sensors, assemble and send the packet, and then reset the alarm flag -which will turn off all power from the battery pack until the next alarm.
So far I have bread boarded the RTC and the power circuit and everything is working as I anticipated – the alarm turns on Q1 which turns on the regulator. When I measure current draw from the battery pack it is, indeed, at 0 until the alarm occurs. At this point I have only a small load hooked up to the regulator but when the alarm occurs, it too behaves as I intended. So far–so good. Let’s see if I can actually pull this off, and if I can, let’s see how long those batteries can last taking readings 1/hour or so.
Any comments/suggestions are appreciated.
edited to fix orientation of Q1