436 How to use Voltage Supervisors to protect ESP32, Raspberry Pi, and Batteries
HTML-код
- Опубликовано: 14 июл 2024
- Computers crash if they do not have enough voltage. Li-Ion batteries could explode during charging if they were deeply discharged. How can we prevent such events? We need so-called voltage supervisors. Cheap parts with a big effect, which usually do their job in the dark. Let’s tear them to the light and protect your ESP32 or Arduino from not booting correctly and your Raspberry from a crash. We will use KA75330, KA75450, and TPS3839 for our experiments.
My second channel: / hb9blawireless
Links:
Raspberry Pi4 US: amzn.to/3pP32HZ
Raspberry Pi4 DE: amzn.to/3avMgaG
KA75330: s.click.aliexpress.com/e/_DFh...
KA75450: s.click.aliexpress.com/e/_DmK...
TPS3839G33: s.click.aliexpress.com/e/_DlU...
Power Supply: amzn.to/3PykooI or bit.ly/2uG5mJR or s.click.aliexpress.com/e/_Deo...
ESP32 Breadboard friendly: s.click.aliexpress.com/e/_DkW...
The links above usually are affiliate links that support the channel (no additional cost for you).
Supporting Material and Blog Page: www.sensorsiot.org
Github: www.github.com/sensorsiot
My Patreon Page: / andreasspiess
Discord: / discord
If you want to support the channel, please use the links below to start your shopping. No additional charges for you, but I get a commission on your purchases to buy new stuff for the channel
My Amazon.com shop: www.amazon.com/shop/andreassp...
For Banggood bit.ly/2jAQEf4
For AliExpress: bit.ly/2B0yTLL
For Amazon.de: amzn.to/2r0ZCYI
For Amazon UK: amzn.to/2mxBaJf
For ebay.com: ebay.to/2DuYXBp
profile.php?...
/ spiessa
www.instructables.com/member/...
Please do not try to email me. This communication channel is reserved for my primary job
As an Amazon Associate, I earn from qualifying purchases
#no#midroll#ads Наука
14:03 For anyone wondering, like me: in #133, Andreas explained that most supercapacitors are only rated for 2.7 volts, which is the reason why you typically need two of them in series to stay above 5.25 V, the specified upper limit for USB power.
Thank you for the additional info!
I always like how you concentrate on the basic stuff. I mean all your videos are so educating and insightful I think because you come up with videos that are not sophisticated but bang on on the fundamental issues of electronics. Thank you! I am learning a lot here.
Glad you like the videos. Thanks!
Like andreas said .” We want more”
Well done!
Yes these components are indeed used in professional devices. I have designed industrial embedded computers for the sawmill and railroad industries for 30+ years and they are a no-brainer for me.
Power supervisor circuits should be standard equipment on all processor based electronics.
You knocked this one out of the park!
Thank you! (I had to google the meaning of "You knocked this one out of the park!")
Seems like a simple topic, but there is lots more to it when explored a bit. Great dive into this topic.
Glad you liked it!
Excellent, considerations well taken. If only I had a loose jumper wire Supervisor, they get every where. Behind the soldering station, stuck to magnets and sometimes just laying on the floor.
Thank you.
I always wondered why simple professional hardware has much more components than needed for my nooby eye. This might be one of the additional components.
Thanks for the great video!
You are welcome!
Hello Andreas, thanks a lot for your video! I now understand why I had stability issues with some of my projects...
Glad the video was helpful!
@@AndreasSpiess I self educated myself in electronics and this is very frustrating to see that most educational stuff doesn't go deep enough to really master the subject. Thanks to your video, I feel a bit enlightened, which is very cool. You're the expert ! (Check out RUclips for the pun). Cheers
Excellent, thorough tutorial 👍
Thank you!
It's funny I just built a battery isolator that uses MC34064 4.6 volt supervisor chip. It turns on a relay at 13.3 volts and back off at 13.1 volts using a voltage divider, a mosfet and a few resistors. Supervisors work easier than using a tl431 and do it all in one package.
I agree that the supervisors are more specialized parts. The tl431 is very versatile.
@@AndreasSpiess Its a voltage reference, comparator, Schmitt trigger with built-in hysteresis.
Thank you sir, now i know the answer for the problem that occur on my project, exactly like you just explained. Almost 2 month fiddling around, finding for the correct answer, thank you so much
Glad this video was helpful to you!
Your videos continue to inspire me.
Wow, thank you!
Thanks, very useful and informative.
Thank you for your support!
Thanks a lot for your video! I understand non some phenomenons in my esp32 devs, specialy with solar power systems.
Best regards from France 🇫🇷
You are welcome!
I was just looking into building a protection circuit with comparators when I saw this video. What a cosmic coincidence :)
True!
Interesting info, I did not know of this problem. Thanks :)
Happy to help!
Quite useful information. I installed an arduino with a NFC reader at the entrance of the hotel i work to automatically open the door to the hotel's staff, so they don't have to ring the bell to get in, and since the power supply slowly increases voltage until the set poisition, the arduino crashes at the start (the LCD screen makes it very clear), so i have to reset it once the PSU is on to boot it up... if it ends up being a problem, now i know how to solve it!!!
Cool! I hope it will work...
Thank you. Most informative.
Glad you like it!
Really helpful content, thank you muchly.
Glad it was helpful!
Always int er interesting and informative.
Glad you think so!
Thank you, I did not know about this. Now I do!
Glad the video was useful!
really useful video - thankyou
You're welcome!
Great content.
Thank you!
so very interesting video. However especially with the ESP32(as with any other MCU having an ADC) I usually just put a voltage divider between bat+/bat-, and measure an estimate of the battery voltage using the ESPs ADC(since its ADC is fairly crappy to be honest). As long as the ESP gets powered from the battery through the 5V pin, as in its power goes through the voltage regulator and thus has a constant 3.3V, you can easily measure when the battery gets into the dropout range of the LDO. I usually set the ESP to deep sleep for an hour if it goes below a certain threshold. With solar powered projects this is an easy way to just have it go dark until there's enough sun to charge the battery again
I agree. This is a also good solution. I usually also transmit the battery voltage with the sensor readings and create a low voltage alarm with node-red
Awesome. Love it
Thank you!
Great andreas. I liked it
Thank you!
Wouldn't the brown-out detector, at least on Atmel microcontrollers, help with this issue without the need of external components?
It helps. But the ESP32 also has a BOD. They usually work fine with lowering voltages and fail with increasing voltages (as you saw in the video. The flash was not ready and crashed the ESP at a certain voltage level)
Thanks
Welcome!
Afternoon mate, Looking at snow tomorrow down to 500 metres. lol Australia crazy. 5CR hey Andreas. Oh my virtual server had that problem with my solar system.
Here we got fog this morning. It's strange for summer, but after weeks of hot dry weather it seems right after two days of rain not to heat up so quickly.
Stay safe in the snow!
Here the weather was so bad for a day that my battery was completely discharged and I had to buy a few kWh :-(
@@AndreasSpiess Me as well, but that's not as bad as the drought has been, the melting of the glaciers, etc.
@@AndreasSpiess My BMS failed. 😢 But Second 5 KW on it's way.
Recently I faced a power issue with a device that combines an ESP32 with a GSM (SIM7000G) module. The issue there was, that the GSM module introduced regular high current draws and caused low voltage spikes. A low voltage protection with a voltage supervisor didn't work in this situation, as the voltage supervisor would 'trip' with each GSM transmission power spike. What ultimately worked was a deep sleep mode of the ESP32 that was invoked if voltage dropped below a certain level for a prolonged (minutes) period of time. I also ended up adding a TPL5110 automatic reset circuit to the project that resets power every two hours. That way, whatever happens, the circuit will always recover from a low power situation.
I am glad you were able to solve the problem. I would have probably chosen a different route (try to create a stable supply).
I agree with Sureshkumar K P 100%! Andreas is the most interesting teacher I know! The wealth of knowledge Andreas demonstrate is next to NONE! Love your videos Andreas and your kind personality as well. This video came very handy right now, I'm helping to redesign a "rat feeder" for University, here in Lincoln, Nebraska. Everything is running on 28V and I'm using a tiny Arduino and one Servo Motor to lift the feeder arm for 4 seconds.... So I use LM317 buck board to step down to 5V and a second one, that is used as a 5V trigger (even the signal voltage is 28V). I am trying to protect the Arduino from the 28V and its possible problems. Do I need some kind of "protection" from the 28VDC ? Thank you again Andreas!
I probably would not use a linear regulator for such a voltage difference because I assume it heats up. A buck converter would be a better fit here.
After the voltage regulator your voltage is 5 volts and you do not need an additional protection. If the converter is killed, your whole setup will be dead. But the chance should be small and the damage small if you include a fuse on the 28V side.
For the trigger, a simple voltage divider would be enough, I think. The voltage does not need to be very precise.
@@AndreasSpiess Will do fuse for sure, but I'll leave the 2nd buck board that also steps down the 28V to 5V - I know it is an overkill. It costs only $1.x and if they decide to use the power on for a longer than 4 seconds, the small PLA box that houses all of that, could get hot.... I'll make a short video once it is done, so you can see the entire project finished. How well it will perform I don't know but that is why I'm making 3 prototypes and let them use it for while, before finalizing it. One more idea I have is to fill up the small PLA box I've printed for the boards with silicone caulking, so the possible moisture don't make it to the PCB's and the wiring.
Thank you Andreas again for your help! You are the best!
There is also MAX809 which is probably as popular as 555 timer, is extremely cheap and has huge variety of voltage options. What is missing from your your story though: to achieve reliable startup from discharged battery state it is good to have some hysteresis. Not all reset controllers are capable of that
They are really "dirt cheap"! I thought I mentioned hysteresis when I showed the curves on the oscilloscope. I agree this is important. But I was not aware that not all supervisor chips have this feature.
MAX809 has 12μA Supply Current
TPS383x has 150nA so almost 100 times less than MAX809
Merci.
De rien!
Good explanation! However surely the main reason for a voltage divider on the comparator input is that both the comparator and the voltage reference need some voltage headroom to operate properly?
Well possible. For sure an important feature.
Great video. What oscilloscope would you recommend for light use?
One from a known manufacturer like Siglent or Rigol (maybe others too) which fits your budget. The market is very competitive and you get what you pay for.
Glitching was used recently to hack the SpaceX satellite terminal, in theory even able to gain access to the bird itself.
Excellent timing, trying to drive a Pi 3 using an LM2596 module and there appears to be a number of issues related to under-voltage. Hint: it goes into a reboot loop and eats the filesystem on the SD card.
Indeed, the Pi seems to be quite picky when it comes to undervoltage...
Thank you, good information here👍. It is appreciated, however I would caution against using your product links in the description as some are dishonest scalpers that you should not support.👎
With my links you only have to trust AliExpress, Amazon, or Ebay. They give you the money back if you are cheated and can prove it.
@@AndreasSpiess they are cleaning out legitimate sellers and reselling at triple the price set by the Raspberry pi foundation to keep them affordable for learning purposes...enjoy your kickbacks from the scumbags as a reward lying about them in what could have been a beneficial youtube channel.
@@brucehanson4147 I usually publish the links I bought from.
Which sigal generator device did you show in the video at 09:03 ? Lovely video! Thanks.
You see it’s brand and type in the video.
A reupload video ? this was one of your most useful videos, thank you.
based on your video I did get a pack of KA75330 and been using them around for uses other than MCUs. best feature of them being hysteresis.
But its a bit of pain to use because the KA75 operates in 3 regions if used with a pullup resistor on output. Because below 1 volt on input you'd still get high output (0-1v=High. 1-3.3V LOW . 3.3+ High).
Is there a jellybean voltage supervisor like this which i can find even on aliexpress which has a active high output ?
Edit ( usually i get around this with feeding the input also to a optocoupler or mosfet so there is no output below 1v)
Maybe you have a look ath the MAX809/810. Both should be available on Aliexpress
Great video, touching a point usually neglected. Thank you! I think the ESP32 dev kit already includes it, right?: So far I am using the dev kit but I start thinking of making a dedicated USB with ESP32, yet still afraid of soldering SMTdevices. So far sticking with good old through holes.... If I do this jump, I will certainly need such a device.
I never saw that an ESP board had such a supervisor chip. But the ESP32 has a brown out detector which helps when the voltage decreases. It does not help with slowly raising voltages as we saw.
@@AndreasSpiess And I thought BOR works in both directions. Is this the same case for all uC with built in brown out reset ? TIA.
@@mumbaiverve2307 I do not know.
@@AndreasSpiess Ok , very vague question I know :D
Great stuff - would like to hear your opinion about alternatives to Raspberry Pi's (seems extremely out of stock currently)
We discussed this in an earlier video. For the moment I have no recommendation. I placed orders with several distributors and the current delivery date is beginning of December. So I hope I get at least one ;-)
I always use max6749 or internal Brown out detector of avr micros. Thank you,!!!
The ESP32 also has a brownout detector. They usually work well when the power goes down (as their name says). They do not work if the voltage switches on too slow as you saw in the video. Maybe they work better with other MCUs.
@@AndreasSpiess thank you
Andreas, Greatly appreciate your videos like this... I'm new to the circuit game and have been fighting this issue with my ESP32 boards. They are powered by 5v Meanwell power supplies, but periodically go wonky. I've been cheating my way around this startup issue by using an NE555 Timer delay switch and waiting 8 seconds for the power supply to warm up before supplying voltage to the ESP32.
For your first solution with a resistor/capacitor circuit on your enable pin, it doesn't outline specifically the resistor/capacitor values. Right now I have a bunch of 330ohm resistors and 1000mF capacitors. Could I use these to pull down the enable pin until it warms up? I'm powering on the WT32-ETH01 with 5v instead of the 3v3, so it doesn't appear to be working.
Thanks in advance for your time.
You can calculate the time a resistor and a capacitor have to charge up. But I fear you have different problems. As I mentioned, most boards have such parts built-in.
Concerning the WT32-ETH01: It seems to have a 5V pin.
I would start with a blink sketch and see if you have instabilities (you see crashed in the serial monitor).
@@AndreasSpiess, Thanks for the feedback. I'll double check the board's whitepaper. I've found that the 8s delay before powering on the boards seem to work each time. I have 4 boards flashed with WLED and it's a hit or miss startup when using the meanwells to start the board, but the delay works each time.
I really appreciate the videos. Every so often one of your videos touches a challenge i'm facing, so thanks in advance!
I think I should try all your projects to improve my electronics
That would take YEARS!
It took me years, too ;-)
@@AndreasSpiess thank you for the motivation spiess
@@Reach41 anything worth having is worth the years
@@convolution_talk_show Agree. I’ve got 25 years into this so far. The guy with the Swiss accent has been a great help.
I Andreas, very great video as usual! there are two things that are not completely clear to me: 1) on a nodemcu board, where the EN pin is internally connected to vcc, how can i use this approach? 2) how can I have a reference value for this voltage regulator, since the battery voltage is dropping? Which is the best way? Thanks a lot.
1) I think you'd have to cut the trace with a sharp knife.
2) The reference voltage is internal to the device. It's intentionally at a low voltage (I've seen 1.1v references) so that it can do its job while the power is still too low for the MCU. This is also a reason for that resistor network, to lower Vcc to the same level as that reference voltage.
I agree with Sybren. Usually, EN often is connected to VCC through a 10k resistor. Then you can connect the supervisor directly to the pin of the board.
On the oscilloscope what happened? All the different colours, i have a basic Chinese handheld oscilloscope, question for example would be how could I replicate this test on your oscilloscope different colours? could you please make a video about that, thanks
Can these voltage supervisors be used to detect an AC power loss and then make a quick backup of variables to the EEPROM, or is there a better IC for that purpose?
For example, if you had an esp32 devkit powered by a 5v wall adapter and a 5v supervisor IC to monitor the 5v output, could you make a detection of power loss through attaching the 5v supervisor to an input pin of esp32, and then quickly backup variables to EEPROM ?
thanks!
An easier way would be to measure voltage at a particular place using the built-in ADC of the ESP32 and react if it is too low. You could also use a supervisor for that purpose, of course. But still you need a pin to read its signal.
@@AndreasSpiess I see, thanks Andreas!
You could also connect to the EN pin of the uC, don't you? So it would completely shut off everything, just holding reset low still has considerable power consumption with a WEMOS D1 mini based board (don't have a bare ESP-12 to test rn), while dropping EN low gave sub 1mA whole system consumption (still pretty high, but probably voltage regulators and such).
I think this is what I proposed in the video. Just using the supervisor IC to do the job.
So regarding battery operated devices i think a version with 2.5V would work better since it should always be above 2.3V as the ESP32 datasheet said AND also prolong battery life since now you can train it a bit more (not great for single cell Li ion but may not be as bad with other battery types )
You chose what is best for you ;-)
@@AndreasSpiess well i am building a small weather station with a cut off for li ion at 2.97V ( 3v was not available 😅) but in theory it should be fine
Thanks for the video) But what about BOD? Is there any sense in using Voltage Supervisors if BOD on MCU is enabled and device isn't battery powered ?
BOD work good when the voltage comes down. They often do not work when the voltage is slowly increased as with solar (the ESP32 has a BOD)
Depending on the chip, not enabled by default. ☹️
Works fine on powering down... But check battery voltage if you have a spare analog input so you get an early warning and can e.g. conserve power to stay alive longer..
Could you use this on the gate of a mosfet as low voltage protection for a single cell 18650?
I do not think so. You need a stable voltage to compare to.
@@AndreasSpiess Thank you for your time!
Hello, first of all thanks for your fantastic way of teaching . I want to know, is it correct connections for TPS3839 and ESP32[10:55] . Cause the reset of ESP32 is Active HIGH and TPS3839 is Active low. TIA
And can I connect the reset to GND to reset the ESP32 on power? Will not it make a short circuited?
The ESP32 has an enable pin which has to be high when the ESP runs. If it is connected to GND (with a 10k resistor) then the ESP stops (resets). So this chip should work. But I never tested it.
The internal voltage reference in the supervisor has to be lower than the operational voltage, because if the voltage drops below that reference there would be nothing to compare it with...
I agree
Hi Andreas can you make a guide to esp8266 freezing after waking up a couple of times from deep sleep when powered by batteries. I have this issue and it's hard to tackle any ideea to fix this would be great. I power my esp on 3 x ni-mh 2100mAh cells. for Voltage regulator i use ht7333 and my circuit uses a 1000uf and 100nf cap. I was thinking to connect a smalled capacitor between gpio16 and rst. Or should I ditch it in favor of an external rtc to rst
ESPs are very sensitive to voltage drops because they draw up to 500ma peak current. If they crash, they often write a message and sometimes it contains "brownout".
I would connect your device to a proper lab power supply and see if the behavior is still there. Then, most probably it is a software error. If the behavior is gone, you know that you have to work on the power supply.
@@AndreasSpiess thanks for reply, i had it powered via uart for a couple of days, didn't had any issues.
Had no idea you could use voltages that low on RPis
I would not try it because it starts to complain much earlier... But it does not crash.
Is this one of the old videos re-posted? 🤔
Yes, as mentioned in the intro and the pinned comment ;-)
👍👍
:-)
What is unclear to me is: if these things are so useful to protect against unstable behavior of a cpu or soc and apparently relatively simple and cheap, then why do cpu/soc-manufacturers not immediately include this into their design to ensure that their part doesn't get into such misbehaviour? You mentioned some adding a resistor+cap to delay the reset going high, but they apparently would be way better protected by just including such a comparator as I'm guessing that any chip with an A/D convertor already has a reference voltage, reducing the cost uplift further. Is it just the "1000000 parts sold x 1ct saved" argument keeping them from including such protection?
As I mentioned they are standard in higher level products. For cheaper products every cent seems to count.
I'm surprised that this is not already build into Arduino... is it really true?
Yes. Most MCUs (also the ESP32) have so called "Brownout detectors". They work ok with falling voltages. But usually not with increasing voltages (as you see in the video where the flash is the real problem).
Why is the 4,5V version so much more expensive than the 3v version?
I do not know. Maybe they are less common?
8:52 pin 1 is GND.
My datasheet says something different (Fairchild)
@@AndreasSpiess I mean on schematic. Look at battery symbol, you placed pin one on - side of battery.
@@pararera6394 My battery symbol is wrong :-(
Even cheap MCUs have brownout protection circuitry these days. Why not just use that?
Brownout detection works if voltage decreases. It does not prevent bad things happen if voltage rises (and the MCU does not work). The ESP32 has a brownout detector, BTW.
ESP32 has this as a setting in menuconfig. Unfortunately, Arduino does not expose this you need to use ESP-IDF.
CONFIG_ESP_BROWNOUT_DET_LVL_SEL ?
You can do this also with the Arduino IDE, if I remember right. But it only changes the threshold voltage, not the problem with the flash chip.
Plunder Volt🌩
???
Plundervolt is the name of an undervolting attack on Intel SGX to corrupt the integrity of the security enclave of the processor.
@@MichalKottman Thank you. I always learn something from my viewers!
Red battery drawn the wrong way ?.
Well possible...
Has anyone experienced an MCU's program memory becoming corrupted by power supply irregularities?
I have made some battery monitor circuits that watch battery voltage with the ADC via a voltage divider (battery voltage is well above vcc) and powered by a buck USB supply.
Their purpose is to change the LED color as the battery runs down
They all 'fail' in the same way... The output colors change from what they should be.
They are all fine again (for a time) if I re flash reflash the program
I did not experience such behavior. But using parts outside their specs is never safe...
@@AndreasSpiess yes, I'm definitely check the Brown Out Detector settings and try to optimise them, if that doesn't work I will try these voltage detector chips in your video. They are ATTINY1614 s
I 'm pretty sure the flash program memory is being corrupted in my case, not damage to the ADC
(the adc pin is behind a 39k + 2k resistor divider)
because they work ok again if I re program them
Or we might use voltage regulators.
I do not think that they will do the same job.
Hello Andreas, i bought this Devices just to build an Hardware whatchdog. 1 Day before your Video was released.
I use my Doorbell to open my outdoor.
Fornatly i Was at Home because i womdering why my Bell not work as the postmam came.
The esp8622 Was freeze (i already used your Software Whatchdog) and thaught something like that cant Happen.
I Googled how to build a ,,Hardware" whatchdog.
2 esp8622 observes eatch other is possible but is an never endling Story (this Chip can of cause crash too).
I found the Chips you explaind in the Video but not said it is possible to build a Hardware whatchdog.
was i wrong and this Chip is not support to use it as Hardware whatchdog?
I do not understand your question :-(
@@AndreasSpiess ok vielleicht ist mein Englisch zu schlecht... Ist es möglich mit den ics einen Hardware whatchdog zu bauen der vom esp Impulse erwartet und wenn diese ausbleiben (weil esp,,hängt'') den esp resettet? Das hatte ich eigentlich vor mit den Chips also einen whatchdog zu bauen. Dein Software whatchdog hat leider nicht funktioniert.
@@schuballaa Das kannst du sicher machen. Google einfach "watchdog NE555".
@@AndreasSpiess ah, vielen dank, habe ich wohl zu kompliziert gedacht ;) stimmt mit diesem Dinosaurier sollte das gehen, vielen Dank
Me first!
:-)
Great video. But can't you just use brown out interrupt that many microcontrolers have to control low voltage programatically?
While discharging this is possible. But not during power up as I showed in the video. Then, the MPU does not yet work.