Level shifting an analog signal - Page 1
Forum section: electronics / beginners

author: Mandrewoid
author_rank: Newbie
timestamp: February 11, 2022, 02:11:30 am
content: Hi everyone. I have been working with measuring an analog voltage with a microcontroller that is considerably above the range of its ADC. As usual, my first goto tool was a resistive divider. Unfortunately, due to the characteristics of this signal (which is a plasma cutter arc by the way), I am wasting a lot of my ADC. What I mean by this is, a resistive voltage divider is a great way to measure a 0 to 130 volt signal, but what I am measuring is actually a 110 to 130 volt signal, it never drops below 110 volts.I wonder about using a 100V zener diode to "level shift" the signal down instead of /before "compressing" the signal down with a divider. This seems like it must be too simple to work accurately, I am guessing the differences in current across the zener will cause the voltage drop across it to be inconsistent? Sample schematic is included though. Of course, it works perfectly with ideal components in circuit simulator.I suppose a real EE solution would probably involve a votage divider and then maybe a differential amplifier?another option may be just to opt for an external ADC with 6 more bits, but the technical challenge of how to level-shift rather than compress an analog signal really intrigued me.Also for those familiar with plasma cutting, this is not a high-frequency ignition unit, it is a blowback pilot.Thanks,Andrew.(And by the way, don't worry about warning me about high voltages and shock risk and arcs etc. I'm well aware, and taking good precautions. I'm already dealing with high voltage and high temperature metal, UV light, the list goes on)

author: rstofer
author_rank: Super Contributor
timestamp: February 11, 2022, 03:11:33 am
content: See Chapter 4 of "Op Amps For Everyone". You need an op amp and 4 resistors to offset and rescale the input.https://web.mit.edu/6.101/www/reference/op_amps_everyone.pdf

author: ledtester
author_rank: Super Contributor
timestamp: February 11, 2022, 03:26:35 am
content: A couple of questions:Is it the possible that the signal could be less than 100V (like when the cutter is off) but you're not interested in measuring it in that case?How noisy is your signal? I would expect anything related to a plasma cutter to be rather noisy electrically.

author: Mandrewoid
author_rank: Newbie
timestamp: February 11, 2022, 04:39:46 am
content: Yes it can definitely be less than 100V, but it would be 0V at that point and I don't care to measure it.I do expect it to be "pretty noisy" but finding out exactly how noisy is part of why I want to measure. The other part is that the arc length and voltage are directly proportional, and arc length is critical for good quality cuts.I didn't realize until a few minutes ago that opamps are actually available with pretty high input voltages. Maybe the best route for me is to divide my signal by 2 or 3, and then do a offset and rescale as @rstofer reccomends.

author: ledtester
author_rank: Super Contributor
timestamp: February 11, 2022, 05:07:10 am
content: Quote from: Mandrewoid on February 11, 2022, 04:39:46 amIt can work... just keep in mind that op-amps generally only work with inputs that are within its supply rails.What kind of microcontroller are you using? If it's just a matter of getting 14 or 16bit resolution you might just get a I2C/SPI module like this:ADS1115 16-Bit ADC - 4 Channel with Programmable Gain Amplifierhttps://www.adafruit.com/product/1085Other ADCs in module form exist with different resolutions & features.

author: bdunham7
author_rank: Super Contributor
timestamp: February 11, 2022, 05:25:33 am
content: If you are just looking for a single integrated DC voltage reading, I'd suggest you use a reasonably high impedance (100k at least, maybe 1M) 10:1 divider followed by a bit of filtering and then an op-amp offset circuit as suggested byrstoferto take about 10 volts off and give you a 1-3V signal that should be within the range of your ADC. By doing it this way you minimize the energy going into the sensing circuit and you only need one stage of op-amp and almost any op-amp will do. LM358 with a single 15V supply should work, for example, and that's as simple as it gets.

author: Mandrewoid
author_rank: Newbie
timestamp: February 11, 2022, 05:30:42 am
content: ATmega32U4 / Arduini pro mini.It does look like 16 bit ADC would give me .002 volt sensitivity with a simple divider which is definitely enough. I like the sample rate of the builtin ADC, but I'm only making machine control decisions at 10-20 HZ so I can probably do fine with the 860 S/sec. Maybe do some simple filtering on 86 sample batches.I do have some assorted opamps as well though, so I may try that option as well becuase I can have a much better look at the signal if I'm sampling 10Ks/s or more.

author: Cerebus
author_rank: Super Contributor
timestamp: February 11, 2022, 05:37:14 am
content: Presumably you don't care about drawing a small measurement current from your 130V source.Something like this ought to do it, and will load your 130V supply by about 1 to 1.3 mA.The principal should be obvious. Convert your high voltage into a small current by connecting it via a resistor to the virtual earth/summing junction of an op amp in inverting configuration. Subtract an offset current representing your minimum input voltage using a suitably sized resistor connected to a convenient negative voltage. I've picked pretty arbitrary values for everything just to create a fully worked example, but you obviously need to scale everything to suit the output voltage you need.Note that the output is inverted, and that you're going to need ± supplies for the op amp. Obviously you're going to need another op amp to invert the signal again if you want a positive voltage to represent your input voltage. Again obviously you can fiddle with the negative biasing resistor depending on what negative rail you actually have available, it just has to suck 1mA away of the signal current coming from your signal source via the 100k resistor. A total signal current of around 1mA is arbitrary but it represents the sort of current that most op amps will happily output while still having good linearity. It could equally well be 100uA or 500uA, just as long as it's not so low that you get into the weeds and start being affected by the op amp's own bias and offset currents and introduce unnecessary noise from high impedances.On this sort of application don't skip the protection diodes - it only takes one 1kV spike getting in to destroy your op amp, but it won't if there are some reverse biased diodes to the supplies from the summing point. Also, make sure that the 100k current source resistor is adequately rated for working voltage - in these days of itty bitty surface mount resistors it's quite easy to exceed or get close to a physically small parts voltage rating. You can use several suitably spaced resistors in series as an alternative to a higher voltage rated, more expensive part, if you like.If you scale the op amp output to the full range of your ADC, 12 bits will give you 7.32mV resolution within a 100V to 130V range. I suggest that you aim a bit lower than your 110V minimum (I've picked an arbitrary 100V) to allow some wiggle room for op amp offsets, calibration and so on.

author: ledtester
author_rank: Super Contributor
timestamp: February 11, 2022, 06:44:42 am
content: Quote from: Mandrewoid on February 11, 2022, 05:30:42 amAnother possibility:https://www.arduino-tech.com/ads1256-24-bit-8-channel-adc-ad-module-high-precision-adc-acquisition-data-acquisition-card/Looking at the ADS1256 datasheet:https://www.ti.com/lit/ds/symlink/ads1256.pdfat 30Ksps the effective number of bits is 20. Just google "ADS1256 arduino" for other purchasing options and library support.