Capacitive fuel level sensor - Unstable output in arduino analog read

Thread Starter

saifudeen rizal

Joined Jun 5, 2018
50
Hai.,

I have used a combination of LM331 and 555 timer circuit to measure the Capacitive value that i get across the sensor ,The output i get from the sensor comes with a variation Difference of around 1.8V (Level 0 to 70)and the Output voltage i am getting is in multimeter is Constant with the variation on fuel level.,

My issue i am facing is.,

1)when i connect the output voltage to Arduino(Analog) to read it in serial monitor i am not getting the exact value as i am getting in Multimeter?
I get a constant value in multi meter where as i don't get that value in the Arduino.,IT shows the wrong voltage and it keeps on oscillating(It even Drops to 0 certain times)
 
Last edited:

Sensacell

Joined Jun 19, 2012
2,564
Did you check that the output voltage is DC, not jumping around?
The ADC input is faster than the meter response, the meter might be lying to you.

Divide and Conquer:

Disconnect your sensor, connect a battery to the MCU in place of the sensor, run the code.

This will tell you where the problem lies.
 
Last edited:

Thread Starter

saifudeen rizal

Joined Jun 5, 2018
50
Hai.,

I have used a combination of LM331 and 555 timer circuit to measure the Capacitive value that i get across the sensor ,The output i get from the sensor comes with a variation Difference of around 1.8V (Level 0 to 70)and the Output voltage i am getting is in multimeter is Constant with the variation on fuel level.,

My issue i am facing is.,

1)when i connect the output voltage to Arduino(Analog) to read it in serial monitor i am not getting the exact value as i am getting in Multimeter?
I get a constant value in multi meter where as i don't get that value in the Arduino.,IT shows the wrong voltage and it keeps on oscillating(It even Drops to 0 certain times)
Sounds like a coding error, or an intermittent connection.

I jst used the basic example program from the arduino examples .,so that cant be wrong...!
 

Thread Starter

saifudeen rizal

Joined Jun 5, 2018
50
Did you check that the output voltage is DC, not jumping around?
The ADC input is faster than the meter response, the meter might be lying to you.
yes.,i have checked the output voltage and that didnt jump around in meter..!

But At-least The ADC value should be in linear ri8?The value jumps around the difference of 400 bits in serial monitor ..!


and i dont understand how did u mean that the meter is lying?
 

Thread Starter

saifudeen rizal

Joined Jun 5, 2018
50
hey hai.,

well it just went to another colleges and i dont know wat was that issue i was facing on cav IC and ri8 now he s also in that state dont know wat was the problem in that.,

Ya thats purpose made but i That circuit didnt work properly and can u help me build a gud one with That IC.,

and ya we have changed to other circuit cause we just have to bilud one sensor within this month so jst changed to the other one rather than sitting in that same problem.,..!
 

Thread Starter

saifudeen rizal

Joined Jun 5, 2018
50
Did you check that the output voltage is DC, not jumping around?
The ADC input is faster than the meter response, the meter might be lying to you.

Divide and Conquer:

Disconnect your sensor, connect a battery to the MCU in place of the sensor, run the code.

This will tell you where the problem lies.
Ya u r ri8....!

now the value comes correctly.,but can u say what would be the problem in my O/P?
and what may be the reasons that could cause this kind of issues...?
 

ebeowulf17

Joined Aug 12, 2014
3,153
Ya u r ri8....!

now the value comes correctly.,but can u say what would be the problem in my O/P?
and what may be the reasons that could cause this kind of issues...?
Could you upload a schematic of your "LM331 and 555 timer circuit" so that we can see what you're working with?

Based on the evidence so far, it sounds like your circuit is putting out high frequency AC of some sort, maybe a pulse train which is essentially PWM? A multimeter in DC mode will read the AVERAGE value of AC voltages, it won't tell you about the rapid, instantaneous changer. So your meter will read the average output, while your Arduino reads a series of wildly varying instantaneous voltages.

If this is actually what's happening, you can filter, either with hardware or with code, to see average results on the Arduino much like you see on your multimeter.
 

Thread Starter

saifudeen rizal

Joined Jun 5, 2018
50
Could you upload a schematic of your "LM331 and 555 timer circuit" so that we can see what you're working with?

Based on the evidence so far, it sounds like your circuit is putting out high frequency AC of some sort, maybe a pulse train which is essentially PWM? A multimeter in DC mode will read the AVERAGE value of AC voltages, it won't tell you about the rapid, instantaneous changer. So your meter will read the average output, while your Arduino reads a series of wildly varying instantaneous voltages.

If this is actually what's happening, you can filter, either with hardware or with code, to see average results on the Arduino much like you see on your multimeter.
Thanks for the reply.,
and i have attached my circuit i am working .,Check that out., and You said "you can filter, either with hardware or with code, to see average results on the Arduino much like you see on your multimeter" can you help me out to filter the output either in harware side or through software?
 

ebeowulf17

Joined Aug 12, 2014
3,153
Thanks for the reply.,
and i have attached my circuit i am working .,Check that out., and You said "you can filter, either with hardware or with code, to see average results on the Arduino much like you see on your multimeter" can you help me out to filter the output either in harware side or through software?
Hardware would be an RC low pass filter, where you have a resistor in series between 331 output and Arduino input, plus a capacitor from Arduino pin to ground. Values would be chosen based on frequency of 555 pulse train vs. required response time.

Software would be a matter of taking many, many "raw" ADC readings and averaging them together to get an output reading. This can be done based on a sample count (number of readings) or a sample time (need to refresh output once/second, so simply average however many ADC readings you get per second.) Search for descriptions of over-sampling techniques and you'll find lots of info. Just like with the hardware filter, your choice of averaging methods and sample rate depends on incoming pulse frequency and required response time.

Having said all that, the above thoughts were very general solutions to one hypothetical problem scenario. I haven't worked through the details of your circuit yet, and I'm not very familiar with 331s, but from what I've found so far, I think maybe the 331 output could be ramping up and down like a sawtooth due to a potential mismatch in timing values.

The solution might be as simple as tweaking values of existing circuit components to either increase 555 frequencies or increase pulse length and slow down response time of the 331. No time now to do the calculations - still just brainstorming... don't hold me to this!

I'm traveling this morning, so may be unresponsive for a while.
 

drc_567

Joined Dec 29, 2008
773
Pin 6 on the lm331 is shown on the design webpage as a threshold value of some sort. ... Your problem might be something to do with that pin.
 
Top