I am trying to make a circuit using a 3V3 Arduino and other modules working on 3V3, but I have a problem with an analog water sensor I need to use. The output is a voltage range is from 0.5V to 4.5V.

I think I cannot use 4.5V signal on an analog pin of an Arduino working at 3V3.

So I have a basic idea like solution. - Use a 5V step-up voltage regulator from 3V7 li-on battery for the water sensor - Then using a voltage resistor divider to convert from 5V (sensor output) to 3V3. - Then connect to the Arduino and inside make line code with a simple equation where I can recover the 5Volt value.

For example enter image description here

Will I will lose resolution doing this? Is it a bad idea?


To ensure that I will not lose resolution, what do I need to check? Maybe the minimum step voltage in the ouput of sensor? For example 5mv minimum of variation, then 5mv*voltage_divider = 3.3mv ... Then 10 bit of resolution of ADC in Arduino is enough? I got a 3.22mv resolution (3.3/1023)

  • 1
    \$\begingroup\$ Your convert back equation will need to be of the form Y = mX + b to account for the 0.5 V offset at zero scale. \$\endgroup\$
    – Tyler
    May 8, 2019 at 16:58
  • \$\begingroup\$ You are right! I will only need to take care of resolution of ADC for output of voltage divide, if not i will not recover some variations ? \$\endgroup\$
    – asterix
    May 8, 2019 at 17:41
  • \$\begingroup\$ How much of the range of the pressure sensor are you using? \$\endgroup\$ May 8, 2019 at 18:12
  • \$\begingroup\$ It is a basic sensor I think for prototype circut... Pressure Measurement Range: 0~1.6 Mpa Output Voltage: 0.5~4.5 V \$\endgroup\$
    – asterix
    May 8, 2019 at 18:15
  • \$\begingroup\$ @asterix I see that in the data, but what range do you require? Are you really going to use the sensor right out to it's limit? This makes a big difference to the gain you need. \$\endgroup\$ May 8, 2019 at 18:38

3 Answers 3


That's the standard way to do it but you might consider lowering your resistors so that the net effective impedance seen by the Arduino's ADC input is only a few kohm. Maybe use 5k1 and 10 kohm. You'll find in the data sheet that the ATMEGA328 chip likes to have a source impedance not greater than 10 kohm.

You might also consider adding a capacitor across the (now) 10 kohm resistor to offer some anti alias filtering. If you can manage 100 nF that would be a good default choice but it depends on the bandwidth of the signals you wish to convert.

  • \$\begingroup\$ Using a simple divider does NOT get rid of the sensor offset, so reduces the signal resolution. \$\endgroup\$ Jul 18, 2019 at 17:29

With 4.7K and 10K the values (3v3 Arduino 1023 max) are:

+5V Source
|    4.7K    AX      10K

5V Source    AX        Analog AX
--------   ------    ------------
  4.8       3.31        1023
  4.5       3.12        964
  4.0       2.80        865
  3.5       2.45        757
  3.3       2.30        711
  3.0       2.13        658
  2.5       1.76        544


Scaling a 5V sensor with offset into a 3.3V full scale A/D

Since the sensor has a large offset (approximately 0.5V) and a span of 4V you have to scale the input and provide an adjustable offset control.

One possible solution is to use a single rail to rail op-amp powered by the 3.3V supply. This provides self limiting since the VCC rail and ground become the input limit.


simulate this circuit – Schematic created using CircuitLab

The TLV9001 or TLV6001 are good low cost opamp candidates. R1 and R2 give a scale factor of 0.825.
R4 and R5 provide offset control.
Full scale resolution is 4V/1024 = 3.9mV (input voltage resolution)

Update: added element to allow the simulator to run. The output looks just fine. The small amount of clipping on the output is due to the incorrect value of the offset Rin (R4 and R5) enter image description here

Note that this is of course an inverting configuration, so at zero (0.5v) sensor output the input to the A/D is 3.3V. I assume you can cope with this inversion.

Think of the circuit like this:


simulate this circuit

To understand the circuit read this. Particularly read section 3.3 and 3.4. If you don't understand opamps as attenuators (this one is stable at less than unity gain) you might read this excellent article.

  • \$\begingroup\$ I dont know how works your circut :| \$\endgroup\$
    – asterix
    May 9, 2019 at 13:53
  • \$\begingroup\$ It's a simple inverting op-amp. Perhaps you could start here: web.mit.edu/6.101/www/reference/op_amps_everyone.pdf Read the section 3.3 on inverting op-amps. \$\endgroup\$ May 9, 2019 at 14:20
  • \$\begingroup\$ Vout = R2(0.5-2.5)/R1 + R2(3.3-2.5)/(R5+R4) = 1,649484536 + 0,711111111 = 2,36 Volts. Where R5+R4 is 9K. I cant get a value 3.3 volt :( \$\endgroup\$
    – asterix
    May 9, 2019 at 15:04
  • \$\begingroup\$ Calculate your signal levels around the 2.5V reference NOT absolute Vin. \$\endgroup\$ May 9, 2019 at 15:15
  • \$\begingroup\$ WOW the output is perfectly... I will not sleep if I cannot do the same using equations. You are great!! Thanks very much \$\endgroup\$
    – asterix
    May 9, 2019 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.