Dealing with high voltage

7 posts
by funkyChicken » Tue Jul 03, 2012 4:07 am
My project for my pi is as an instrument panel for a car.

The voltages are far too high for the pi, and will largely deal with measuring resistance. I need a sanity check on "the plan".

use an op amp as a constant current source, a voltage divider to bring the input voltage down from 12-14VDC to less than 5. feed this to an ADC and then to an I2C or similar to get the data to the pi.

is this reasonable??

I need to measure voltage (Volt meter)
resistance, (fuel level, all temps)

the voltage measure will have to be precise as it would be the voltage standard to measure against for the resistance, and it can lie anywhere between 11V and 15V at any time.
Posts: 1
Joined: Tue Jul 03, 2012 3:59 am
by ksangeelee » Wed Jul 04, 2012 9:33 pm
There are others here that can give more authoritative advice, but having tinkered with such things (not in cars, I should say), here are some pointers you might consider.

I'd recommend you use an accurate voltage reference (e.g. MCP1525) with your ADC chip(s). Along with 1% or 0.1% tolerance and low temperature co-efficient resistors (25 to 50ppm), this will give you decent repeatability.

You can then measure your 11-15V (or any other range) simply using a voltage divider. If you're just reading voltages over the existing sensor circuitry, then you'll obviously need to know what the measured voltage means in terms of resistance. You won't need (or even be able to use) a constant current source, because it would interfere with the existing circuit.

If you're replacing any of the car's existing circuits with your own, then you can use a constant current source to determine the resistance, though you don't need to.

For resistive sensors with a low ohmic range, such as a PT100, with calibration it's possible to get accurate results without a constant current source. For example a 2V5 through a 2K4 resistor will limit the current through the sensor to around 1ma (and so limiting the heating effect that's to be avoided).

This forms a voltage divider that can be fed into an op-amp to amplify to your target range (e.g. 0-2V5), and calibrating two, three or four points with precision resistors (depending on the range you're interested in) will allow you to interpolate a voltage to a resistance.

For example, if you know from calibration that 80ohms yields 1V and 120ohms yields 3V, you can derive a resistance from any voltage between 0 and 3V3, with accuracy dependent on how closely your calibration slope fits the curve of the resistive sensor (e.g. how closely it fits the range of temperatures you're interested in).

I believe some fuel sensors are very non-linear, so you may even significantly improve on their accuracy with well chosen calibration points (a benefit of being able to do calibration slopes and lookup tables easily in software).

Either I2C or SPI would be fast enough for these kind of readings.
Posts: 192
Joined: Sun Dec 25, 2011 5:25 pm
Location: Edinburgh, UK
by annodomini2 » Thu Jul 05, 2012 3:37 pm
The main issues you will face are Electro-magnetic Compatibility (EMC) and Temperature.

Typical Automotive cabin temp requirements are -40degC -> +85degC, the Pi is not designed for this and getting a display panel that works at these temps will be very difficult.

Next is EMC or interference, lots of things in the car are producing signals, either through wires or radio (note I do not mean the stereo in the car!), the device needs to be able to continue working correctly irrelevant of these signals. Additionally, it shouldn't be generating signals that interfere with other parts of the car. I.e. you don't want it indicating to the Engine management system that you've got the throttle fully pressed when you haven't. (assumes electronic throttle)

Good luck BTW! :)
Posts: 33
Joined: Sun Feb 05, 2012 12:00 am
by rurwin » Thu Jul 05, 2012 4:55 pm
Also worth mentioning, while we're on the subject of the hostile environment -- if you have a dodgy battery connection, you can get spike voltages up to 300V.
User avatar
Forum Moderator
Forum Moderator
Posts: 4169
Joined: Mon Jan 09, 2012 3:16 pm
by momomonet » Mon Dec 17, 2012 10:31 am

I'm interested in having a PT100 connected to my raspberry to be able to log temperatures.
I don't have any idea on how to connect the PT100 and what electrical components i need to use for the circuit.

Can anyone advise me please?

Posts: 6
Joined: Mon Nov 26, 2012 3:54 pm
by rurwin » Mon Dec 17, 2012 11:39 am
Are you sure you need a PT100? it is fairly difficult to get that connected to a computer, and the sensors themselves are expensive.

You will need a precision current source, some way of adjusting for lead resistance, and a precision A-D converter. That needs a skilled electronics design guru.*

Then you will need to write the drivers to receive the digital value and convert it into a temperature using a calibration curve that you have produced.

It's certainly all possible. I was considering doing it myself until I found how cheap and easy to use DS18B20s are. In view of those, the only reason for using PT100s would be if the sensors already existed or were specified, or if you needed better than 0.5C repeatability.

* Or buy something that does the same job
User avatar
Forum Moderator
Forum Moderator
Posts: 4169
Joined: Mon Jan 09, 2012 3:16 pm
by momomonet » Mon Dec 17, 2012 2:07 pm
Thanks, i will have a look at the link you gave about DS18B20.
I just need to catch a temperature and log it through my raspberry with python code.
I don't really need a PT100.

Posts: 6
Joined: Mon Nov 26, 2012 3:54 pm