Author Topic: Simple controller circuit  (Read 3093 times)

0 Members and 1 Guest are viewing this topic.

Offline GamatronicsTopic starter

  • Newbie
  • Posts: 5
Simple controller circuit
« on: May 28, 2015, 08:54:19 am »
Hi everybody,

Let's get right to business.. I want to implement a simple controller in order to keep a constant current in a circuit.

I have a 12V battery connected to a very low resistance load, the current gets to about 18A, but when the load gets hot the current increases, I'm trying to avoid this by using a simple P controller (Proportional) to make sure that the current stays at a given Set Point (SP) set by the user. The load is driven by a PWM (Pulse Width Modulation), I can control that PWM with a DC signal that goes from 0V to 12V. 0V means 0% duty cycle and 12V means 100% duty cycle.

I added a shunt resistor in series with the circuit in the low side (between the load and ground), I'm using this as a current Sense Resistor (SR). I'm comparing and amplifying the difference between the SP and the Voltage sensed by the resistor. For this I'm using 2 OpAmps configured as comparator/amplifier (added a screenshot of that), one OpAmp gives me the amplified difference when the voltage of the SR is higher than the SP, the other one gives me the difference when the voltage of the SR is lower than the SP.

So what I need is to be able to get a 0 to 12V signal from those comparators (or any other circuit) in order to feed that to the PWM and ensure that the current remains constant. This is to point where I´m stuck. How would you solve this? Any pointers?

I only have a single 12V power supply, and the solution must be analog, no digital logic available or microcontrollers. Let me know if you have any questions and I'll try to clarify it, thanks in advance for your help.

Just to clarify what you see on the screen shot, VDC2 is the set point, and the DC variable power supplies that you see there represent the actual voltage sensed across the sense resistor.

Best regards,
Gamatronics
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1943
  • Country: us
Re: Simple controller circuit
« Reply #1 on: May 28, 2015, 09:21:10 am »
You haven't gotten far.  You will create the PWM with a switchmode chip like the TL494.  The sensed current will be pulsed.  Average that with a RC filter.  That will give an analog average.  One op amp because you will need a couple volts for the TL494.
 

Offline GamatronicsTopic starter

  • Newbie
  • Posts: 5
Re: Simple controller circuit
« Reply #2 on: May 28, 2015, 09:37:24 am »
Maybe I'm not understanding your reply correctly, but I already have a working PWM, all I need is a DC signal that swings from 0 to 12V.  I need low voltage when the current is too high (getting a high voltage on the sense resistor), and a high voltage when the current is low (low voltage on the sense resistor) in order to feed it to the PWM.

That DC signal must be a function of the set point minus the sensed value, how would I get that? From what I could gather the TL494 is a chip that gives you the correct PWM duty cycle based on what you sense, but I already have the PWM. All I need is how to transform the Error (set point - sensed value) into a 0 to 12V DC. I'll go thru the data sheet again, maybe I'm missing something.

Thanks!
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1943
  • Country: us
Re: Simple controller circuit
« Reply #3 on: May 28, 2015, 12:52:33 pm »
Why don't you show me what you have for a PWM.  Any PWM should have a comparator already with a reference voltage.  The inverse voltage requirement seems round about.  I'm not going to advise you on something like that.
 

Offline GamatronicsTopic starter

  • Newbie
  • Posts: 5
Re: Simple controller circuit
« Reply #4 on: May 28, 2015, 09:17:34 pm »
The PWM I have is just a 555 configured as an astable oscillator. Using pin 5 (Control Voltage) on the 555 I can control the width of the pulse using a DC voltage, low voltage on pin 5 lowers the duty cycle, high voltage on pin 5 increases the duty cycle (see attached screen capture).

Thanks for your help.

On the screen capture, red signal is the output of the PWM (555) and the yellow signal is the Control signal that goes to pin 5 on the 555, you can clearly see how I can use that voltage to control the PWM, what I'm having problems with is how to generate that yellow signal of off the Error (set point minus sensed value).
 

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2700
  • Country: us
Re: Simple controller circuit
« Reply #5 on: May 28, 2015, 09:50:49 pm »
Essentially what you're building is a constant current buck controller, right?  You're PWMing the load so that the current averages out to your target, presumably with a fair bit of inductance in there to smooth things out.  Typically what you'd want is a current sense amplifier feeding into one side of a comparator and the control voltage into the other.  When the current is below the set point the comparator turns the output switch on, and when the current goes above the set point it turns off.  That's the gist of a buck regulator.  There's a bit more to it, of course, which is why people buy integrated switching controllers instead of just using a jelly bean comparator--the comparator needs to have some hysteresis or incorporate some sort of timer to control on/off time, the control loop elements need to be stabilized and have a stable reference, you'll want UVLO and some other fault protection, and at 18A you probably want to use a synchronous switch which means watching out for shoot-through, etc.

So really, the problem you're asking about here--generating the analog feedback signal--is sort of a red herring.  It's an intermediate step that you don't really need.  If you use a switching controller (like the TL494 or whatever), then the the controller takes care of translating the difference between the set point and the feedback signal into the required duty cycle, and you don't need the 555 or the intermediate control voltage at all.
 

Offline GamatronicsTopic starter

  • Newbie
  • Posts: 5
Re: Simple controller circuit
« Reply #6 on: May 28, 2015, 10:21:24 pm »
Ok, so apparently this is harder than it looks..... I thought it was going to be rather simple to generate the control voltage I need from the difference between the set point and the actual value, which is all that is preventing me from doing this.

The main issue here is that the PWM is already a 555, I didn't get a say in that regard, I just joined the team and they want me to do a loopback controller with what they have, and Pin 5 on the 555 was the easiest way to do that (or so I thought), the other option is to change the resistance on the 555 that controls the duty cycle, but if I couldn't generate a simple voltage control signal to feed it back, let alone a circuit that gives me a variable resistor value in order to feed that into the 555.

Thanks for your help.
 

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2700
  • Country: us
Re: Simple controller circuit
« Reply #7 on: May 28, 2015, 11:05:43 pm »
Well, if you're truly stuck with a 555, then what you need is a differential amplifier, which as the name suggests will amplify the difference between two signals.  You can build one from an op amp and four resistors, or buy a purpose-built IC.  And you'll need a fair bit of filtering.
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1943
  • Country: us
Re: Simple controller circuit
« Reply #8 on: May 28, 2015, 11:31:40 pm »
No one is stuck with a 555.  I have hated them for 40 years.  So you want to have 4 chips instead of one, add in a bunch of offsets and drifts, and have a nightmare of adjusting pots.  Sorry, I do not support any 555 programs. If they want you to use a 555, then they are not designers.
 

Offline GamatronicsTopic starter

  • Newbie
  • Posts: 5
Re: Simple controller circuit
« Reply #9 on: May 29, 2015, 10:46:02 pm »
Yes ajb, you're right. That was my first instinct as well, just to amplify the difference between the Set Point and the Actual value and feed that into the 555 control pin. You can see that I tried to implement that in my original post I attached the diff amps I was trying to use, as you said an opamp and 4 resistors. Since I only have single power supply I thought of having one diff amp for the case when the sensed value is greater than the set point, and another diff amp for when the sensed value is lower than the set point, that's precisely the point where I got stuck and decided to post in here. And since everything is pulsing, yes I do need a bunch of low pass filtering in order to try and get DC voltages out of the pulsing signaling, which is not that big of a deal really.

So what would be the next step? I can see now that I was on the right track, how would you make this work? Thanks again for the help. I'm re attaching the diff amps screen shot that I posted in my original post.

Seekonk, you are right that they are not designers, they're not even engineers, they just bought a bunch of cheapo PWMs online to drive the load, and those PWMs happened to be implemented with a 555. Is not that they are making me use a 555, is just simply that that's what we are stuck with. And even though the PWMs are cheap and nasty, they do get the work done for our application, all I need is to generate that damn control signal and I'll be set. Thanks for your comments.

 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1943
  • Country: us
Re: Simple controller circuit
« Reply #10 on: May 30, 2015, 01:02:27 am »
Inverting op amp with an offset.  Sourcing sense voltage is low imp, so a 4.7K to a 47uf cap should give  a good average value.  Not saying it won't hunt around till you get the gain and time constants right.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf