Author Topic: I'm trying to emulate a fluid level sensor  (Read 1941 times)

0 Members and 1 Guest are viewing this topic.

Offline skyjumperTopic starter

  • Regular Contributor
  • *
  • Posts: 87
I'm trying to emulate a fluid level sensor
« on: October 06, 2019, 01:05:35 am »
Hi All...

Many marine tank level sensors have an output range of 240 to 33 ohms. Resolution depends on the type of sensor. I'm trying to figure out how to generate this signal from a microcontroller. I considered using a transistor switching array, or several of them, with a whole bunch of resistors but that seems inefficient, yet it would work. I looked at some digital potentiometer ICs but I didn't see one less than 1,000 ohms. Is there a batter approach?  Thanks...
 
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7681
  • Country: ca
Re: I'm trying to emulate a fluid level sensor
« Reply #1 on: October 06, 2019, 01:41:37 am »
It's a hassle because the currents are relatively large and it could go as high as the vehicle's voltage (12-24V).
I've used an 8-bit discrete DAC and switched in resistors using small mosfets for each channel.  250, 125, 62.5 ohms and so on down.
You could consider TPIC6AC596 only has 1 ohm RDS on.

Your sensor range is the same as automotive fuel tank sensors, such as Chevrolet.
Please ensure your (gauge) design can never output hazardous current or voltage to the fuel tank sensor to prevent explosion or fire.
edit: updated TI spec
« Last Edit: October 06, 2019, 03:19:58 am by floobydust »
 

Offline skyjumperTopic starter

  • Regular Contributor
  • *
  • Posts: 87
Re: I'm trying to emulate a fluid level sensor
« Reply #2 on: October 06, 2019, 01:54:58 am »
Thanks, I'll think about that. This is really just a simulator, it will never be exposed to actual fluid. Thanks for the warning, I'm just trying to simulate a water level sensor. I didn't realize the same type of sensor is used in an auto fuel tank.
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7681
  • Country: ca
Re: I'm trying to emulate a fluid level sensor
« Reply #3 on: October 06, 2019, 02:27:21 am »
I had to emulate a level sensor for vehicles using alternative fuels (CNG or propane) where they wanted to keep using the stock gauge in the instrument cluster.
So the MCU has the resistor DAC. 240-33 ohms is pretty standard for the float sensor. 240 can be full or empty depending on the manufacturer.  The analog gauges are fairly high current devices so a resistor DAC needs 1/2W resistors. You can use lower number of bits, even 32 levels can be good enough.

PWM I also used but it was a hassle because the gauge can make noise if the frequency is in the audible range. If it's not an analog gauge receiving the signal, say a digital gauge then PWM did not work.
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3283
  • Country: us
Re: I'm trying to emulate a fluid level sensor
« Reply #4 on: October 06, 2019, 02:52:16 am »
Update - changed 630R to 240R.

1. How much resolution do you need? A 1K digital pot with 100 taps will still give you around 21 steps from 33R to 240R. Put a 33R resistor in series to get an additional 3 usable steps.

2. You can always put a 33R resistor in series and a 240R resistor in parallel the digital pot. The result will not be linear, but you can account for the non-linearity in software.

3. FETs and JFETs can be used as a voltage controlled resistor - VCR, so that would reduce the problem to generating a voltage from a microcontroller.

There's a lot of writeups on VCRs on the web, for instance, this one:

https://www.vishay.com/docs/70598/70598.pdf

The main problem to solve is finding a device which has the resistance range you are interested in. Some suggestions are given at the end of the above app note.
« Last Edit: October 06, 2019, 02:53:54 am by ledtester »
 
The following users thanked this post: skyjumper

Offline skyjumperTopic starter

  • Regular Contributor
  • *
  • Posts: 87
Re: I'm trying to emulate a fluid level sensor
« Reply #5 on: October 06, 2019, 02:53:53 am »
It seems that, at 12V, the highest current is 364ma. Maybe I could use a ULN2003 (or a few of them) to switch resistors in and out? The collector current is rates at 500ma and there are 7 on the chip...

http://www.ti.com/lit/ds/symlink/uln2003a.pdf

 
 

Offline skyjumperTopic starter

  • Regular Contributor
  • *
  • Posts: 87
Re: I'm trying to emulate a fluid level sensor
« Reply #6 on: October 06, 2019, 02:56:31 am »
Update - changed 630R to 240R.

1. How much resolution do you need? A 1K digital pot with 100 taps will still give you around 21 steps from 33R to 240R. Put a 33R resistor in series to get an additional 3 usable steps.

2. You can always put a 33R resistor in series and a 240R resistor in parallel the digital pot. The result will not be linear, but you can account for the non-linearity in software.

3. FETs and JFETs can be used as a voltage controlled resistor - VCR, so that would reduce the problem to generating a voltage from a microcontroller.

There's a lot of writeups on VCRs on the web, for instance, this one:

https://www.vishay.com/docs/70598/70598.pdf

The main problem to solve is finding a device which has the resistance range you are interested in. Some suggestions are given at the end of the above app note.

I'll review that thanks! And I'm processing all this.

I believe 20 steps would be fine.
« Last Edit: October 06, 2019, 02:59:44 am by skyjumper »
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7681
  • Country: ca
Re: I'm trying to emulate a fluid level sensor
« Reply #7 on: October 06, 2019, 03:27:36 am »
You could use ULN2003 but it has a 1V saturation. Drive it with a 'HC595 shift-register to save MCU pins.
I figured a digital potentiometer would see 12V and high current and did not find one suitable.

You could make a programmable constant-current source, an op-amp and transistor driven by MCU PWM or digital potentiometer. Measuring the output voltage, calculate the current setpoint to make a constant resistance.
 

Offline skyjumperTopic starter

  • Regular Contributor
  • *
  • Posts: 87
Re: I'm trying to emulate a fluid level sensor
« Reply #8 on: October 07, 2019, 05:30:45 am »
I'm researching (and trying to understand) all the suggestions, thanks everyone! I like the JFET idea, but I was thinking about a DAC made from discrete components and @floobydust said:

...  The analog gauges are fairly high current devices so a resistor DAC needs 1/2W resistors. ...

This comment makes me thing I'm misunderstanding how you would build a discrete DAC.

If I use a shift register to control TPIC6A596 a bunch of resistors in series, starting with a 33 ohm and then a series of 10 ohm, and use the shift registers to select a point in the chain where I have the correct resistance, if the tank is empty (or full) i'll need just the 33 ohm resistor.

So at 12V wouldn't this dissipate 4.36 watts, requiring a 5 watt resistor?

UPDATE: I suppose I could use three 11 ohm resistors in series, but the power requirement for each would still be about 1.5 watts.

Quote
PWM I also used but it was a hassle because the gauge can make noise if the frequency is in the audible range. If it's not an analog gauge receiving the signal, say a digital gauge then PWM did not work.

Yeah it needs to work with digital and analog gauges. Given that, does it matter if I vary the current or the resistance or is it all the same?
« Last Edit: October 07, 2019, 05:36:07 am by skyjumper »
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4705
  • Country: au
  • Question Everything... Except This Statement
Re: I'm trying to emulate a fluid level sensor
« Reply #9 on: October 07, 2019, 05:41:44 am »
Your after a circuit like this, I use them for testing instrument clusters, for the values on the schematic its control range is 6.7-1340 ohms, but this can be tweaked a little by adjusting the current measuring resistor, the 9V is only for programming addresses.

You set the dac to use external Vref, you then end up with a constant resistance, and a maximum current limit, which helps things survive when you mess up.

Essentially its a constant current source, but its scaled by the external voltage. this can work very close to 0V, but its rare that it is needed,

In reality you could use a constant current LED driver and PWM its dimming input, most gauges are 0.5-10mA, with the resistance range only depending on the coil used inside the gauge,
 
The following users thanked this post: skyjumper, techman-001

Offline skyjumperTopic starter

  • Regular Contributor
  • *
  • Posts: 87
Re: I'm trying to emulate a fluid level sensor
« Reply #10 on: October 07, 2019, 07:39:14 am »
Your after a circuit like this, I use them for testing instrument clusters, ...

Thank you! I'll study this.

Quote
In reality you could use a constant current LED driver and PWM its dimming input, most gauges are 0.5-10mA, with the resistance range only depending on the coil used inside the gauge,

The gauges that low current? I didn't realize this, I thought they just measured the current directly.

So then, a constant current LED driver? Great idea! This or something similar?

Diodes Incorporated AL5816Q

This is a 0 to 10ma out current controller that has PWM dimming capability...

https://www.mouser.com/datasheet/2/115/AL5816Q-1522395.pdf

 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4705
  • Country: au
  • Question Everything... Except This Statement
Re: I'm trying to emulate a fluid level sensor
« Reply #11 on: October 07, 2019, 08:46:55 am »
Probably best if you measure it first for the dimmer Idea, but for the modern cross coil gauges it tends to be full scale around 10mA, empty at 0.5, direction is influenced by how they wire the 2 coils internally, 1 coil is the bias (from supply to ground through a resistor), the other is the signal, with a lower current to rotate the pointer by 90 degrees,

but depending on the age could be an older thermal bimetallic gauge which where sometimes up to 50mA, with a few rare audi gauges burning up to 100mA through the signal pin (because I assume they enjoyed the smell of melted plastic)
« Last Edit: October 08, 2019, 08:46:28 pm by Rerouter »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20363
  • Country: gb
  • 0999
Re: I'm trying to emulate a fluid level sensor
« Reply #12 on: October 07, 2019, 10:29:50 am »
The value of a digital potentiometer can be divided using an op-amp circuit.

What's your budget? A ready made solution exists, but it's not cheap, see link below.
https://www.kele.com/Catalog/24%20Transducers/PDFs/RES-1E%20Series%20Catalog%20Page.pdf

Check out the following thread:
https://www.eevblog.com/forum/projects/ptc-resistance-output-from-0-10v-analog-input/
 

Offline skyjumperTopic starter

  • Regular Contributor
  • *
  • Posts: 87
Re: I'm trying to emulate a fluid level sensor
« Reply #13 on: October 08, 2019, 04:09:42 am »
The value of a digital potentiometer can be divided using an op-amp circuit.

Quote
What's your budget? A ready made solution exists, but it's not cheap, see link below.
https://www.kele.com/Catalog/24%20Transducers/PDFs/RES-1E%20Series%20Catalog%20Page.pdf

That looks cool! I need several for my boat and a friend wants a few for his.

Quote
Check out the following thread:
https://www.eevblog.com/forum/projects/ptc-resistance-output-from-0-10v-analog-input/

Thanks!
« Last Edit: October 08, 2019, 04:11:30 am by skyjumper »
 

Offline KMoffett

  • Regular Contributor
  • *
  • Posts: 96
  • Country: us
Re: I'm trying to emulate a fluid level sensor
« Reply #14 on: October 08, 2019, 02:56:45 pm »
Since it's the current that actually determines the needle movement, could a simple voltage controlled current circuit work as an MCU controlled variable resistance?
https://daycounter.com/Circuits/Current-Servo/Current-Servo.phtml
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7681
  • Country: ca
Re: I'm trying to emulate a fluid level sensor
« Reply #15 on: October 08, 2019, 06:12:52 pm »
Depending on the era, older gauges were balanced coils and needed lots of current at up to 12V.
As the car's system voltage moves around, current in both coils moves around yet the gauge reads the same. The (level sensor simulator) circuit needs to be constant resistance. How would you set a constant-current circuit to 100 ohms? You need to include the voltage too.
I had trouble finding the gauge's current requirements and designed for pretty much anything using the discrete DAC. OP should confirm what type he dealing with, it could save money and complexity.

Chevy Suburban dash uses a 250 ohm pullup to 5V, so 10-16mA typ. on 240R full, 33R empty sensor.  That would be easy to interface to. VDO sensors are the opposite 240R empty, 33R full.
 

Offline KMoffett

  • Regular Contributor
  • *
  • Posts: 96
  • Country: us
Re: I'm trying to emulate a fluid level sensor
« Reply #16 on: October 08, 2019, 06:36:06 pm »
In my attached link the opamp drives the MOSFET so its resistance allows a current through R3 that causes a voltage drop that proportional the input voltage. At 12v the resistance of the MOSFET(variable) +R3(fixed) is a simulation of the fuel gauge resistance controlled by a scaled DC input to the opamp.
« Last Edit: October 08, 2019, 06:54:47 pm by KMoffett »
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7681
  • Country: ca
Re: I'm trying to emulate a fluid level sensor
« Reply #17 on: October 08, 2019, 08:56:31 pm »
That circuit is a constant-current source, but we need constant resistance.
Depending on the actual gauge, it could be 5,9,12,14V. So commanding a 40mA current could result in 125,225,300,350 ohms respectively.

Rerouter's circuit is clever in taking voltage feedback to the DAC VREF pin, to give constant resistance.
The Microchip DAC is very low cost, it would be a good solution.
 

Offline KMoffett

  • Regular Contributor
  • *
  • Posts: 96
  • Country: us
Re: I'm trying to emulate a fluid level sensor
« Reply #18 on: October 08, 2019, 11:47:25 pm »
For a fixed input voltage to the opamp, the constant current through the MOSFET+R3 is the equivalent to a constant resistance. For the current set by the input, the voltage drop across the MOSFET+R3 is essentially the same as the drop across the fuel gauge resistance in series with the gauge coils. Changing the input voltage changes the resistance of the MOSFET+R3.  Am I wrong?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf