I am hoping to use an arduino to read senders on a car i am building and then output pwm to a set of analogue guages (fuel guage oil pressure and water temp). The senders vary their resistance from 5-180 ohms.
The sender circuit i plan to use is this:
So basically the 8V regulated voltage from the battery (reverse polarity protected and spike protected ) is voltage divided through the sender giving 0.3v at sender = 5ohm and 4.7v at sender = 180 ohm this is then buffered into the adc and should utilise the full range of the adc
the guage output circuit i plan to use is this:
the PWM is driven through an optoisolator and a pnp darlington to give a low side drive to guage so it can be earthed at the guage.
can anyone see any obvious flaws in these circuits or better ways to do this
Hi, I'm no wizz at analog electronics, so feel free to shoot this idea down (but please explain why for my education!).
The Arduino's adc inputs are high impedance. Do you really need the op-amp to buffer?
Why not use the Arduino's 5V regulated supply for the sensor? Use 470R +270R as the pullup and you should get between 0.02V and 0.98V at the adc input. Switch the Arduino to its internal 1.024V voltage reference (assuming mega328) and you should get a good range of readings.
Thanks for your comments, I am by no means an analogue expert, I buffered the input just to give an extra level of protection from any nasty voltages getting past the regulator from the noisy car 12 volt rail although it is reverse protected and spike protected but just thinking cheaper to replace op amp that new arduino
I'm planing to use an uno or the standalone Atmega chip I like your idea of a ref voltage to scale up the adc Can I do this with the uno ?? I suppose I was keen to avoid a direct link between the 5v arduino pin and the guage in case of a short or exposure to 12v etc so just for protection really I was thinking about a linear optocoupler but there are a little pricey
I agree with @PaulRB that I don't think all of the electronics is needed
All you need to do is monitor both the battery supply voltage (of the car) and also the voltage on the gauge
If the gauge max resistance is 180 ohms, and you put a 390 ohm in series with it, with the other end of the 360 ohms to the car battery (12V)
The voltage divider would give you 180/(390+180) x BATTERY_VOLTAGE
= 180/570 x BATTERY_VOLTAGE
hence as the Arduino inputs can't exceed, 5V the max battery voltage would be 570/180 x 5V = 15.83V
You would need to measure the battery voltage using a resistor divider e.g. use 1.8k and 3.9k as it would give you the same range
Then to determine the % of fuel in the tank, all youd need to do is read the battery voltage Vb and the voltage across the sender Vs
and divide Vs by Vb in your code
i.e this solution only requires 3 resistors, and doesnt require a voltage regulator and an opamp
All that aside.
Cars are very electrically noisy environments, so I'd probably put zeners across the inputs with 1k series resistors on the analogue inputs, just to be sure you didn't kill it with spikes (I'd do this even if I was using an opamp)
Don't bother building your own board its more expensive than buying a "Pro Mini" (and a serial adaptor for programming)
Just go to eBay and look up Arduino Pro Mini, I use them a lot for embedded applications, eg my Garage door controller, my cordless drill battery charger etc etc
I like the idea of monitoring the battery voltage in order to avoid the voltage regulator, I do have some spike protection a TVS Smcj40ca and reverse voltage protection, on the 12v supply so maybe the opamp is unnecessary theoretically the voltage supply could reach 24 v if jump started from a rescue truck so my tvs is set to 30v but with 1k on the input presumably this would be enough to protect the adc ??
The promini looks v cool wil probably go with this as is really cheap, do you think I need to invest in a linear optocoupler then I could really relax about noisy electrics
The one I have doesnt have DTR, so I have to press the reset button on the pro mini when I want to upload, but its not a big hassle.
i.e press and hold the reset on the pro mini until the compile / upload progress bar on the arduino freezes at about 80%
I guess I should use one that has DTR as I think you connect DRT to Reset, but I'm not sure if you need any other components in that case.
using the one without DTR works OK for me
So on a car the chassis is negative and this means that with a lot of metal guages and the senders particularly the old ones there is only 1 connection the -ve is via the case to the chassis, most loads on a car are connected locally to the chassis for the earth so they all need to be driven on the low side unless you run 2 wires but this would be a bit odd to do on a car, that's why I like the optoisolator as this provided the npn ground switch (which you will need anyway with low side loads) for the pnp and isolates as well. There are logic driven automotive solid state relays but they are pricey, I suppose I should also put a fly back diode on the load as the guage may have some inductance ??
Sounds good although I thought u need to ground the base of a pnp to switch on ?? But u r right I don't need the Darlington with these currents i think I am close enough to start bread boarding now so will feedback when I've done some experiments
No that's cool thanks for your help I will use pnp and optoisolator on the output side and simple divider circuits on the input and monitor the battery voltage rather than a regulator breadboard it up and feedback so thanks
I asked a similar question about driving a fuel gauge on here yesterday. Scroll back a few pages and you should see it.
I'm not great with circuits, but I don't understand your circuit for driving the gauge. Most fuel gauges have the sensor pin wired to earth via the sender. Ie the sender provides a variable resistance (proportional to fuel level) to ground. That varies the current flowing through the gauge. Old-style gauges have either a bimetallic strip or arrangement of coils on move the needle proportional to that current. Newer gauges use a stepper motet internally, but afaik emulate the old behaviour of sensing resistance.
So, I don't see how your circuit could work. Surely you need the transistor between the gauge sensor pin and ground?
Sorry i missed your post I did have a quick look/search but missed it
I also am not sure how the guages work i am using retro smiths guage although new. My simple understanding of their workinig is that they are current driven using a 10 v regulator (the smiths ones anyway) :
and varying the sender resistance changes the current through the guage (as the voltage is constant) so i then tried driving the guage using a PWM at 12v via a uno motor sheild:
and as you can see it works fine it's not very linear so will need calibrating in the code but should be doable.
mfoobar:
Surely you need the transistor between the gauge sensor pin and ground?
-Matt
This would be true for NPN switching but if you use a PNP to switch you put the load on the low side and then to ground
was just checking your original thread, i like the idea of the current source for controlling the current pwm to the guage, i was planning on having a 1 amp fuse to cover all my guages as if this blew it would reveal the short but a neat idea using the current source. It would probably be a good idea to put a 10 ohm resistor in series with the guage to mimick the existing circuit anyway or it maybe overpowered at high PWM
That's a very sensible question, the main issue is that on the kit car I'm building I'm using retro smiths guages but a new ford zetec engine which has its own ford oil pressure sender and fuel tank and sender from a fiat and I'm not sure what car I'll use the water temp sender from , so this means I don't need to buy and try to adapt the specific smiths senders and voltage regulator I can use any senders and calibrate them in the arduino for my smiths guages. So in short gives me the flexibility to use any sensors/senders I want. I
Also it means I don't need separate warning switches for oil presure or water temp I can run them from the arduino and I could switch on auxiliary fans if the temp was high etc etc
I'm still pretty confused by your setup. Does the fuel gauge only have two pins? Normally they have 3 pins from what I can see and usually they have 12v, ground and a sensor. The sensor is wired via a variable resistance to ground.