Sensing voltage, current glitches on 5V rail: schematic enhancements? - Page 1
Forum section: electronics / projects

author: Nominal Animal
author_rank: Super Contributor
timestamp: January 01, 2018, 08:05:06 pm
content: I am trying to find or develop a dirt cheap, open source, open hardware solution, for measuring voltage and current glitches on 5 VDC power rail at 0 - 7.5 A or so.My current idea, as roughly outlined in the attached schematic, is to use a microcontroller that has at least two single-ended ADC inputs and can do at least 100 kSamples/sec. I am most familiar with the Teensy family of microcontrollers, and Teensy 3.2 fits this bill, although it does cost about 20 USD. To sense the instantaneous current, I'll use an opamp to measure the voltage drop over a 0.01 Ohm shunt resistor, and another opamp with a gain of 43.5 to get the voltage drop to an easily measured 0.0 - 3.3V range. To sense the voltage, I'll use an opamp pair, with a voltage divider (to halve the voltage, roughly) in between. Having opamp outputs means the internal ADCs in microcontrollers should be able to get to high enough sample rates at 8 to 10 bits/sample; they really prefer low-impedance signal sources.Note that absolute precision is not a priority. What is important, is to be able to detect any voltage drops, or current spikes; their rough size, and rough duration.The microcontroller will need a 5V power rail; a 7805 should work fine. I think a small 8V regulator should suffice for the opamps; I'm thinking of using a 78L10 for that. As to the opamps, I think a LM224 should suffice, as the differential signal range is only 0 - 5.5 V or so. As to the input to the regulators, any 12V to 22V isolated DC voltage source -- say, a cheap laptop power supply or similar -- should work.Can you see any reason why this would not work? Any recommendations, fixes, enhancements wrt. the schematic?I'm working on the schematic and board onmy EasyEda.com page; currently, the project ishere, but I suspect the URL may change between revisions.Background:Single-board computers running Linux with USB3 support are now available. I have an Odroid HC1, which uses a Samsung Exynos 8-core processor, and has lots of goodies. The HC1 uses the USB3 port for a USB3-to-SATA bridge, and can be used with a 2.5" SATA HDD. When these spin up, or the head assembly moves, they need a lot of current. I'm even using a ZTE MF823 LTE USB2 modem, which is notorious for its "spiky" current draw; it only stays within the 500mA allowed by the USB buson average, but may gulp up to 1.5A (according to some, I don't have an oscilloscope to verify it myself) in very short spikes.On average, the current draw is just on the order of 2A to 4A, but to avoid voltage drops, the supply must be able to provide 6A or more, in this configuration!The root cause of this issue is of course the board depending on an external 5V regulated source at such a high current (6A or more). The board does not even have much bulk capacitance on it.Other boards have similar problems. For example, Olimex has an USB-CAP female-male USB dongle, with a couple of milliFarads of low-ESR caps between the power rails, just to smooth out the USB bus voltage (that might otherwise drop due to spiky current demand by the USB device(s)). So, this is not just an Odroid problem, but common to many SBCs.Most of us playing with this kind of hardware do not have oscilloscopes, and cannot afford one. For example, the Odroid HC1 only costs $49 USD.The intent of this gadget is to be a cheap way of determining if power glitches occur, and whether the fixes applied really fix them. The "fixes" I envision are two-fold: addition of an LC filter (couple of millifarads of low-ESR caps, and possibly a suitable inductor) to the board itself (or to the 5V input); and/or using one of the cheap adjustable buck converters as the power source, with very short leads to the SBC, and using a 12V or similar wall wart to provide the power to the buck converter. A 12V 3A wall wart is much easier to find than a 5V 6A one, too.I know many members here could easily design a buck converter with beast-mode output filtering, with output voltage fine-tuned between 5 and 5.5VDC at 30W or better output power; perhaps even with a disable input and a separate 5V 0.5A always-on power rail for microcontroller-based power control. That would be truly nice.. But unfortunately, us SBC hobbyists probably won't be able to build and calibrate those safely.What I want to do, is to create a cheap tool, so that SBC hobbyists with limited budgets (and no oscilloscopes at hand) can detect power issues, and report them.Any and all feedback on this is warmly appreciated.Nominal Animal

author: David Hess
author_rank: Super Contributor
timestamp: January 02, 2018, 01:51:12 am
content: High side current sense requires an instrumentation or difference amplifier or something more like this:https://www.eevblog.com/forum/beginners/%27classic%27-high-side-current-sense-amp/

author: Nominal Animal
author_rank: Super Contributor
timestamp: January 02, 2018, 06:44:43 pm
content: D'OhThanks for the link! That got me out of a silly rut thinking in circles. (I should not be this stupid; I do have seen (although not built) such high-side current sense circuits before.)What I did not realize before, is that a voltage divider before the opamps makes everything so much simpler.Attached is my redrawn schematic, basically stolen fromcellularmitosis' Draft5from that 2015 thread. However, I also want to measure the voltage at the load. The simplest approach appears to be to simply add another opamp as a buffer, using the load-side voltage just before the differential amplifier, as in the attached schematic. Does that look sane?(I shall install a circuit emulator, to see what kind of resistor values range I can use to get the characteristics I want.)Thanks for the help; and any further comments and improvements are very much appreciated.

author: David Hess
author_rank: Super Contributor
timestamp: January 02, 2018, 08:21:37 pm
content: I am not a fan of using resistive dividers to reduce common mode level in high side current sense circuits; they are bad for precision and performance. In this case reducing the common mode level was not even needed because you had a +8 volt supply available; did you remove it as a simplification?I would not bother buffering the input to the high side current sense circuit because it is not necessary and it adds errors. (1) A better option if a higher supply voltage for the operational amplifier is not available is to use an operational amplifier which has a common mode input range which reaches the positive supply. This includes the old LM301A and also faster parts like the JFET TL051 which would be my first budget choice but if you are only running on +5 volts, a more modern part may be needed which makes the +8 volt auxiliary supply more desirable. (2) Consider using just a resistor and zener diode to make a shunt regulator for the +8 volt or higher supply.Replace Q1 with a JFET or MOSFET to eliminate the base current error in the output. This will not be a problem though in low precision is acceptable. I the old days they used Darlington connected bipolar transistors to reduce this error but this comes at a compromise in frequency response.If you want to measure the voltage at the load with high precision, then a difference or instrumentation amplifier should be used to remove errors from the current through ground. However I am not convinced this is relevant if the regulator itself is not doing the same thing with remote sense. Who cares what the exact voltage is if the load regulation of the voltage regulator itself is compromised by the same thing?(1) This is especially a problem when the voltage across the current shunt is low which will normally be the case.(2) I am not sure how well the TL051s works on only +5 volts; my guess is poorly.

author: Nominal Animal
author_rank: Super Contributor
timestamp: January 03, 2018, 04:48:12 pm
content: Thanks to the suggestions and advice from David Hess above, I did a bit of digging into dedicated high-side current sense amplifiers. (Thank you, David!)It looks like the TS1100-50 might be a good fit. Although it is at end-of-life, they seem to be easily available in singles for us hobbyists. Its small-signal gain starts to drop above 3kHz, but it looks like it's only about 14dB attenuated at 50kHz (so signal levels attenuated by a factor of 6 or so), which might be sufficient. (As I mentioned before, I don't have an oscilloscope to actually verify the behaviour in practice, so I'm completely hand-waving here. I'd prefer 100-200kHz near-unity gain bandwidth, but not if it gets too expensive.)Voltage on the load side is measured using a simple voltage divider, to bring the voltage down to easily measured range. Both the amplifier output and the output from the voltage divider are buffered by fast opamps, preferably a rail-to-rail one; as mentioned before, I'd like to sample them each at around 100 kSamples/sec. Buffering is necessary to keep the ADC input impedance low, to allow that high sample rates with built-in ADCs. In the attached schematic, I marked the opamps LMV358, since those are what I can easily get on the cheap, but most dual opamps seem to share the pinout, so there should be many acceptable drop-in alternatives.Any comments on this very much simplified schematic? We're deep in the realm where experience would be invaluable... Although I do guess that measuring 4-6VDC at 1-9A for transients is not very common thing to do.Any guidance wrt. part selection? A higher-bandwidth high-side current sense amplifier would be nice, especially if easily available in singles and not too expensive (say, under $3 in singles).

author: David Hess
author_rank: Super Contributor
timestamp: January 04, 2018, 02:34:24 am
content: Quote from: Nominal Animal on January 03, 2018, 04:48:12 pmThere used to be an alternative dual operational amplifier pinout which was used for precision parts and I got into trouble with it once. Checkout the 8 pin SO (small outline) pinout shown on the LT1013 datasheet.QuoteAt low currents, the voltage going into U2.1 will be close to the negative supply so do not count on accurate measurements. Solving this requires a negative supply voltage or a differential input to the ADC.QuoteI am not a fan of high side current sense ASICs (application specific integrated circuits) but they certainly work. The bandwidth of the TS1100-50 is low because it is intended for micropower applications. It is too slow for what I would consider glitch measurement.For cheap, I might use the TI TLV2372 for both the buffers and high side current sense.

author: Nominal Animal
author_rank: Super Contributor
timestamp: January 04, 2018, 03:59:59 pm
content: Quote from: David Hess on January 04, 2018, 02:34:24 amNoted. (I've managed toexplodean opamp by connecting the offset balance pins to VCC and ground. Twice.)Quote from: David Hess on January 04, 2018, 02:34:24 amYes, I was aware of that; currents below 1A or so (at the nominal 5VDC power rail we're measuring) are not at all interesting in this application.Quote from: David Hess on January 04, 2018, 02:34:24 amThanks. I have zero experience in glitch measurement, and such advice is invaluable here.Could I use the supply side voltage for high side current sense opamp, noninverting input tied to Vdd? It will be in the range 4 to 6 VDC, so well within the TLV2372 spec. I'm just having a hard time understanding how it'd affect its response to the voltage and current transients.As I mentioned earlier, not needing a separate supply (higher than the measured voltage rail) would make everything much simpler.

author: Nominal Animal
author_rank: Super Contributor
timestamp: January 04, 2018, 07:46:49 pm
content: So, if I've understood correctly, the attached schematic should work for my use case.One of the TLV2372 opamps is used as a voltage follower, to buffer the halved load-side voltage, so that the VSENSE line has a suitable range and a low impedance for an ADC. The other opamp in the dual package is used as a differential amplifier, with a gain of 39.2.The opamps are powered from the supply voltage. I did not see anything in the TI TLV2372datasheetthat would indicate any issues, but practice trumps theory, and I would really appreciate any comments on this kind of practical usage. In particular, I do not grok/understand how this affects the transient response.(To repeat, the intent is to monitor voltage and current transients on a nominal 5 VDC, 1 to 4A load (hopefully 1V to 6V, and 1A to 8A, measurement ranges), with a freely available board design, and cheap components any hobbyist can get in singles. Us poor single-board computer hobbyists don't have the test equipment (like oscilloscopes) that would allow measuring such transients on the bench. Would really have an use for a DS1054Z right about here, though.)Again, I really appreciate the comments from David Hess, as well as any other comments or suggestions or warnings related to the attached schematic. Thanks!

author: David Hess
author_rank: Super Contributor
timestamp: January 05, 2018, 12:16:16 am
content: Now you have an instrumentation amplifier for measuring the current. Yes, that should work with a rail-to-rail input and output operational amplifier.