# Convert -24V to 5V (Digital)

I am using a module which gives me an output of -24V. I need to convert this to +5V so it can be read by my NI Data Acquisition Device. What would be the easiest way, I was trying to use a P-channel MOSFET giving it the module output of -24V as Vgs and operating it with a +5V power supply. But it seems to get switched on at very small negative voltages, (my Vgs or Vin without receiving the module output is around -0.02V and this seems to be enough to switch on the P-mosfet). Are there better ways to do this..I would ideally not like to use an op-amp(inverting configuration) as I would need extra power supplies to operate one. (As of now I have two dc power supplies giving me -24V and +5V). Thanks!

Edit - I realised you might want from 0V to +5V for -24V to 0V, so here is another NPN based option that might do the trick, and also does not need the -24V rail. I left the FET based circuit there anyway in case it is of interest. As noted below you might have to fiddle with values a bit, this was just intended to put the idea across.
I wasn't entirely sure whether the signal is analog or digital, as you mention digital in the title, but also an acquisition device (so I thought it may be possibly heading for an ADC) so I assumed either was possible, hence the attempt at linearity.

NPN circuit NPN circuit simulation Alternative Option

An N-channel FET source follower might work okay with a voltage divider on the input. Say something like a 10:1 divider for a range of -2.4V-0V at the gate. The source of the FET to 0V through a resistor and drain to +5V.
This won't be the most linear but shouldn't be too bad if you fiddle around with values a bit to adjust the desired ratios. You could maybe add a constant current source (e.g another N-channel FET with source to -24V through e.g a 5K resistor, gate tied to source and drain to source of upper FET) on the source to make it more linear if necessary.

Here is a circuit and simulation of the (more linear) constant current idea (the green line is +Vout as Vin is swept from -24V to 0V):

FET circuit FET circuit simulation "Easiest" may be to use an opamp - 2 resistors and an 18 cents SOT23-5 IC may be hard to beat.

This assumes a 5V supply is available, which seems likely given the spec and requires a rail to rail output opamp - available from as little as US 18 cents in 1's.

5V rail-rail 5V supply opamps:

• For 29c/1 in stock at Digikey you can have the rather nice Microchip MCP6001 opamp - rail to rail 2.5 - 6V operation. Nicely suited to the task.

Effect of input offset voltage on accuracy: +/- 4.5 mV max input offset voltage giving an unadjusted error of +/- 0.02% max of Vin (about 12 bits accuracy). So eg about 2% worst case error at 1% of full scale input.

• Or for 18 cents/1 the similarly performing ST TLV321 also available in dual and quad versions.

The following assumes you want -24 - 0 to translate to 0 - +5V
(ie Vo = 0 when Vin = -24V, Vout = 5V when Vin = 0V.)

Providing (0 to -24V) to (0 to +5V) conversion (inverted polarity compared to above) is only slightly more complex. Advise if that's what you want - although inversion in software would allow this basic 2 x R + IC solution to still be used.

Assume for now that 24k (R1) and 5k (R2) resistors are available. As non-inverting input is at ground potential and as opamp drives inverting input in negative fedback mode it will act to always drive inverting input to ground.

So current into inverting input via 5k = Vo/5k
= Current out of inverting input via 24k = - Vin/24k (note negative sign)

So V0/5k = -Vin/24k so

Vo = -Vin x 5k/24k.

Actual resistors selected to give as close to desired ration as required.

Non-inverting input to ground will ideally have a resistor equal to parallel combination of two resistors to compensate for input leakage current. (In above example = 24k//5k = 4.14k)