NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » How to double a DC voltage?

July 21, 2013
by Ralphxyz
Ralphxyz's Avatar

I am using a Allegro ACS712 Hall Effect Current sensor.

The output for positive current is 2.5 to 5 volts.

I would like to increase sensitivity to 0 - 5 volts.

I am using the ADC so I am limited to 0 - 5 volts.

I have seen mention of using a Op-Amp to do this but can not find a circuit or schematic.

Ralph

July 21, 2013
by sask55
sask55's Avatar

Ralph

It may be possible to use a Op-Amp circuit to expand the analog voltage output of the chip over the 5 volt range from 0 to 5V. I believe it would be very difficult to insure accurate linearity of the output. More importantly any error that was in the original output would be amplified along with the signal. The absolute best that could possibly be achieved would be to maintain the same error percentage as was in the original signal. That could only be achieved by designing and building a very good analog amplifier that did not add any additional analog errors.

From the data sheet the current sensor chip has a possible total output error of + or – 1.5%. The ADC has a maximum resolution of 10 bits or 1024. Even ½ of the resolution of the ADC (from 2.5 to 5V} is far more precise then the output from the chip. Amplifying the output voltage before reading it with the ADC will not increase the sensitivity of the system it would just introduce one most possible place for error or interferences to occur.

To put it another way, I don’t know what current range you are trying to measure but the 1 in 612 resolution that you will get from the ADC is better than what you are going to get from the chip.

Darryl

July 21, 2013
by mongo
mongo's Avatar

A quick and dirty way is to use an oscillator with bipolar output like a 555 timer. A standard voltage doubler circuit will work. All you need to do is take the output and regulate it. I'll see about putting together a quick sketch if you need one.

July 21, 2013
by mongo
mongo's Avatar

Here is a decent one worth trying. Found it online.

LINK

July 22, 2013
by BobaMosfet
BobaMosfet's Avatar

Ralph,

You're misunderstanding how the sensor works. You're getting the full 0-5V. 0-2.5V = one polarity. 2.5-5V = the other polarity.

BM

July 22, 2013
by BobaMosfet
BobaMosfet's Avatar

Ralph--

If you're wanting just the upper portion of the signal amplified, just use a BJT, and adjust the Q-Point down closer to ground, cut off the bottom half of the signal.

BM

July 23, 2013
by sask55
sask55's Avatar

BM and Mongo your last few posts are very interesting to me I would like to learn more if possible. I have been trying to figure out how ether one of your approaches will work to get the results Ralph is looking for. I don’t know about Ralph but you certainly have me stumped, I have a lot of trouble with analog circuitry. Even after trying to understand the information in this thread, I would not be able to actually design a circuit that would output 0 volts with a 2.5 volt input, output 5 volts with a 5 Volt input and give linear and proportional voltage output between the two extreme input voltage values. I realize it is there somewhere I just don’t get how to actually set it up. I am interested in more detail or a link to a more detailed description if posible .

As potentially useful and interest these approaches are, I still don’t thing there is anything to be gained by doing any analog amplification in the situation Ralph has described.

Darryl

July 24, 2013
by Ralphxyz
Ralphxyz's Avatar

Thanks everyone for the feed back.

yeah Darryl described my problem, and his understanding of analog circuits is way beyond mine.

Sorry I said double the signal but actually need to do as Darryl described.

I will have a output between 2.5 - 5 volts.

I was looking at making it more sensitive as that is what I have seen mentioned in some of the discussion about the Allegro ACS712 Hall Effect Current Sensor.

I was hoping to "double" the sensitivity using the full range of the ADC (0 - 5 volts).

I currently have the 30 amp version I wonder if I should match my output closer.

I am measuring the current draw for a small stepper motor.

But this is such a simple device I can see lots of other applications.

Ralph

July 24, 2013
by Ralphxyz
Ralphxyz's Avatar

Thanks everyone for the feed back.

yeah Darryl described my problem, and his understanding of analog circuits is way beyond mine.

Sorry I said double the signal but actually need to do as Darryl described.

I will have a output between 2.5 - 5 volts.

I was looking at making it more sensitive as that is what I have seen mentioned in some of the discussion about the Allegro ACS712 Hall Effect Current Sensor.

I was hoping to "double" the sensitivity using the full range of the ADC (0 - 5 volts).

I currently have the 30 amp version I wonder if I should match my output closer.

I am measuring the current draw for a small stepper motor.

But this is such a simple device I can see lots of other applications.

Ralph

July 24, 2013
by Ralphxyz
Ralphxyz's Avatar

Thanks everyone for the feed back.

yeah Darryl described my problem, and his understanding of analog circuits is way beyond mine.

Sorry I said double the signal but actually need to do as Darryl described.

I will have a output between 2.5 - 5 volts.

I was looking at making it more sensitive as that is what I have seen mentioned in some of the discussion about the Allegro ACS712 Hall Effect Current Sensor.

I was hoping to "double" the sensitivity using the full range of the ADC (0 - 5 volts).

I currently have the 30 amp version I wonder if I should match my output closer.

I am measuring the current draw for a small stepper motor.

But this is such a simple device I can see lots of other applications.

Ralph

July 24, 2013
by Ralphxyz
Ralphxyz's Avatar

Currently I am seeing:

ADC: 523 of 1024

.060 volts on my multi meter.

I actually do not care about the actual amperage, I have a nice library to figure that but all I need is a relative value so 523 of 1024 gives me enough information.

I was hoping I'd see a increase when I put a load on the motor but so far with just pressing on the shaft I do not see any change.

Ralph

July 24, 2013
by sask55
sask55's Avatar

Ralph

I am curious about a couple of things you posted

What are you measuring the voltage across to read .06 volts?

What is your ADC reading if there is no current at all going through the chip?

There is no question you will get better sensitivity with ether of the other two chips. From the data sheet the 5 Amp version has a typical sensitivity of 185 mV/A where your 30 amp version the typical sensitivity is 66 mV/A. That would be more then three times as sensitive as your version. The data sheet lists a range of sensitivity values so we can see that the voltage output from these chips is not extremely accurate and varies considerably from chip to chip.

Theoretically the incremental change in the voltage level sensitivity of the ADC is 5V /1024 = 0.00488 volts. That indicates that as the voltage read by the ADC changes by about 4.88 mV the ADC should change the value by one number to reflect the change. The ADC incremental change is 4.88/66 =0.074 Amps/ADC step. In theory the ACD is capable of picking up any change of about 74 mA in current from the chip, nothing smaller than that will be register by the ACD. This may seam to be a limitation of the ACD to read very small changes in current as read by the chip, but from the data sheet the noise level peak-to-peak for your chip is listed at 7mV. The random meaningless noise within output of the chip is listed to be almost twice as much as the value of the ACD increment so the chip output is clearly the limiting factor in reading very small current changes not the ADC.

I don’t know if it is possible to follow any of that, but the bottom line is that it is not possible to achieve any meaningful increase in sensitivity from this setup by amplifying the chip output before reading it with the ADC.

I realize that you posted that you are not really interested in the current reading from the setup. It would be relatively straight forward to display it if you wished to make a couple of changes to you code. If you know the value that the ADC returns with 0 Current, it should be about 511. Subtract that number from the value that is returned from the ADC and multiply the result by 0.074.

Your ACD reading is 523, if I assume the ADC/ chip zero point reads out at 511 (you should determine the actual value of your zero point), Then 523-511 = 12. and 12 X 0.074 = 0.89 amps. It would be one line to do this in code and display the amperage on the LCD as it is read by the chip.

Darryl

July 26, 2013
by Ralphxyz
Ralphxyz's Avatar

re: Couple of questions

First thanks Darryl for your comments they are really helping me understand this current sensor. Which as I said is very easy to implement, and then just use the Nerdkits tempsensor code.

Now I haven't the slightest idea where I got that .06 volt reading from. I must have had the wrong range set on my multi meter but now I can not duplicate it.

Well I am using a different motor, the one I was using was not turning so something was not right in the first place.

Now I am seeing 2.50 - 2.51 volts at ADC: 519 of 1024 with 511 of 1024 with no load.

I will get the other versions of the ACS712 as I need more sensitivity.

Putting a load on the motor has to be increasing the amps but I can not load the motor enough to see any change and that is why I am doing this I have to be able to monitor a slight change in load.

Thanks for the Amps calculations, I do not know why the discussions I have seen made showing the amps such a big deal.

These current sensors work with AC or DC so I really see a lot of applications!

Ralph

July 26, 2013
by sask55
sask55's Avatar

Ralph

After looking over the data sheets again I am now seeing a issue with the move sensitive versions of the chip. As I said in my last post the 5Amp version of the chip is more sensitive but it also has a much larger Noise value listed in the data sheet (21mV). Take a look at the Functional Block Diagram in the data sheet, there are two Op-Amps shown after the signal recovery potion of the chip. It would appear to me that in the higher sensitivity versions there is more amplification of the signal going on in the two stage Op-Amp portion of the chip. Unfortunately it appears the noise within the signal is occurring before this amplification and therefore the noise is also amplified along with the useful portion of the signal. The result is that although the chip is more sensitive the meaningful resolution is not any better. In other words you may not be able to actually read any smaller changes in current because it may not be possible to separate the larger signal from, larger noise within that signal.

From the data sheet page #9 “Dividing the noise (mV) by the sensitivity (mV/A) provides the smallest current that the device is able to resolve.” Since both the sensitivity and the noise increase by about the same factor the resolution of the chip does not actually change from version to version.

Sorry about my somewhat misleading comments in the last post . I now see that sensitivity is not the only factor to consider hear.

You are attempting to measure subtle current changes. I don’t thing this is the chip to do it.

To show the measured curent on the lcd you could try something like this.

From tempsensor code Replace this line of code

   fprintf_P(&lcd_stream, PSTR("Temprature: %.2f"), temp_avg);

With something like this

  fprintf_P(&lcd_stream, PSTR("Current = %.2f A"),((last_Sample-511)* 0.074));

I have not attempted to compile this. There could possible be something wrong.

July 27, 2013
by sask55
sask55's Avatar

Ralph

The WCS2702 looks interesting. There is not much information on noise characteristics for this chip. The range is limited to under 2 Amps but the sensitivity is very high 1V/A or 1mV/mA. perhaps something like that would be more suited to the low current high sensitivity application you are looking for.

Darryl

July 27, 2013
by sask55
sask55's Avatar

Ralph

I don’t know how interested you are. I am away from home so I am looking at thinks on the net just for something to do. After all the times I looked at the data sheet for the ACS712 chip I now see an example circuit shown on page 12, application #3. That circuit is only tested on the 5 volt version of your chip but does increase the gain to 610 mV/A. If you have a LM 321 OP-Amp and the other components you could try that circuit. This is exactly what you are asking for. I think this circuit connected to your 30 amp version of the chip should increase the gain to about 244mV/A. noise may be a problem.

darryl

July 27, 2013
by Ralphxyz
Ralphxyz's Avatar

Darn, I do not have a LM321 Op-Amp but I do have:

LM324N
LM307P
LM741CN
LM358P
LM311P
LM224N
LM339N

I wonder if I can substitute one of these?

I'll take a look at the spec sheets as if that would do any good.

Ralph

July 27, 2013
by sask55
sask55's Avatar

Ralph

The LM324 is the quad version of the LM321. So if you have a Lm324 you actually have four Lm321s, all in one package. I am certainly no authority of building op-amp circuits so this is a bit of a guess. If you do get that circuit to work I think you can increase the amplification by changing the ratio of the voltage divider made up of resistors R1 and R2 in the diagram.

Darryl

January 12, 2014
by Jer
Jer's Avatar

Calculate the needed SLOPE of the circuit: m = (Vo(max) - Vo(min)) / (Vi(max) - Vi(min)) b = Vo(max) - (m * Vi(max) ) m = (5v-0v)/(5v-2.5v) = 2 b = 5v-(m*5) = (-5) So all you need is a Op-Amp circuit configured into a diff-amp with a diff gain of 2 that appies a -5v offset. A "Diff-Amp" uses at least 4 resistors (text-book description) two Gain and two input resitors. Ri = 10K <= inverting input resistor. Rf = 20K <= inverting gain resistor. Rn = 10K <= non-inverting input resistor. Rg = 20K <= non-inverting gain resistor. Vi = +2.5 <= inverting voltage input. Vinp = [ 2.5v to 5v] <= non-inverting input. place a +2.5v at the input of Ri. place the 2.5v to 5v input to Rn. this will give you the desired scalled output. Inverting Gain: Gi = ( -Rf/Ri) Gi = (-20K/10K) = -2 Non-Inverting Gain: Gn = (Rf/Ri)+1 * (Rg/(Rn+Rg) Gn = (20K/10K)+1 * (20K/(10K+20K) = +2 Vout: Vout = (Vinp * Gn) + (Vi * Gi) Vout = (2.5v * 2) + (2.5v * -2) = 0.0v Vout = (3.75v * 2) + (2.5v * -2) = 2.5v Vout = (5v * 2) + (2.5v * -2) = 5.0v

Vout from the DiffAmp is connected to the input of your ADC. This should work. And I hope this helps!

January 12, 2014
by JKITSON
JKITSON's Avatar

Jer It has been a long time since I have used these formula's. In the late 60's I worked for United Air Lines on the DC-8 flight simulators. They were analog computers so almost everything was done with op-amps. These were all tube type but the math was very simular.

Thanks for the refresher..

Jim

Post a Reply

Please log in to post a reply.

Did you know that you can connect a computer keyboard to your microcontroller? Learn more...