Best approach to detect under current or brownout  - Page 1
Forum section: electronics / beginners

author: sairfan1
author_rank: Frequent Contributor
timestamp: May 09, 2023, 07:39:53 pm
content: I'm hobbyist if title does not describe my question please let me know I will update the title.It happened to me twice that module I was working on got rest or did not perform properly because at some point it needed current more than supplied but I was not able to catch the issue.First time it was GSM module and it needed more current while joining the network but it got reset and 2nd time when ESP8266 was quite new while joining Wifi router it got reset, in both cases it took me days to find out the actual reason and I found it by chance that means it could have been more than that. I believe there are some USB monitor and additional current monitors but they do not halt or display the problem, such current dips quickly move on and its really hard to see.I want to know is there some device where I can set the lowest current limit and when it touch that limit it pause/halt etc to show me actual condition of current/voltage flow.I can spend up to $200 (or more if really helpful) for buying such thing.

author: Kim Christensen
author_rank: Super Contributor
timestamp: May 09, 2023, 08:01:34 pm
content: Is this for permanent monitoring or just during testing?For testing, you could just use a digital oscilloscope set to one-shot mode with the trigger set for the lower bound of the voltage.

author: tooki
author_rank: Super Contributor
timestamp: May 09, 2023, 08:07:47 pm
content: I don’t know if the ESP8266 has it, but the ESP32, like most MCUs, has brownout detection. At the bare minimum, you can read the reset reason after a reset. So using serial logging, you could detect it there.I don’t know off the top of my head whether you can disable the brownout reset, leaving you only an interrupt or flag to deal with. (You can set the voltage threshold, so you could set it quite high, giving you time to log something.) Edit: seehttps://stackoverflow.com/questions/73200166/exception-handling-for-brownout-detector-was-trigerredSimilarly, you could use comparators to trigger at particular voltage levels, which you could then use an interrupt to detect.A multimeter with a reasonably fast peak min/max mode (like the Fluke 87V, which reacts to 1ms events) can be used to measure your peak current and min voltage. Every time a new extreme is recorded, it beeps. So with some stress test code, you could probably figure out a lot. As Kim said, an oscilloscope could also do this.Of course, you could just add some extra bulk capacitance to the power rail and call it a day…

author: sairfan1
author_rank: Frequent Contributor
timestamp: May 09, 2023, 08:21:09 pm
content: I need such thing for developing and testing firmware and its not particularly for ESPs, I refereed to ESP just as an example.Soon I will be starting some project with LoRa and some other wireless modules, I was looking for some general solution that I can use with any of such modules.

author: sairfan1
author_rank: Frequent Contributor
timestamp: May 11, 2023, 05:49:34 pm
content: There are some USB power monitors, can they help to detect brownout condition??I also wanted to know does any of these USB power monitors also offer to use external power source, like if I connect it with PC for programming the device but for power source I can depend on separate power supply?

author: bdunham7
author_rank: Super Contributor
timestamp: May 11, 2023, 06:16:57 pm
content: Quote from: sairfan1 on May 09, 2023, 07:39:53 pmUnless I misunderstand your issue, the fault will show as a voltage drop as the device draws more current than is available, but unless it drops out or stops using power when it resets I wouldn't expect the current to drop--and even if it did, there would still be a voltage drop during the process. So monitoring the voltage and tripping a detection circuit when it drops beyond a threshold would be the most obvious way of doing this. The only remaining question is what the time period of the event. Again the most obvious solution is a digital oscilloscope or similar capture device with 2 channels, one set to measure (and trigger on) voltage and the other measuring current through a shunt. Selection of the shunt might be tricky due to wide variations in current. You might need to use a transimpedance amplifier like the µCurrent Gold or Current Ranger.

author: Peabody
author_rank: Super Contributor
timestamp: May 11, 2023, 07:49:14 pm
content: I think a scope is the best solution for this problem. But you don't have to use a "real" scope. In fact, the scope will be more useful if it's battery powered so it isn't referenced to ground. I've used my DSO150 for this purpose a number of times, and it works great. You set it to single-shot mode with the trigger level set just below the nominal voltage. If the voltage drops below the trigger level, the scope will display what's going on, and freeze the display until you release it.I wouldn't recommend the DSO150 now because it isn't battery powered unless you count a 9V battery, or convert it to lithium like I did. But there are similar "toy" scopes for around US$30 with rechargeable lithium batteries. Here's one I haven't tried, but it looks like it would work.https://www.banggood.com/FNIRSI-138Pro-Multifunction-2_4-Inch-Display-Digital-Oscilloscope-One-Button-Auto-Adjust-PWM-Square-Waves-Output-p-1978708.htmlAnd Dave recently reviewed another faster, more expensive version, but still under US$100 as I recall.And you will find many other uses for such a scope. You can look at power supply ripple, and the effect of different capacitors on that. It would be better to have two channels, but one is still very useful in looking at low-speed stuff. (You won't be doing RF on such a scope). The only downside is the abuse you will receive from Dave and other professionals who seem to consider these scopes as "rubbish". But I have to admit that Dave is doing better recently. In any case, it's a question of where you are going to spend your budget, and how much use you would actually get from that last 100meg of added bandwidth (not as much as the first 100K, I suspect).I seem to remember that there's a recent thread, either here or on the Arduino forum, about what is the best such scope to get these days.