Maker Pro
Maker Pro

Current measuring problems

mhalak

Dec 3, 2013
2
Joined
Dec 3, 2013
Messages
2
Hi everyone,

I'm trying to build my bench power supply with LM317 and Atmel ATMega8 microcontroller which would control output, measure and display output voltage and current.

Everything was fine until I got to part where I had to measure current. Idea was to place shunt resistor in front (input side) of LM317 instead of on load side so that LM317 compensate for voltage drop on shunt and output voltage on load should be stable and not dependable on current.

Voltage drop on shut is measured with LM358 (set to 10x gain) but unfortunately output from LM358 is not as expected. I get 24-25mV regardless of voltage drop.

I tried connecting shunt on low-side with load in series and got some reasonable results but it's not what I'm trying to do.

I attached JPEG of my circuit running in Proteus which indicates that this should work...

Any ideas???
 

Attachments

  • Circuit.jpg
    Circuit.jpg
    28 KB · Views: 167

duke37

Jan 9, 2011
5,364
Joined
Jan 9, 2011
Messages
5,364
Some comments.

The LM357 can measure down to ground but a look at the IC circuit would indicate that it cannot measure within a couple of volts or so of the supply.
Dividing the input signal by two could be used.

The LM317 needs input and output capacitors to stop oscillation.

The B2 battery can be replaced by two resistors.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
Dividing the input signal by two could be used
My first thought, too. The datasheet states an input common mode voltage of Vcm=V+ - 1.5V.
The resistors provided (100k 10Meg) result in an input voltage of 10.18V to the OpAmp, that's only 1V below V+.
 

mhalak

Dec 3, 2013
2
Joined
Dec 3, 2013
Messages
2
The B2 battery can be replaced by two resistors.
B2 battery represents ATmega8 PWM output going through low-pass filter and op amp with 2x gain. It was easier to set battery for this purpose of simulation just to get output voltage.

The LM317 needs input and output capacitors to stop oscillation
Of course. Capacitors are included in breadboard version. My mistake for not including those in simulation scheme.

My first thought, too. The datasheet states an input common mode voltage of Vcm=V+ - 1.5V.
The resistors provided (100k 10Meg) result in an input voltage of 10.18V to the OpAmp, that's only 1V below V+
So should I divide signal inputs with additional resistors or maybe better choose existing ones?
 

duke37

Jan 9, 2011
5,364
Joined
Jan 9, 2011
Messages
5,364
If you take two resistors of 100k in series from one sde the sense resistor to ground and another two at the other side of the sense resistor to ground, then connect the op-amp to the centre of the resistor chains. This in effect will replace R1 and R3
The op-amp input resistance will be 50 ohms so you will get a different amplification factor.

You may need to trim the input bridge since the resistors will not be exact.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
The op-amp input resistance will be 50 ohms so you will get a different amplification factor.
That should be 50kOhms, shouldn't it?

The circuit looks like this:
attachment.php


As it is, it generates 330mvV per 1A. You can tweak the resistors to change the gain of the amplifier or add a second anmplifier to match the output voltage to a suitable input voltage for teh mester.
 

Attachments

  • currrent_sense.gif
    currrent_sense.gif
    44.6 KB · Views: 228
Top