Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sensor Interface Question(s)

Status
Not open for further replies.

dansoarr

Mechanical
Sep 15, 2004
18
Hi,
I need some help.

I'm interfacing an analogue sensors to a 5 volt dc micro.
The sensors have a mv output, 0 to 100mv & 0 to 2.5v

I need to scale the signals to 0 to 5v dc and i've been told that i need a high impedance input.

How do i do this? I have 5, 10 & 12 vdc availiable.

I also have to convert:
12v dc (on or off) to 5vdc (datalogger input is pulled high by 100K)
24v dc (on or off) to 5vdc (datalogger input is pulled high by 100K)

Any assistance you can give would be great. Assume I know nothing!

Dansoarr
 
Replies continue below

Recommended for you

You can take a high-impedance sensor with a 0 to 2.5 volt output, run the signal through an op-amp setup for a gain of 2, and then run that into your micro. Select a op-amp with Rail-to-rail inputs and outputs (this means it can sense and amplify signals that are almost equal to the power and ground powering the op-amp). Use a input resistor of 100K and a feedback of 200K to get a gain of 2. Vout = Vinput * Rfeedback/Rinput for a op-amp configuration where the non-inverting input is connected to ground and the resistors connect to the inverting input.

To get 0 to 100mV to 0 to 5 volts you need a gain of about 50 with the op-amp. Select the resistors for a gain of 50.

Now, what I posted above is the simple case. In actually, even rail-rail op-amps don't quite reach the rails, and this problem becomes more apparent the higher the gain. Also, "0" input sensors may not really be zero, and micros may not be able to digitize all the way to their 5 volt rail. Inputting a little offset adds another op-amp, and possible a reference into the circuit - that is if you need to zero-out any offsets or you need high accuracy.

Also, if your sensors are real high impedance, you may have to use a different op-amp gain approach, or buffer the signal before the op-amp.

For your 12 volt and 24 volt digital input signals, put a series resistor (20K ohms) to a 4.7 volt zener cathode with the anode connected to ground. Across the zener place another resistor (say 10K). Zener limits to about 4.7 volts max. The series resistor limits current to the zener. The resistor across the zener pulls the signal to ground (actually about 0.5 volt) if the input is open.

I've just put general info here. Don't have time for more detail post at this time. Questions?
 
For input logic levels above 5V, I would suggest that you use an opto isolator (4N35). A resistor on the input LED the current is limited by a resistor. The output transistor can be used as a pull up or pull down using the supply of the micro. The advantage of this is there is no way you can destroy the micro and it will prevent a a lot of noise entering in from remote sensors.
 
A couple additions to the previous posts. Using an op-amp is a good way to amplify your voltages. I just wanted to point out that you can get a dual op-amp IC very cheaply, and it doesn't take up much space on a PCB. That would be preferable to two discrete op amp chips. Secondly, to go from 12V and 24V to 5V you can simply use a 5V regulator. Those are also available as small ICs.
 
There is a problem using the inverting configuration: The signal will be inverted. So, a gain of 2 actually means a gain of -2. That is obviously impossible if you only have positive supply voltages - and even if you have a negative supply, the micro will not be able to process negative signals.

A better way is to use a non-inverting configuration. Formula for gain is almost the same, just add 1. Like this: Gain = 1 + Rfb/Rin.

That means 100 kohm for Rin and 100 kohms for Rfb at gain 2 and Rfb = 4900 kohms for gain 50. I would use lower valued resistors, though.

Gunnar Englund
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...
 
ok thanks for that, i need to digest some of it tho.

on the 12 & 24 volt to 5 volt. I'm assuming that for a vf of 1.25v and if=2 mA, id need a 11k resistor for 24v and 5.1k for 12 v.

my input signal would go to the resistor then to pin 1, through the led then out of pin 2 to ground.
Pin 4 would be connected to ground, pin 5 connected to vcc via the 100k pullup on the micro. do i leave pin 6 (the base) not connected ?

when serching for the 4n35, i came across this device at hcnr200, described as an analogue optocoupler would this work for my sensor?
thanks
 
What is the resolution that you need, and what is the resolution that your micro can provide? Perhaps that you don't even need to amplify the signal to still get the resolution that you need.

 
You sound like you've got it right for the optos to switch the digital signals. Double check the diode current of the opto though because 2mA sounds a little low to me. 4 to 6mA seems more realistic.

To answer your question on the HCNR200 - When using an opto in an analog application you typically use part of the opto in a feedback circuit to linearize the response. It's not as simple as just passing the signal through the opto.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor