Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Voltage Clamp

Status
Not open for further replies.

RedCarzRFaster

New Member
Is a resistor a good way to lower voltage? It is to limit the voltage coming off a 0-5v car sensor and my current design is a stamp, digital potentiometer, and a to d converter to sense voltage, the stamp raises resistance as voltage raises past the "clamp" mark and then lowers resistance if voltage drops.


So if the clamped voltage was set to 4.3v...

Actual Voltage / To Computer
0v...............0v
.5v..............0.5v
1v...............1v
1.5v.............1.5v
2v...............2v
....................
4.1v.............4.1v
4.2v.............4.2v
4.3v.............4.3v
4.4v.............4.3v
4.5v.............4.3v
4.6v.............4.3v
....................
5.0v.............4.3v


The problem is my digital pot hasn't arrived yet but I am wondering if this is the correct way to go about it.
 
Last edited:
The short answer to your question is...No. If I were you I would use an op amp voltage follower and a resistive divider, or vice versa. In this fashion you won't need to worry about loading in one of the two places where it is important.
 
I think PapaBravo misread your post. RCR does not want to stepdown the voltage, s/he wants it to behave normally within a certain low-end range, and clamp it if it exceeds the maximum voltage his ADC can handle.

Use a zener diode and resistor. This will clamp the voltage once it passes a certain point. A resistor divider will do something will reduce your output by a given ratio ALL the time (like reduce your voltage by 1/3 regardless of input value).

http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/zenereg.html

The link shows a voltage regulator. It clamps the voltage to a lower level and requires a input voltage higher than the output (clamped regulated voltage) to work. In your case, it's the other way around- you input a voltage lower than the zener breakdown voltage and if that voltage ever exceeds the zener breakdown voltage, it clamps it. So choose a zener diode with a breakdown voltage that equals the clamping voltage you want. No need for active control or raising resistances and whatnot. Just an imprecise power limiting resistor to prevent the zener diode from frying when the load is removed (so a short circuit isn't formed be it forward or reverse shorted current flow).

(Make sure to take into account leakage currents in the zener and the drive capability of your sensor. Also, remember something about the series resistor...the more current in a resistor the more voltage drops across it and is lost by the time it gets to your ADC. A resistor with no current flowing in it has the same voltage on both sides, so keep this in mind.
 
Last edited:
I did not misread the original post. Zener diodes are very poor clamping devices because the knee of a particular device can very over a wide range. The solution I am proposing will scale any possible input within some range to a value which makes the A/D converter happy. I use this technique all the time in our industrial control products. I know it works -- trust me on this one.

For example if you have a 0-10V analog input and the A/D converter has a 3.0V reference, then a voltage follower with a Vcc of 15 Volts is used so the output will not be close to the positive rail. The follower feeds a divider with a ratio of 0.3. and the A/D converter is happy as a clam.
 
note also that zeners aren't terribly accurate. IIRC its around 10% which means it will clamp between 3.87 and 4.73

out of curriosity, why would you want to clamp at 4.3? can't you just do that in software - read the ADC and if the value is above the value for 4.3, simply set it to the value for 4.3.

I don't believe the ADC on the stamp is limited to 4.3...
 
Papabravo said:
I did not misread the original post. Zener diodes are very poor clamping devices because the knee of a particular device can very over a wide range. The solution I am proposing will scale any possible input within some range to a value which makes the A/D converter happy. I use this technique all the time in our industrial control products. I know it works -- trust me on this one.

For example if you have a 0-10V analog input and the A/D converter has a 3.0V reference, then a voltage follower with a Vcc of 15 Volts is used so the output will not be close to the positive rail. The follower feeds a divider with a ratio of 0.3. and the A/D converter is happy as a clam.

You lose resolution in the lower end of the scale by doing this though which he may need. Like for gyros, if the output is too high and you want maximum range of rate measurement, you use a divider with a buffer. But if you need low end accuracy (with the same gyro) you clamp it to preserve the lower end resolution. Resistive dividers also vary with temperature which is usually just in the mV, but in some cases this is not tolerable (like with gyros). If your working voltages are low enough compared to the ADC supply voltage you could stay away from the knee and use a zener to protect your ADC while maintaining maximum resolution. The software would have to interpret the readings beyond the knee to "clamp" then to an identical max value for processing rather than physcally doing it with the zener- the zener is just for protection.

philba said:
note also that zeners aren't terribly accurate. IIRC its around 10% which means it will clamp between 3.87 and 4.73

out of curriosity, why would you want to clamp at 4.3? can't you just do that in software - read the ADC and if the value is above the value for 4.3, simply set it to the value for 4.3.

I don't believe the ADC on the stamp is limited to 4.3...

4.3V To take care of zener tolerances ;)
 
Last edited:
In what sense do you "loose" resolution. Nothing about scaling a voltage has anything to do with the number of bits in your A/D converter. At the input a one LSB change is still a one LSB change.

Examine the situation. You have a 0-10V input and an 8 bit A/D converter. A one LSB change is 10V/256 = 39.0625 mV

Put in a follower and an attenuator with a coefficient of 0.3. Take a 39.0625 mV change on the input times 0.3 and get 11.71875 mV at the input to the A/D converter. Now take the 3V reference and divde by 256 to get 11.71875 mV.

It is true that the magnitude of a 1 LSB change at the A/D input is different but since the scaling transformation is linear it doesn't matter all other things being equal.

If your original thesis made any sense then we should amplify a signal to increase resolution before running it into an A/D converter. I think we know that this is unlikely to be beneficial.
 
Last edited:
You lose resolution because:

If the sensor outputs something like 1V/m, and has a range of 10V, and I am only interested in readings up to 5V, if I divide the voltage to accomodate the ADC then I get 0.5V/m and I get an upper half of the ADC range which I am not interested in.

Because it is 0.5V/m, I lose half of my "meters" resolution since my ADC "voltage" resolution is still fixed and each bit of voltage reading now represents twice as many meters as before. The error in my meters readings are now 2x as large as what they used to be and I wasted the upper half of my ADC range. You have to take account into how the voltage represents quantity of something else.

Amplifying the signal before it gets to the ADC only works if the full signal range was less than the ADC range to start with. Remember, the situation is the full range of the input signal exceeds the ADC range and that's why it needs to be reduced. If you reduced it to protect the ADC and then amplified it again to gain resolution, it would still exceed your ADC range.
 
Last edited:
Then you have the wrong sensor. Everything is a tradeoff. If you want to maximize the number of bits you have available then you must match the snesor to the A/D converter. To say that scaling increses or decreases resolution is just not correct.

Your argument has nothing to do with scaling and everthing to do with picking a sensor whose values matter over the full range of its output. If you say you are only interested in the lower half of the range and the sensor you want is not available then you have to work with what you have.
 
Papabravo said:
If you say you are only interested in the lower half of the range and the sensor you want is not available then you have to work with what you have.

And that may be the case. The most stable and accurate sensor available to me may be one whose maximum range (voltage and measurement) exceeds by ADC range and range of interest. That's the case right now for some gyros I plan to use. If I use a divider, I can't measure the angular rate in as fine increments as the sensor outputs. Scaling, might not affect the voltage resolution, but it affects the physical phenomena, and in the end, that's what I am trying to measure. It allows me to make my sensor compatible with my ADC while maintaining accuracy- at the cost of reduced measurement range.

Amplifying sensor outputs whose range are smaller than the ADC range increases accuracy (ideally).

Clamping the voltage on sensor outputs whose range exceeds the ADC allows compatibility, and reduces range but maintains accuracy.

I don't think resolution is the wrong word to use in this case, for voltage perhaps, but not for what you are actually measuring. It does allow you to measure finer in increments than if you just divided the voltage.
 
Last edited:
What sensor is this?
A device driven off the same Vdd as the PIC will never make an output greater than Vdd unless there's some unusual boost function. This is very unlikely to have.

A PIC pin can electrically take up to Vdd + 0.3v without damage. The full scale of the ADC is still Vdd or Vref+. Vref+ can potentially be Vdd+0.3v but it's unlikely you would have a need to do anything like this. It is likely that a device with its own regulator and "0 to 5v output" will be able to feed directly into the PIC.

Exceeding Vdd + 0.3v will not necessarily damage the PIC. This will forward bias a shunt diode between that pin and Vdd, so the current will flow into the Vdd rail. If that was a low impedance voltage, that's a real problem, but if the source has enough resistance to limit the current it won't cause a problem unless one of two conditions occurs:
If the current is higher than the max allowed through the shunt diode, it will damage the pin inside the PIC.
The current is flowing into the Vdd rail. Most regulators have little or no ability to shunt current out of Vout to ground, they only regulate current from Vin to Vout to produce a fixed voltage. If the current going into Vdd through that pin is greater than the PIC plus any other devices on the rail can consume, then it will raise the voltage of the Vdd rail and can cause latch-up (very bad).
 
It could be some self-powered sensor like a piezo-type sensor. Or it could be powered off of higher supply rails (which is what I assumed).

Now that Oznog reminded me of the voltage clamping diodes the PIC uses, you could just connect a diode between the ADC input and Vdd. It should allow for higher current clamping than just the internal PIC diodes. THe clamping voltage is Vdd+Vforward_diode, so you have to make sure the diode forward voltage remains within PIC limits. Much simpler than the zener idea and more reliable since no need for a series resistor between the sensor and ADC. One less thing to worry about.

THe limitation seems to be though that the clamping voltage must exceed Vdd by some amount, where it seems that zeners allow a clamping voltage below Vdd.
 
Last edited:
dknguyen said:
Now that Oznog reminded me of the voltage clamping diodes the PIC uses, you could just connect a diode between the ADC input and Vdd. It should allow for higher current clamping than just the internal PIC diodes. THe clamping voltage is Vdd+Vforward_diode, so you have to make sure the diode forward voltage remains within PIC limits.
It would need to be a Schottky diode, or the PIC pin would always conduct all the current. Even with a Schottky, it's somewhat uncertain what current will go through the external diode and which goes through the PIC's shunt diode.

Schottky diodes can come with substantial reverse leakage which might be enough to affect the accuracy of an ADC from a higher impedance signal source.
 
RedCarzRFaster said:
Is a resistor a good way to lower voltage? It is to limit the voltage coming off a 0-5v car sensor and my current design is a stamp, digital potentiometer, and a to d converter to sense voltage, the stamp raises resistance as voltage raises past the "clamp" mark and then lowers resistance if voltage drops.

etc.....

The problem is my digital pot hasn't arrived yet but I am wondering if this is the correct way to go about it.

An interesting idea, and the beauty of it, that all the above solutions are unable to address is that you could change your clamping voltage (through software) as you wish, to take into account differnt sensors that may be connected to the circuit, nice!

The only thing I am slighty confused about is that you may have your "lower" and "raise" of resistance back to front, if for example you have a resistor in line from your sensor, then you will need to lower the resistance to clamp the voltage at higher levels.

There may be issues with reacting quickly enough to the incoming voltage rise, but this will depend on the sensor you are using.

So all in all, maybe it's not the perfect answer to you specific problem, but it's an interesting solution that may work in a slightly different enviroment/problem.

It's one I will "store away" for future use! Thank you.
 
Last edited:
The sensor besically senses how much pressure there is. Depending on if the car has a stock 2bar or upgraded 3 bar sensor I need to change resistance. If you want to turn up the boost on the turbo you would want to clamp it higher and turn it back down accordingly, or as weather changes and this is why I need an active design to monitor voltage and change it accordingly so I was thinking a digital pot. I have seen the op amp design as someone suggested but I will have to do a lot of reading on the workings of it because for some reason I can't understand how it works or you use it.

Edit: The sensor has a 5v, GND, and signal wire to the computer coming off it.
 
Last edited:
Ok, so are you using the PIC to interface between the sensor and the ECU on the car? Is your circuit designed to protect the ECU or alter information going to it..... or none of the above! ;)

Have you got a part number/datasheet for this sensor?
 
I only have a basic stamp now and that is all I know. I would probably write it in that and transcode it to c for a suitable pic after I learn c for microcontrollers. I know c++ for computers and I am almost SCJP certified in Java. BASIC is like a joke so I don't think I will have a problem learning C but it does look hard, I think this is only because I do not know the mocrocontrolelr terms so it looks unrecognizable to me.
 
this seems like an awful lot of hassle for something pretty simple. the sensor will never output above 5V. thus, no damage will occur. use a voltage reference to reduce the range if you want so you can measure more accurately. You could use different references for the different ranges you want to measure.

I would also pay very close attention to noise which is pretty common in an automotive environment. this will reduce your accuracy. at some point the noise will make more accurate readings impossible.
 
philba said:
this seems like an awful lot of hassle for something pretty simple. the sensor will never output above 5V. thus, no damage will occur. use a voltage reference to reduce the range if you want so you can measure more accurately. You could use different references for the different ranges you want to measure.

I would also pay very close attention to noise which is pretty common in an automotive environment. this will reduce your accuracy. at some point the noise will make more accurate readings impossible.

What do you recommend for noise reduction?
 
RedCarzRFaster said:
What do you recommend for noise reduction?
A thorough understanding of electro magnetic coupling mechanisms, along with the requisite diganostic skills and sophisticated instrumentation.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top