×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Sensor Interface Question(s)

Sensor Interface Question(s)

Sensor Interface Question(s)

(OP)
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

RE: Sensor Interface Question(s)

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?

RE: Sensor Interface Question(s)

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.  

RE: Sensor Interface Question(s)

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.

RE: Sensor Interface Question(s)

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
www.gke.org
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...

RE: Sensor Interface Question(s)

(OP)
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 www.avagotech.com hcnr200, described as an analogue optocoupler would this work for my sensor?
thanks


RE: Sensor Interface Question(s)

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.

RE: Sensor Interface Question(s)

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources