Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By DrG
#30158 I want to share a portion of a project I am working on because 1) someone else might find it useful and 2) someone may be able to provide useful comments to me.

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.

Image

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.

Image

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.

Cheers,
DrG

edited to fix orientation of Q1
Last edited by DrG on Tue Sep 29, 2015 11:16 pm, edited 1 time in total.
User avatar
By kenn
#30164
DrG wrote: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.


You've drawn the 2N4403 backwards I think (C-E swapped), and with no base current protection. I would opt for a MOSFET.

Clever arrangement though, since the RTC draws ~ 1.2 uA - alot less than the ESP8266 in deep sleep. Other than this, an RTC on every sensor may be overkill. If you're writing periodically to a server, then only the server needs to have the "real" time (its own RTC, or NNTP), so it can timestamp the records as it receives and stores them.

So if there was a simpler way to get scheduled transmit at low standby current, I might choose that.
User avatar
By DrG
#30165
kenn wrote:
DrG wrote: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.


You've drawn the 2N4403 backwards I think (C-E swapped), and with no base current protection. I would opt for a MOSFET.

Clever arrangement though, since the RTC draws ~ 1.2 uA - alot less than the ESP8266 in deep sleep. Other than this, an RTC on every sensor may be overkill. If you're writing periodically to a server, then only the server needs to have the "real" time (its own RTC, or NNTP), so it can timestamp the records as it receives and stores them.

So if there was a simpler way to get scheduled transmit at low standby current, I might choose that.


Thanks for your comments.

Yep! The 2N4403 was not illustrated correctly - it's fixed now (I should have just scanned my hand drawing :)

As for the base current protection - a shottkey diode? Is it really necessary because it will drop the voltage?

Can you explain, in relatively simple terms (because that is likely all that I will understand), the advantage of a MOSFET over a bipolar in this case? I did some reading on IRL540s for power control applications but I am not sure I truly understand the advantage if you drive the bipolar to saturation.

As for the RTC as overkill - well yeah, I see your point, but I have no clue how to obtain the same functionality for the same price - plus (and I may be reaching here because I don't know what to do with it) there is that SRAM and EEPROM :)

Thanks again.
User avatar
By trackerj
#30170
DrG wrote:I want to share a portion of a project I am working on because 1) someone else might find it useful and 2) someone may be able to provide useful comments to me.

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.

Image

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.

Image

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.

Cheers,
DrG

edited to fix orientation of Q1



Nice to see also other people having in mind this clasic solution, as been there, done that, for a network of remote sensors - environment data upload and preparing a more detailed post about :)

Using a RTC as power management master clock for the sensor unit is not a new approach and even if something can think it's a overhead or extra cost...wll...depends on application. In this case, if you want to mix the high power consumption of a WIFI link with battery powered stuff, it will bring you the extra juice that you want to extend your battery lifetime.

TIP1: Use a MOSFET. Choose one with the lowest RDS-on you can find.
TIP2: I will look for another LDO, that one I think will not be able to properly handle the needs of your circuit. If you want to keep it, add a bigger size capacitor to cover properly the ESP8266 power hungry boot process and WIFI data transfer.

This is how is looking the board used for development of the application. It was designed as an extension board for the CBDBv3 DevBoard:

CBDBv3_Temp_extBoard_top_1.jpg


v3.4d_top_full_3.jpg
You do not have the required permissions to view the files attached to this post.