# signal conditioning 0 to (-40) volt to 0-5 volt, arduino

I want to convert my 0 to (-40 )v signal to be 0-5 volt so that i can measure it using arduino,

i want to attenuate the signal first by the factor of 8 and then shift it up by the arduino 5 volt. lets say for example if the signal is -20 volt

-20/8 = -2.5 ,,, -2.5+5 =2.5 v

is that possible ?

but then this is how i emplemented it and the voltage is always fixated at 5 V

bellow is my circuit, tell me where did I go wrong You can use an opamp to perform the translation if you like.

But there's an easier way : using 2 resistors you can both attenuate and level shift at the same time. I have chosen values that give a 10:1 attenuation and an 0.5V unused range at each end of the scale - scaling to the correct values is simple in software. simulate this circuit – Schematic created using CircuitLab

• Nice and simple, Brian. +1. – Transistor Feb 27 '16 at 10:48
• For the OP, I would add that resistive divider circuits work as long as you do not load them 'much'. That is, the input resistance of the subsequent circuit should be much higher than the output resistance of this circuit. In the case of an Arduino input pin, the 100 MOhm input resistance will play well, but other circuits might require a buffer amplifier. – Sredni Vashtar Feb 27 '16 at 13:24
• @SredniVashtar Worth pointing out: while the ATmega328 datasheet specifies the "Analog Input Resistance" as 100MΩ, this is likely just the ADC input impedance, rather than the input impedance of the entire IO pin mux and ADC mux structure. There is at least 14pF of S/H capacitance, and likely some leakage current from the pin muxes. Hence, Atmel specifies a source impedance of <10kΩ for reasonable ADC operation. – uint128_t Feb 27 '16 at 17:41

You have the two voltages fighting each other.

Look at the 5 V supply: it's connected directly to the output.

Meanwhile the voltage at R1 and R2 is trying to pull it away from 5 V but can't because the lower resistance of the directly connected 5 V circuit will always win.

V2 seems to be drawn as a positive supply. Your question says it's a negative signal. simulate this circuit – Schematic created using CircuitLab

Figure 1. Inverting amplifier.

The inverting amplifier op-amp circuit does exactly what you need. In this configuration the relationship between output and input is given by the formula

$$V_{OUT} = - \frac {R_F}{R_I}$$

Setting these as shown in Figure 1 gives a gain of -8 and your -40 V signal will be "amplified" to +5 V.

You need to select an op-amp capable of "rail to rail" operation. i.e., the output can swing to negative and positive rails.

• yeah I got why its 5V, but how to use this 5V only to shift the R1,R2 output ? V2 is drawn as positive but it has a value of -20 V @transistor – Sabir Moglad Feb 27 '16 at 9:55
• See the update. – Transistor Feb 27 '16 at 10:01