Differential Analog on Teensy 3.1

Status
Not open for further replies.

jkern

New member
I want to use "analogReadDifferential" to record the voltage drop (and, consequently, current) across a shunt resistor in an electric vehicle. I've seen references to this function and indications that Teensy 3.1 can do differential analog measurements. I've done single-ended measurements with the Teensy, but not differential. In the circuit being analyzed, the shunt resistor is rated at 50mv per 500 Amp, and there's a 500 Amp fuse in the circuit. So, I'd be measuring differential voltages that are <50mv. But, the system is a 72V DC system, so I want to make sure that I get this right. Here are my questions:

-Do I hook one analog pin to each side of the resistor (say A0 and A1) and then use analogReadDifferential(A0, A1) to get the measurement?
-Would that set-up (if it's right) give me the reading for A0-A1 or A1-A0?
-Is the system tolerant of negative voltages?

I've searched for but not found any info on this topic. If it exists somewhere, please excuse my ignorance and point me at it. Thanks in advance!
 
The teensy has a unipolar ADC. So if you need to make negative measurements, you either have to level shift with an op amp, use the open energy monitor approach or some similar tactic.

Given the potential voltages, my inclination would be a different approach, ie using a dedicated analog front end like the MCP3910 with a isolation barrier. That chip can get by with as few as two isolated channels to run it though I'd use a 5 channel Analog devices isolation + power rig (ADUM series - 3 channels out (CS, MOSI, CLK), 2 channels in (MISO and DR)) and enable the usual SPI channels as well as DR to see when a sample has completed.

The MCP series features a bipolar ADC, a PGA to allow a wide range of input sensors, and they've helpfully provided some pretty good documentation re: the circuits around the chip. For sure, the rig is optimized around 50/60Hz applications (in terms of suggested low pass filters), but that's something that can be addressed after you determine the frequency range of the motor.

The isolation can be pretty important. Stay safe, especially at those amperages surging through the system.
 
Last edited:
Canstantin: Thanks! Sounds like wisdom. I was wondering about isolation. In the absence of better advice, I was planning on a protective fuse. But, I will study-up on the MCP3910 and talk to my electrical engineering buddy before I proceed.

That being said, does anyone have information on differential analog measurements? It could be useful on some other projects that I'm looking at.
 
None of this will work directly with the Teensy if the two inputs are both close to the 72 V -- they both have to be within the operating range of the ADC -- a few V.

In addition, in some vehicles, the 72 V (48 V nominal) system is isolated from the 12 V system -- 0 V on the 72 V side is not necessarily vehicle chassis/ground. In cars, even the 'ground' can vary signficantly because of the high currents. If your vehicle is like this, you will need isolators (e.g. optoisolators) to pass signals from one domain to the other.

Rather than using a differential analog ADC input, use one of these - http://www.ti.com/product/ina193 -- they are intended for this type of application.
 
The teensy has a unipolar ADC. So if you need to make negative measurements, you either have to level shift with an op amp, use the open energy monitor approach or some similar tactic.

the ADC of any microcontroler should be preceded by an amplifier to give the best dynamics and then, exploit the best the ADC resolution.

but to shift the level of a negative voltage, you just need a positive voltage and two resistors ;)
 
Hello... Does anyone have any example source code on how to implement a differential read. I have a 4-20mA loop that will be monitored by a Teensy 3.6 for data acquisition (two channels) via an 150 ohm resistor (20mA x 150ohm = 3.0V; 4mA x 150mA = 0.6V). Thanks very much in advance... Rudy
 
Status
Not open for further replies.
Back
Top