PLZ HELP. MAP VOLTAGE to 0V - 5 V

Status
Not open for further replies.

Oh okay thanks. For clarification, on the schematic, the LT431 has three pins that will be connected to ground, R2, and R3 correct?

Then, for V1, I can place 5V or whatever voltage in there.

Finally, I will look into seeing if the controller has an internal reference available. If so, where will this internal reference line be connected to in the schematic?

Also, will the ground of this circuit be connected to the ground of the sensor as well?

Also, which LT431? --> https://www.digikey.com/product-search/en?x=0&y=0&lang=en&site=us&KeyWords=TL431

I will try out the schematic you will give me. Any other suggestions that I should do to it or any changes? I will let you know asap if it works.
 

Depending on the internal reference voltage, it could be used in lieu of the TL431 to offset your sensor voltage.

Yes, the ground of the level-shifter must connect to the sensor ground and to the controller ground (Vss).

Any TL431 that Digikey sells will work for this application. Which one you buy should be based on package, price, and availability.
 
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.

Hi Mike, thanks alot so far for your help. I had another question. What is the V1 for? why do we need it and where will I get that power from?

Also, for that same circuit, do you know how many amps it would take? I think my controller can only hold up to 40mA.

Thanks.
 
This is slightly confusing. When you say it sometimes changes on you, are you saying that the max voltage changes? meaning, at times the sensor at its max is giving 5V, and at other times at its max it gives out 10V?
 
Hi Mike, thanks alot so far for your help. I had another question. What is the V1 for? why do we need it and where will I get that power from?...

I thought I answered this before, but here it is again:

The TL431 is a shunt regulator, like a Zener. It creates a regulated voltage by dynamically varying the current that flows thru it. The source of that current has to come from a supply, which must be higher than the voltage you are trying to regulate at. In this case, the TL431 is creating a well regulated voltage of 2.495V +- a couple of mV, so the starting voltage V1 must be higher than that. It could come from any available positive supply, such as the +12V that powers the sensor, or the +5V that powers the Arduino. If the supply voltage you want to use is either higher than +12V, or lower than +5V, it will be necessary to change the value of R3 (see here)

Even with V1=+12V, the current drawn from V1 will be < 5mA.
 
Stileto,

Do you know the source impedance of your sensor? It will need to be significantly lower than the input impedance of the scaling network (~30K) for the results to be accurate.

Also, you need to consider the the impedance of the ADC input as well.
 
I got the LT component and put the circuit together. However, I don't think I was too specific with what I needed the circuit to do, though. The circuit you gave me worked perfectly for those ranges (-2.5 to 10V); however, it didn't map any voltage (say 3V peak to peak) to 0V to 5V. It would give me a really small output (in mV).

The circuit was supposed to condition the laser sensor's output and map the sensor's input peak to peak voltage to 0V - 5V. I need it to be mapped to 5V maximum because the microcontroller that I am using only recognizes an input sine wave voltage from 2.5 to 5V at high.

In other words, whatever input voltage I receive, may it be -1.5V or 2V or 7V, needs to be jumped up to 5V and mapped from 0V to 5V. If my sensor's output has a sign wave that goes from -3V to 1.0V, I need to map that peak to peak to 0V to 5V. I'm not sure how to do this, though, and I really hope you can help me again.
 

Hi crutschow,

I am not trying to just map -2.5V to 10V into 0V - 5V. I don't think I was too specific with what I needed the circuit to do, though. The circuit you gave me worked perfectly for those ranges (-2.5 to 10V); however, it didn't map any voltage (say 3V peak to peak) to 0V to 5V peak to peak. It would give me a really small output voltage. What I need is for it to map any voltage I receive to a peak to peak of 0V to 5V.

The circuit was supposed to condition the laser sensor's output and map the sensor's input peak to peak voltage into 0V - 5V. I need it to be mapped to 5V maximum because the microcontroller that I am using only recognizes an input sine wave voltage from 2.5 to 5V at high. Below is a short diagram of what I am trying to accomplish.

[Laser Sensor] --> [Circuit_I_Need_To_Make(mapping voltage into 0V to 5V] --> [Arduino Uno microcontroller(recognizes 2.5V- 5V for sign wave signals)]

In other words, whatever voltage I receive from the laser sensor, may it be -1.5V or 2V or 7V, needs to be jumped up or down to 5V and mapped from 0V to 5V. If my sensor's output has a sign wave that goes from -3V to 1.0V, I need to map that peak to peak to 0V to 5V. I'm not sure how to do this, though, and I really hope you can help me.
 
Stileto, I reread the entire thread and I think I finally understand what you want. What caused the confusion is your use of the word "map". It has a meaning which does not apply to what you want...

You need a preamplifier (opamp) with two adjustable pots, one labeled GAIN and the other labeled OFFSET. The Gain pot needs to adjust the gain of the opamp stage from a minimum of about 0.3 to a max of about 3. The Offset pot should add or subtract an offset to the output of the opamp from ~-1V to +3V. This will let you adjust things so that you can fill the ADC's 0V to 5V dynamic range with your sensor signal.

Furthermore, the input impedance of the preamp stage should be high enough so as not to load the sensor, which apparently has a high output impedance.

The problem will be that you will have to make several iterative adjustments while monitoring the ADC input signal with an oscilloscope to make sure that the ADC signal is centered at 2.5V, and its peak-to-peak amplitude doesn't go below 0V, or above +5V.
 

Thank you Mike. What do you mean I will have to make adjustments while monitoring the adc input signal? Also if you could please provide with a simple circuit schematic like you provded me before with the type of pots and components. That really helped me see what I needed to fix after seeing the circuit. Also, in case my sensor had an output of say 7v or 10v this new circuit will be able to bring it down to 5V right?

Thank you so much.
 
Let me ask another question. Do you really care about the steady-state output of the sensor (DC level), or do you just care that when the sensor has a time-varying (AC) output that it be centered on 2.5V, and that the peak-to-peak amplitude is adjusted to swing from 0V to 5V?

That could be done by using a DC blocking capacitor, and only a single adjustable gain stage.
 

I think the latter is what I really need '...sensor has a time-varying (AC) output that it be centered on 2.5V, and that the peak-to-peak amplitude is adjusted to swing from 0V to 5V'.
The sensor's output is an AC signal and I'll be using the AC pin of my microcontroller to take in the conditioned signal. I hope that helps.
 
Questions:
1) Why is the sensor output so variable?
2) Is it the sensor signal's amplitude or frequency which is a function of what is being sensed?
3) Are you going to measure the signal frequency or amplitude (amplitude measurement would seem pointless if the sensor output level is unpredictable)?
4) Does it matter if there is harmonic distortion of the signal as a result of squeezing/expanding it into the 0-5V range?
5) How much delay can be tolerated in the signal processing to fit the 0-5V range?
6) Is the 0-5V really critical? Wouldn't, say, 1-4V do?
 
U1 is a rail-to-rail 5V OpAmp. X1 is a 100K pot. Sensor output can be anywhere from 1Vpp to 15Vpp. Output is always referenced to 2.5V.
 

Attachments

  • D3.jpg
    237.9 KB · Views: 128
U1 is a rail-to-rail 5V OpAmp. X1 is a 100K pot. Sensor output can be anywhere from 1Vpp to 15Vpp. Output is always referenced to 2.5V.

Thanks Mike ill check this circuit out when I build it. How will I know how to change the value of X1 when looking at the oscilloscope? And once I get that value will I have to keep changing it accordingly?

Also can you explain what is going on in each segment or part of the circuit as it takes in the sensor's signal?
 
Look at the sim again. The sensor voltage is 1Vpp. With the pot set to get the green trace V(adc), the waveform is clipped. If the pot were set to get the blue trace, the waveform is preserved.

All I have time for today.
 
...Also can you explain what is going on in each segment or part of the circuit as it takes in the sensor's signal?

R4, R5 and C3 create a clean 2.5V reference (derived off the Arduino 5V).

C1 blocks the senor's dc component.

R1 and R7 create a voltage divider which drops the peak input by 1/3.

Since the right end of R7 is tied to 2.5V, the opamp's output is centered on 2.5V.

X1 determines the gain of the OpAmp. The left end of the pot is grounded through the capacitor to minimize offset from the 2.5V reference voltage.

The lowest opamp gain that the pot will set is 1, so the overall gain ranges from 1/3 (that is why the R1/R7 divider), to a much higher value as the wiper is moved left.

The frequency response is flat from ~10Hz to an upper cutoff determined by the opamp.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…