PIC interface to bench PSU

Status
Not open for further replies.

Madhouse

New Member
I've got a stock LM317 based bench PSU (1.5-18V, 1A max) which I could do with modifying to be controlled and monitored by a PIC micro.

Where I'm stumbling at is the best way to adjust the "control" pin of the 317 from the PIC. I've considered using a digital pot to replace the existing one, but the voltage/current range is probably too much for the dS-pots I have, or using a simple R-2R DAC from the PIC just driving a transistor connected between the control pin and ground (might be tricky to set up and a little restrictive in control range - I'm aiming for around 20mv steps if possible).

Also, any suggestions on the most effective (and accurate) way of converting the voltage drop across the 1 ohm resistor on the +positive+ output of the regulator into a 0-5V anaogue signal to be fed back to the PIC chip would be welcome!

For reference, there is a constant 24V supply available that is independent of the regulator's own input supply, which I will use for running these bits of the circuit (with appropriate regulation of course) - so the PIC can even crowbar protect the supply if needed.

I think the target is becoming obvious here - use a PIC to control and monitor a PSU - presets for different tasks like battery charging etc, and feedback via USB to a PC running a VB data logging application.

PS - For once, I don't need help on programming the PIC or which one to use etc etc!!! And having now found this forum, I'm not here just to ask questions either!

Cheers all!
 
Also, any suggestions on the most effective (and accurate) way of converting the voltage drop across the 1 ohm resistor on the +positive+ output of the regulator into a 0-5V anaogue signal to be fed back to the PIC chip would be welcome!
You can use a current shunt monitor IC such as TIs INA138 or make a differential amp using an OP-AMP.
Where I'm stumbling at is the best way to adjust the "control" pin of the 317 from the PIC.
I would create a closed loop circuit with an OP-AMP and 317 with the correct gain to convert 0-5V from the PIC to your required output range. To generate the 0-5V, use PWM from the PIC followed by a low pass filter. Use the lowest cutoff frequency for the LPF as possible. The PIC-->Vout response time you require will determine the cutoff frequency you need.
 
One way to build the circuit is to put the variable resistor chip on the positive rail, and to have the "ground" of the digital pot connected to the ADJ line of th 317. Use some transistors to shift the level of the logic signals.

If you want to use a dedicated current sense chip, Linear also makes some chips which are built to do this sort of thing:
https://www.linear.com/currentsense/02-high_side.pdf
https://www.linear.com/currentsense/index.jsp

The general idea is to have a component which converts the voltage across the resistor into a current - which makes it a lot easier to shift it down into the PIC's A/D limits.
 
If you want to use a dedicated current sense chip, Linear also makes some chips which are built to do this sort of thing:

Cheers for that hjames, had a look at those, and them some devices that Maxim do and gone for one of those. Got an account with Maxim for the last few years, but the Linear site has far better design suport!

One way to build the circuit is to put the variable resistor chip on the positive rail, and to have the "ground" of the digital pot connected to the ADJ line of th 317. Use some transistors to shift the level of the logic signals.

I'm a little puzzled with this - could you explain how? The first problem I had with digital pots is the voltage range, and even in this config I can see that being exceeded, but then I don't know your thinking behind this.

Or if you are saying that the Digital pot will only ever be exposed to the difference between Vout and Vcp?....


kchriste, thanks for the suggestion. I don't want to use PWM, for a number of reasons, D-A is easy for this app but I'm interested in the interface between op-amp and LM317. There can be some hefty current flowing through that part of the circuit (output->control->ground) and I'd already considered a power op-amp.

I'm hopeless on analogue stuff (A level in electronics years ago) and since then I'm purely digital, so I'm on a learning curve now! (I've just passed 40!)
 
Analog Devices is one of the old-school companies - they've been around for a while and if you can dig through their website, you can find some real helpful documentation.

I'm hopeless on analogue stuff (A level in electronics years ago) and since then I'm purely digital, so I'm on a learning curve now! (I've just passed 40!)

Well you can't completely ignore analog stuff - sometimes a simple opamp can just make the project that much easier to do.

I've used variable resistor chips to adjust output voltage for a couple regulator chips, but the chips I used typically reference versus ground, which makes things much simpler. The pot. chips are only exposed to 1.25V which makes things much simpler.

To use the same approach with a 317 chip, the potentiometer chip's ground and the negative resistor terminal is connected to adj, it's power needs to be supplied from VIN(24V), using a simple shunt regulator (i.e. zener diode + current limiting resistor). The wiper pin is connected to VOUT. In order to convert the 0-5V serial signals from the PIC to the potentiometer chip, you'll need a NPN transistor and two resistors per pin that you need to translate up.

I think this approach is "doable", but it is going to be a couple of "features" you'll have to keep an eye out for:

1) The adjustment is going to be nonlinear. Resolution at the higher voltages is going to be pretty coarse, resolution at lower voltages is going to be pretty good.
2) The minimum voltage that the supply will output is ~1.2V
3) The typical resistance that the 317 wants is *very* low when talking about pot. chips. This won't matter as long as the PIC can adjust the final output voltage though.
4) The cheap variable resistor chips that I know of only have ~100 steps

I should mention that the method kchriste mentions - using an opamp to supply the reference current - the 317 only needs ~.1mA or so on the ADJ line, so there really shouldn't be anything difficult about that. The general idea is that the VOUT is always VADJ+1.25V, so just set VADJ to some voltage-1.25V and the 317 will do the rest.

James
 
There can be some hefty current flowing through that part of the circuit (output->control->ground) and I'd already considered a power op-amp.
As Hjames mentioned, you don't need much current to control the 317 via the VADJ pin.
Check out Hero999s circuit;
https://www.electro-tech-online.com/threads/variable-bipolar-power-supply.24291/
He is using an OP-AMP to make the negative regulator track the positive one. It would be easy to adapt it to control the 317 with a PIC. There are better choices than a 741, but he had plenty on hand.

I'm hopeless on analogue stuff (A level in electronics years ago) and since then I'm purely digital, so I'm on a learning curve now! (I've just passed 40!)
Right behind you bud! I'm 40 on the 8th and can feel my brain starting it's shutdown sequence now....
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…