PLZ HELP. MAP VOLTAGE to 0V - 5 V

Status
Not open for further replies.

Stileto

New Member
Hi, I have a sensor that outputs a voltage range that sometimes changes on me.

Usually, it ranges from -2.5V up to 5V or sometimes 10V. I was hoping that I could get whatever voltage output I get and map the voltage to 0- 5V. This means that the voltage output I want will never go above 5V and below 0V.

I need it from 0-5V because my other device will only accept a 0-5V range.

I'm not too shabby with the math and design of the comparator, and I hope you can help me with that as well. Thank You.
 
How do you get a MAP sensor to put out -5V. The ones I have played with put out a positive voltage.
 
How do you get a MAP sensor to put out -5V. The ones I have played with put out a positive voltage.

Hi, I should have been more specific. I don't have a MAP sensor. I have a laser sensor that outputs a voltage reading that can range from -2.5V up to whatever voltage. It changes on me at times. I was hoping to be able to map that output voltage, whatever it may be, to 0V to positive 5V.
 
A simple opamp with a specific gain, with a summed-in DC offset should do it.

What is the frequency range of interest?
 
A simple opamp with a specific gain, with a summed-in DC offset should do it.

What is the frequency range of interest?

The frequency range would range between 300Hz to about 1000Hz.

Could you help me with the specifics of the opamp, gain, and the DC offset? Wouldn't a comparator or using that TL431 work as well?
 
Ok, so if the input is at -5V, you want the output to be 0V. If the input is at +10V, you want the output to be +5V?

What supply voltage(s) do you have available?

How stable are they?
 
Ok, so if the input is at -5V, you want the output to be 0V. If the input is at +10V, you want the output to be +5V?

What supply voltage(s) do you have available?

How stable are they?

[laser sensor] --> -2.5V to 5,7,10V (voltage fluctuates) --> [black box(mapping voltage)] --> 0V to 5V --> microcontroller

The laser sensor is powered by a 12V power adaptor, but the sensor itself can operate on 9V. The output of the laser sensor fluctuates between the voltages I mentioned above. The black box will be the circuit comparator/voltage limiter that I need to make to take in that input voltage and output a mapped voltage between 0V to5V for use in microcontroller.

To answer your first question: yes and no. It would be similar to that, but in case i have a +7V or +8V or +10V input, I would still want it to be mapped to 5V. and yes I want to change whatever negative voltage input I receive up to 0V.

I can have a 9V or 12V supply voltage available. Sensor and supply are stable.

Thank you
 
Attached is a single supply circuit with offset. The voltage reference can be a TL431 or op amp. All op amps will need to be single supply type if you only have a positive supply.

Question: How is the sensor generating negative output voltage if it's powered only by a positive supply?

 
Also, I am confused about mapping anything greater than +5 from the sensor to 5V at the input of the ADC. Are the sensor outputs >5V significant? If so, you likely want to map +10V to +5V at the ADC input (i.e. give up some of the ADC's resolution). If not, then you want to clamp anything above 5V to 5V?
 

The sensor has a negative and positive supply, sorry i forgot to mention that.

In your schematic, is the U1 just a regular op-amp? What specific one do you suggest I use?
Also, is it possible to not use a voltage reference in the circuit? Or is it necessary? If needed, how will I implement the LT431 to reach 1.667V to attach to that 10k Resistor.
Also, does this circuit have to share the ground with the sensor?

Thanks so much.
 

The voltage readings above 5V are significant. I would like to map the voltage above 5V down to 5V. For example, if I am getting a wave signal that goes from -2.5 to say 6.5V, I would like it to be mapped to 0V to 5V. If my sensor gives me a signal that ranges from 2V to 10V I would like it to be mapped to 0V to 5V. I hope that makes sense.
 
Yes, but you have to choose the gain setting apriori

Here is a simple circuit that doesn't need an opamp.

The independent variable is the sensor voltage (X-axis). The dependent variable is the ADC input (Y-axis)
 

Attachments

  • D23.jpg
    136.4 KB · Views: 207
Last edited:
Yes, but you have to choose the gain setting apriori

Okay. What do you suggest I do? Will the schematic that the other replier posted work? And when looking at that schematic, how will I be able to implement the LT431 as the reference voltage? Will it be possible to not use a power supply(ref voltage) for this circuit and just have an incoming signal?
 
Look at my previous post.

Actually, since the ADC input is ratiometric with respect to a reference inside the microcontroller, can you make that available on a pin? What voltage is it?
 
Look at my previous post.

Actually, since the ADC input is ratiometric with respect to a reference inside the microcontroller, can you make that available on a pin? What voltage is it?

The output will be placed in a pin on the controller. The controller takes in a voltage of 0V - 5V. The pin would most like be a 5V.
 
What is the V1, 12V, of the schematic referring to? Will I need a power supplying 12V on that end?

Also, if V1 is needed, can you change it to 9V instead?
 
What is the V1, 12V, of the schematic referring to? Will I need a power supplying 12V on that end?

Also, if V1 is needed, can you change it to 9V instead?

Any available power supply. Could even be the supply voltage running the microcontroller.

You didn't answer my question about the reference built-into the microcontroller.
 
Okay. Does this mean that I can have V1 as 5V?

I'm not sure what you meant by a reference into the controller, but I think this will answer your question: https://arduino.cc/en/Reference/AnalogReference

The controller is an Arduino-Uno.

Yes, 5V will work.

I am not familiar with Arduino-Uno. Most uPs I have worked with can optionally make the internal reference available on one of the pins of the microcontroller. If so, we could use that voltage as a reference source instead of having a secondary reference. Advantage of that is since the ADC inside the Atmega is ratiometric with respect to the internal reference, then there will be no relativer drift between the external and internal reference...
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…