Reading voltage from current shunt

Not open for further replies.


Hi All,

First post here and need some advice.

I am working on a project using a Teensy 3.6 and one of the things I am required to do is read the voltage from a current shunt fitted to a light aircraft.

The current shunt is a 50A shunt that provides 2 output wires to read the current passing through the shunt. The value will be between -2.5v and +2.5v depending whether the battery is charging or discharging. So if all the electronics are pulling 50amps then the output from the 2 wires will be -2.5v. If the battery is charging at 50amps then the value will read +2.5v.

I have tested it with a multimeter and sure enough, it does put out + and - voltage depending on direction. The wires are labelled as + and - on the shunt.

How would I connect these 2 wires to the Teensy and how would I read that type of voltage?

Any help would be much appreciated. Many thanks in advance.
I'd be inclined to use a 50A bi-directional ACS758 if possible. You can measure from this sensor directly from an analog pin.
Quick glance the ACS758 is a separate current measure device? Assuming the OP must use the in place device and find a way to safely read the existing -2.5v to +2.5v range - and not cut into a 50A existing and tested design.
You could use a MOSFET rectifier and an op amp. This would give you one analog input from the rectifier that indicates magnitude of current flow, and the op amp gives you a digital I/O that indicates the sign (charging or discharging).

Not really optimal. You'd need MOSFETs with very low threshold voltages. You wouldn't be able to measure very low currents, how low you can read would depend on the threshold voltage.
Screenshot from 2018-12-25 10-06-28.jpg
Unfortunately, I have to use the existing installation. If I physically change anything then it has to go through a fairly lengthy approval process with the light aircraft association.

From testing, it seems that each wire is either positive or GND depending on the direction of current flow. The most I managed to put through the shunt was about 15amps as that is all the aircraft uses with everything switched on (using a clamp meter to test). At this amount the multimeter was showing -0.77v. When switching on the engine so the alternator kicks in, the multimeter was showing +0.64v. If I reversed the multimeter probes then the voltage negated.

Could I not just put each of the 2 wires in to seperate analog inputs on the teensy and do a comparison between the 2 readings? It doesn’t have to be super accurate, it is only going to be a warning system so doesn’t have to be accurate to anything more than around a quarter of an amp.

I have not tried this on the teensy yet as I didn’t want to risk any damage before I checked first.
Or you could use two op amps, one as a precision rectifier and one as a sign indicator. That'd work! (yeah i'm not an electronics guy, i'm just bored)
negative voltage is bad for teensy or any other mcu. you need to figure out if you want to read a digital signal (CHARGE or OFF) or actually read the analog value and go from there
I am no expert at this and just do some electronics as a hobby. But is it actually seen as negative voltage. I would assume negative would be if you had a common ground. From what I can see, both wires don’t go negative. In one direction, one wire is ground and the other shows a voltage. In the other direction, the other wire is ground and the 2nd wire is positive. Looking at each wire individually, it is either GND or a positive voltage so if both wires were connected to teensy analog inputs, one input would show 0 and the other would give a reading and that would reverse when the current flows in the other direction.

Maybe I have it wrong but wouldn’t a negative voltage be if there was a common ground between the shunt and the teensy power. In this case, isn’t it just the case that the 2 wires of the shunt that are completely independent of the teensy power, just change polarity with direction. The multimeter would show a negative voltage because depending on flow direction, the probes of the multimeter would be reversed.

As I said, this is an area that I don’t fully understand so I could be completely wrong.
I know that this old DATAQ serial data logger (DI-194R) I have can do +/-10V using a 0-5V ADC in a PIC using just resistors in its front end. This of course makes assumptions about the output impedance of the source and ADC input.

It uses 3 resistors: All three have one terminal connected to the ADC input and the other ends connected as: 100K to +5V, 200K to ground, and the other 200K to the input signal. There was probably a capacitor on the ADC input to keep its sample and hold happy.

You can certainly do something similar with the Teensy. You might want to explore how it works using something like LTSpice first.
What voltage do you measure from either two wires and ground when the battery is charging, or when the equipment is run from battery only?
Your planned circuitry will need to compensate for this offset voltage if your run your Teensy DC supply from the same aircraft DC voltage source due to the Teensy sharing the same aircraft ground - unless you plan to use a battery for your shunt circuits and Teensy.
I just thought I would update everyone on this for future reference.

It all works when you connect both the current shunt wires to 2 x teensy analog inputs. I tied each input to GND with 10k resistors. When current is travelling in one direction, then the corresponding analog port shows a value proportional to the voltage from the current shunt. The other analog stays at zero. If you reverse the current flow through the shunt then the reverse happens whereas the other analog input shows a value proportional to the current shunt voltage and the first analog input shows zero. It is actually fairly accurate and all agrees with the clamp meter to virtually a couple of decimal places.

I tried a different current shunt as well which was a 50A 50mv shunt. This was more of a challenge due to the extremely small voltage put out by the shunt. I solved this by using an external voltage reference on the AREF pin created with a resistor divider to a measured value. Again, even at this very low voltage, I got a very accurate reading.

Glad to hear its working for you.
Further refinements could include an autoranging circuit to bring the shunt voltage closer to the maximum analog input of the Teensy, but you may not require such a feature.
Please post on sketch of your circuit, the way you describe is fishy and could lead to magic smoke eventually. Any voltage applied below -0.3v will damage the micro due to the internal protection diodes on all pins. The fact that your reading that shunt in that manner leads me to believe the Teensy is powered from a floating supply that allows a small current to pass thru the pin with negative voltage causing it to be biased in that direction.

A safer alternative is to create a divider with 2x 10K resistors from the side of the shunt that is not 0V, instead of having the second resistor tied to 0V you tie it to 3.3V. That will pull the voltage up and re scale it. For a +2.5V to -2.5V range input you will get a 2.9V to 0.4V reading.
Last edited:
I have not really taken this much further as I have had other things to do first. Basically the circuit is super easy. The teensy is powered from a 3.3v tracopower 1A switching voltage regulator to the VIN and GND pins. The shunt goes to pins A0 and A1 on the teensy and each is tied to GND via a 10k metal film 0.6w resistor. The shunt I am testing this with is a 50A 50mv shunt so very small voltage. I have a 400mv voltage reference IC attached to the AREF pin (it’s the smallest voltage reference IC I could easily find).

I cannot find the shunt producing any negative voltage on either wire. It is either GND or a positive voltage up to 50mv. I put my oscilloscope on each wire and I don’t see a negative signal. When current is travelling in one direction I get a analog reading on A0 and zero on A1. When it travels in the other direction I get a reading on A1 and zero on A0.

If there is a better way of doing this, I am more than happy to try other ways if there are risks attached to the way I am doing it now, especially when I move to the shunt that is 2.5v.
If there is a better way of doing this, I am more than happy to try other ways if there are risks attached to the way I am doing it now, especially when I move to the shunt that is 2.5v.

I dug into the data sheet and the ADC has a differential input mode which is perfect for this application. I have no idea if the library code supports this hardware capability. If not, you will have to figure out the details from the data sheet.
The differential ADC has opened me up to a whole world of possibilities and reading up on it, it does seem to be able to solve my problem. Even if not on the teensy, there are some pretty good ADC modules that do differential ADC and also have some extras on top like signal gain etc and handling negative voltage.

Thank you for that.
Differential mode will probably help but will not work with negative voltage, Steve0 can you provide any schematics on how the teensy and shunt are connected. Without some isolation or separate sources I dont see how your not seeing negative voltage.
I don't really have any written schematic as this was purely a test to see if it could be done. I am working on a project for a light aircraft and if I could read the current shunt then it could, in the future, free up some space on the panel as a particular instrument would not be required anymore (this would all be subject to approval).

The shunt I am testing with is here:

The connection is simple, the main power supply (12v desk power supply at the moment) goes to the left hand side of the shunt and then the right hand side of the shunt continues on to whatever it is powering. The two small screws have a wire coming off that go in to A0 and A1 on the teensy and I have tied each wire to GND with a 10K resistor. The reason for pulling them down to GND is they float when there is no power going through the shunt. The teensy also runs off the right hand side off the shunt via a TracoPower 5v regulator. I also have things like a 12V bulb and other things running off the power supply just to draw some power through the shunt.

To me, it seems to just reverse polarity when the power flow is reversed through the shunt (i.e. turn the shunt around). So for example, when I turn the light bulb on, my desktop power supply says I am drawing 4.7A. When I read the A0 port on the teensy and convert the figure to a voltage, I am getting a figure which very much agrees with what the desktop power supply is telling me. At that stage, A1 just reads zero. If I reverse the shunt, that value transfers to A1 and A0 reads zero. I am getting the same evidence on an oscilloscope when reversing the current flow just reverses the polarity of the wires from the shunt. Now if those wires from the shunt were connected directly to the GND on the teensy, then I would cause a burnout as it would be GND going direct to positive.

Obviously, if I put a multimeter on the 2 wires, it will read a negative voltage depending on the direction of current. But if I simply swap the probes around it then reads a positive voltage.

I am no expert when it comes to negative voltage as everything I do never requires the use of anything but positive voltage or ground. I guess if these wires were connected to a device to be powered from it, then it would be a negative voltage, but treating the 2 wires individually, all I see is either nothing on a wire or a positive on the wire.
Now I see what your doing. Rotating the shunt does not produce the same result as actually running current in both directions. You will not get the same result in the complete system. In the correct configuration your gnd/0v point will never change. I'm at an airport right now, I can toss a few examples up once I get back to my pc. There is a few ways to do it, it just depends on how you want it to work and what compromises you can live with, a long with how complex.
Agreed, physically reversing the shunt is not the same as running current in a reverse direction but it does emulate the same effect, I have tried the process on the real aircraft and the same results were found. The positive wire just swapped with the other wire just becoming nothing (i.e. having the engine running so the alternator charges the battery).

I guess the kind of confusion here is 'what is the definition of negative voltage'. On any battery, if you reverse the red/black probe on the multimetre (red probe going to - terminal and black probe going to + terminal) then the meter will read a negative voltage. But if you look at the terminals individually, then the + terminal is positive and the - terminal is GND (0v). It is only when you are sending a positive signal down a wire connected to ground that the voltage becomes negative (i.e. reverse polarity). You can correct me if I am wrong here as I am just making an educated guess. So if you had a permanent circuit where a particular wire was ground and another wire was positive and then you started sending positive signals down the GND wire, then essentially you would have a negative reading (and destroy the device if it wasn't protected in some way). With the shunt, it is not being powered by the teensy and is simply creating a positive voltage on the wire closest to the current flow direction (it seems). Each wire is being treated as a separate wire. For me, negative voltage is when the positive wire has a lower potential than the GND wire. But it does become positive if you reverse the wires.

Hopefully I am not making that sound too confusing.
What you are looking for is a high side bipolar current monitor. This could be in the form of a single chip such as an 'ina139' * or an instrument amplifier that can monitor the small (differential) shunt voltage and provide some amplification and also apply an offset such that the voltage output is in the range of 0v to 3v with 0.0amps being 1.5v output. Your favorite search engine can help you find a working circuit.

(*) OK so this part number example is only able to monitor unipolar currents, but there are chips made to measure bipolar currents using a current shunt as the OP requests. Search at Digi-key or mouser or major parts supplier in your country should help locate adequate devices. These devices are just instrument amplifiers configured in a specific way.
I don't really have any written schematic

Which is a problem because getting the connections correct is most of the battle. From your description it still isn't clear if the shunt is on the high or low side and just exactly how the Teensy is powered. I can't even tell if your 5V supply has an isolated output although I suspect it does.

If the shunt is on the high side and the Teensy supply doesn't provide any isolation, then the Teensy will die if there are no current limiting resistors between the shunt and Teensy inputs. In any case, the lack of any protective circuits for the Teensy inputs will eventually result in failure as there are large transients present in real systems.
Here is an example of how the connection would normally happen and what voltage we would expect. This follows Ohms Law and Kirchhoff's Voltage Law, no matter what you do you cant break these laws.

On the Left the Battery is the GND/0V point. On the Right the Motor/Alternator is the GND/0V point.
The Battery is represented by a fixed 12V supply, the Motor is represented by a sin wave with a DC Bias of 12V and a pk-pk of 100mV.

I'm going to reference the GND/0V on the battery for the below explanation. The only difference is the polarity as shown in the graph of the 2 examples because the GND/0V reference point changes.
When the Motor Voltage is higher then the battery the current flows towards the battery and the opposite occurs when the Motor Voltage is lower then the battery. If the Motor Voltage is greater then the battery then you will have a negative voltage difference across the Shunt Resistor(and positive current into the Battery), if the Battery Voltage is greater then the Motor Voltage you will have a positive voltage across the shunt resistor. This is because the Battery voltage is fixed at 12V and the positive of both supplies is tied together meaning if the Motor is at 12.05V then A0 point gets pushed below 0V. The opposite is true if Motor voltage is 11.95V.


This is what is confusing me about your explanation. If the Teensy is floating from ground I can see this working but I can also see bad things happening to the Teensy over time.
Not open for further replies.