Electronic – Convert -24V to 5V (Digital)

digital-logicnegativevoltage

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!

Best Answer

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

NPNcircuit

NPN circuit simulation

NPNsim

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

Circuit

FET circuit simulation

Simulation