# Unexpected results using voltage divider

Hello forum,

I'm using a 5V pressure transducer on a 3.3V pro-mini. I wired it up using a voltage divider using a 510 and 260 ohm resistor as per the sketch.

The transducer uses 5mA and operates at 4.5 - 5.5V. The transducer is rated to 100psi which is 6.89Bar, with output being 0.5V at 0Bar and 4.5V at 100psi / 6.89 Bar.

I feed the transducer with 5V coming from its own 3A rated power supply with the returning signal going into my voltage divider.

I was expecting to get a reading of 0.33V at 0Bar, instead of the normal 0.5V at 0Bar, which would be around 102 when doing analog.read. Instead I'm getting 67, with the analog value rising when I increase pressure on the transducer. This is 0.22V on my DMM. I have four similar units going with the exact same hardware setup and code, and all giving the same values.

I played with the numbers to get 67 up to 102 where it's meant to be when reading analog, and the factor to get it up there is 1.52, which happens to be very close to 1.515, which is 5 divided by 3.3. Is this just coincidence?

Have I got it all wrong in thinking that when reading analog on a 3.3 board the 1023 steps are also zero to 3.3V as it is zero to 5v on an UNO?

Here's the sketch I use:

``````void setup()
{
Serial.begin(19200);
}

void loop()
{
unsigned long pressurecount = 0;
float transducer = 0.00;
float tdTotal = 0.00;
float tddisplay = 0.00;
float barDisplay;

for (int a = 0; a < 100; a++)
{
transducer = analogRead(0);
Serial.print("transd analog read: ");
Serial.println(transducer);
tdTotal = tdTotal + transducer;
pressurecount++;
}

tddisplay = tdTotal / pressurecount;
Serial.print("avg td: ");
Serial.println(tddisplay);

//   100PSI = 6.89BAR, 0.5V - 4.5V, 102 - 921 analog, total steps =  819

barDisplay = (((tddisplay * 1.515) - 102.30) * 6.89 / 818.40);     // GIVES CORRECT PRESSURE VALUE
barDisplay = ((tddisplay - 102.30) * 6.89 / 818.40);     // GIVES LOWER THAN EXPECTED VALUE

Serial.print(F("<<< Current Avg. Pressure = "));
Serial.print(barDisplay, 2);
Serial.println(F(" bar"));

delay(2000);
}
``````

The low impedance of the voltage divider may be overloading the output amplifier of the pressure sensor. Check the sensor data sheet for the sensor output impedance or maximum current draw.

You could try 5.1K and 2.6K for the resistors.

on a 3.3 board the 1023 steps are also zero to 3.3V

The ATmega chips have a 1024 step ADC.

For 0-5.000V input and VREF=5.000V, those steps correspond to the range of 0-4.995 V (approximately). 5.000V cannot be represented. Scale the above by 3.3/5.0 for VREF=3.300V.

Post the datasheet of the sensor, much more likely to be able to give accurate answer with actual information...

heinburgh:
The transducer is rated to 100psi which is 6.89Bar, with output being 0.5V at 0Bar and 4.5V at 100psi / 6.89 Bar.

That statement is most likely not correct.
Pressure sensors specified as "0.5-4.5volt output" are usually ratiometric,
and only output that voltage if their supply voltage is 5.000volt.
Statement should be: they output 10% to 90% of their supply voltage.

Because sensor output ALSO depends on 5volt sensor supply voltage and 3.3volt MCU voltage,
you most likely will have stability and zero pressure drift issues.
Ratiometric 5volt sensors should be used with a ratiometric 5volt MCU, not with a 3.3volt MCU.
Or you need to also measure/compensate for the two supply variables.
Leo..

Is the 5V supply ground ( - ) connected the Arduino's GND?

jremington:
5.000V cannot be represented.

5.000V is represented by 1023 as well as all other values over last step. At least in theory. In other words if ADC returns 1023 the input voltage may be 5.000V. Or 4.999V. Or 5.001V. Or one of the uncountable infinity of other values 1023 represents.

The datasheet for the transducer I use:

https://eu.mouser.com/datasheet/2/418/NG_DS_M3200_A4-1489351.pdf

Which one? (code 2-7 or J)
Only type 5,6,7,J should be used with a 3.3volt processor.
J (with buildin A/D) being the preferred one.
Leo..

Wawa:
Which one? (code 2-7 or J)
Only type 5,6,7,J should be used with a 3.3volt processor.
J (with buildin A/D) being the preferred one.
Leo..

I have a 3. But I think I need to see if I can get my hands on the I2C model.

Thanks for taking the time.

Hein