Constant Current Generator - Page 1
Forum section: electronics / projects

author: Mike Warren
author_rank: Unknown
timestamp: May 14, 2013, 06:39:20 am
content: I have a bit of a tricky problem to solve with a constant current generator, which I think I'm going to need to make some compromises with and rethink my spec, but I thought I'd post it here first in case I'm overlooking a simple solution.I need to supply a constant current of 200mA over a load range of 0 to 10 Ohms. The current may vary up to 10% over this rangeMy supply voltage will vary from 5.5V to 9.5V. The current may vary up to 2% over this rangeI need to be able to switch it on and off at a maximum rate of about 300Hz (30% duty cycle) from a 5V drive signal (output from a micro).Needs to be low cost and not take up much PCB space.Needs to be able to handle up to +/- 29VDC being fed into the output for at least 5 minutes without damage and without feeding the voltage back into the supply. It obviously doesn't need to actually work in this state, just survive.The attached circuit was my first idea. It only just meets my specs except for handling -29V. The LM317 will getveryhot very quickly. I don't have room for a heatsink. The problem is if I put another FET in series to switch off the output under this condition the extra voltage drop makes it fall outside my spec during normal operation.

author: Harvs
author_rank: Super Contributor
timestamp: May 14, 2013, 06:45:42 am
content: Do you have to have a common ground between output and input?How I've implemented reverse polarity protection in my float charger circuit might be of some use:https://www.eevblog.com/forum/projects/motorcycle-float-charger/

author: Mike Warren
author_rank: Unknown
timestamp: May 14, 2013, 06:51:43 am
content: Quote from: Harvs on May 14, 2013, 06:45:42 amYes.QuoteI'll have a look. Thanks.

author: Harvs
author_rank: Super Contributor
timestamp: May 14, 2013, 06:52:52 am
content: My circuit wont be of any use to you then, needing the common ground.

author: muvideo
author_rank: Frequent Contributor
timestamp: May 14, 2013, 12:18:18 pm
content: Hello,for your specs the linear regulator is thecheaper and simpler way, 317 or not youhave to dissipate power: the dissipationwill be (Vout-Vin)*I, so worse point will bewhen you have a 0ohm output and 9.5Vinput where your circuit will dissipate 1.9W.It's not much for a 317, but an heatsink is required.If you want to avoid dissipation you have tobuild a switcher, a buck converter. Butit's not anywere simple or cheap like a linearregulator.

author: Paul Price
author_rank: Super Contributor
timestamp: May 14, 2013, 12:41:52 pm
content: The +/- 29V presented at the output might overheat or destroy the 117 in the -29V mode and blow out the Gate-Souce max voltage of (Max G-S= +/- 20V) in both 29V polarities. The LM117 can only take about 30V input to output and if your constant current power supply is set to 10V and you have -29V at the output then that means 39V across the LM117 and this could zap it.To give you some advice, I would first need to khow much current can the +/- 29V deliver and can the +/-29V overvoltage just be shunted to ground at the output? How should your constant current supply treat 29V overload condition...present either an open or shortcircuit to the +/- 29V overvoltage?You will not be able to control the output FET with 5V logic levels since the output of your constant current source output would raise the source voltage and this opposes any switching on/off of the MOSFET. The voltage in constant current mode can rise to up to 10V as you claim and this voltage will act against your control voltage at the gate and you could also destroy the gate-source junction by the +/- 29V high voltages. Solution: use an opto isolator controlling at least an isolated 12V power source to turn on/off the output MOSFET.The relay circuit below would protect your constant current output against +/- 16V to +/-29V conditions.

author: Mike Warren
author_rank: Unknown
timestamp: May 14, 2013, 12:42:26 pm
content: Quote from: muvideo on May 14, 2013, 12:18:18 pmActually, it's only a third of that, as it's being switched at 30% duty cycle.Unfortunately, my worst case is when -29V is being fed in. I really need to detect and shut off the generator in that situation. And I definitely don't want to go to a switcher unless it makes everything work perfectly, and I can't see that it will make a difference where it matters.Looks like I didn't explain my problem sufficiently. It's not actually at 9.5V/0Ohm, but and 5.5V/10Ohms that I have the main problem. Minimum voltage drops all accumulate through series components and it will no longer be able to supply the current. If I omit the series Schottky diode I have enough leeway to add another MOSFET, but that will cause the +29V fault condition to be fed back into the power supply. I can't have that.I guess I'll detect excessive voltage across the 317 and do something to switch off the MOSFET. Just need to do it as simply as possible.

author: Mike Warren
author_rank: Unknown
timestamp: May 14, 2013, 12:48:09 pm
content: Quote from: Paul Price on May 14, 2013, 12:41:52 pmI'd use a 317, which has a 40V max rating.QuoteNo, there is at least 5 amps available in the 29V fault mode. It's actually quite unlikely to happen, but not impossible, so I need to deal with it. I can't short it anyway without doing damage to other equipment. So, going open is best, but 200mA wouldn't be a problem (except for dissipation in my circuit).

author: Mike Warren
author_rank: Unknown
timestamp: May 14, 2013, 02:21:39 pm
content: Quote from: Paul Price on May 14, 2013, 12:41:52 pmThis isn't a problem in practice. The circuit I posted above actually works. When there is minimal to no load, it doesn't matter if the FET is switched off. Once the load gets to 10 Ohms, the source of the FET is pulled to 0V and will turn on. Even once the 200mA is being supplied, it only raises about 2V. That leaves 3V to turn on the FET, which will turn on with 2V (just enough to work in this situation).QuoteThis is a problem. The MOSFET I want to use (2N7002) has a VGSmax of 30V. I could put a 5V zener between the gate and source and a series 22K resistor back to the micro to solve that. (And a 5V zener to ground on the micro side).But I think I'm going to need to change how the FET is driven anyway, because the -29V situation is going to be best handled by switching off the FET, which will mean not hard referencing the gate to ground. If I drive the gate from the battery I have another 0.5V (worst case) available.This is an area where I can massage the spec if absolutely necessary. I would like to be able to use the battery down to 5.5V, but if there is no other way, I could consider 6V the cut-off point.QuoteThe only power supply I have available is the 5.5 ~ 9.5V (a 9V alkaline battery)QuoteUnfortunately, putting a relay across the output will cause problems in other modes (where it has to read the voltage on the "output" line instead of putting out current. In that situation, it needs to be reasonably high impedance (at least 1K). Also even a small relay on top of the other components will be pushing my board spaceI do understand it's hard to offer advise when I'd have to write a book to explain absolutely every parameter I need to deal with. For instance, the 29V situation is absolute worst case, but there is a better chance it might be connected to +/- 14V.The device is a specialised tester for use by installers of certain equipment in vehicles. They will almost always be used in 12V vehicles, but no matter what instructions I supply, someone might connect it in reverse polarity to 24V (28.8V) supply.

author: muvideo
author_rank: Frequent Contributor
timestamp: May 14, 2013, 02:40:55 pm
content: Quote from: Mike Warren on May 14, 2013, 12:42:26 pmMy fault, I didnt read well all the description.Just a quick try: if your input doesnt go above 15V you can try with an LM1117-ADJ (or similar units)this will give another 1.5V of dropout headroom. Check the circuit below: as out goes below groundQ1 clamps M1 gate to source. R2 dissipation could be a problem: it has to withstand -29V andbe low enough to not slow down switching speed, but gate charge of the 2N7002 is so low...Hope I didnt made big mistakes

author: Mike Warren
author_rank: Unknown
timestamp: May 14, 2013, 10:40:49 pm
content: Quote from: muvideo on May 14, 2013, 02:40:55 pmThat looks promising. Thanks. I'll breadboard a variation of it later today.

author: Paul Price
author_rank: Super Contributor
timestamp: May 15, 2013, 06:38:04 pm
content: If you would consider the relay circuit i proposed, you could change the relay to a 5V unit, add a 12 zener in series with the relay coil, (put a 1N1004 snubbing diode across the coil as well) and this protection network will present itself as a very high impedance unless the output approaches 12V. If 12V is not good enough, use a higher voltage zener to feed the relay coil. 5V relays can be salvaged from old computer modem boards that are quite tiny in size.

author: Mike Warren
author_rank: Unknown
timestamp: May 16, 2013, 05:23:32 am
content: Quote from: Paul Price on May 15, 2013, 06:38:04 pmI really have very little room on the board, and I don't particularly like using relays anyway. And these will be made by the hundreds, so scavenging is not suitable.The transistor idea posted by muvideo is more along the lines of what I was thinking, but I was initially going to do it on the high side of the regulator because the source of the MOSFET needs to be as low as possible for it to switch on hard enough. Putting the diode on the output takes the circuit outside my spec of wanting to run down to 5.5V.So, I can add a voltage doubler on the drive signal to the FET, but that requires some compromises, all of which have downsides. I then looked at the possibility of accepting a usable battery voltage range down to 6V instead of 5.5V. That would work, but I'd be losing a bit of usable power from the battery.However, the problem is actually worse than I thought. I've been basing my battery use calculations on some tests I found on the Net. I just did a discharge test on a Toshiba alkaline battery and found it has usable energy below 4V.So, I could run the whole thing from a boost converter, but now it's starting to get more expensive, and I'm not really sure I'd gain much from the battery anyway, by the time losses in the converter are considered.

author: Mike Warren
author_rank: Unknown
timestamp: May 16, 2013, 05:33:50 am
content: Quote from: muvideo on May 14, 2013, 02:40:55 pmCuriously, I've been breadboarding with an OnSemi LM317T and it doesn't drop out until 3V. Considering that the ADJ terminal drops 1.2V, it looks like the regulator itself continues to work down to about 1.8V, which matches up with what the datasheet says, so I'm not sure how much better a LM1117 will be. I don't have any, but I'll get some with my next Element 14 order.

author: muvideo
author_rank: Frequent Contributor
timestamp: May 16, 2013, 09:57:37 am
content: About the dropout:it's not a sharp line, the 317 regulation falls apartat reduced dropout voltages, your test is in line withit's datasheet, page 6:http://www.ee.buffalo.edu/courses/elab/LM117.pdfthe current regulation starts drifting, and becomestemperature sensitive at low dropout.Checking the 1117 datasheet, seem that at 200mA youwill gain less than I thought: around 500mV, butthinking about it's internal structure, it is to be expected:one less B-E junction.So we have regulator at around 2.4V (1.1+1.25)and output diode at around 400-500mV for a schottkylike for example SK16 or 26. Total 2.8-3V, at 5.5V inputand 2V output you have 500mV Vds on the mosfet, somaximum Rdson of your mosfet has to be 2.5ohm at 2.4V Vgs.The 2N7002 is marginal at this voltage, but probably it's nothard to find a small mosfet that goes full-on at 2.5V, and thatwithstands 30V Vds.You could also check if a npn transistor could do the job.About the battery, asking 200mA pulses from an alkaline battery,your circuit will suffer from internal resistance of the battery.A worse battery will sag down to low voltages before dischargingcompletely. A better one will keep it's voltage high, up to thelast mAh. You could also think using rechargeable NiMh ones,low self-discharge ones should be good enough for thisapplication, good ones are 7-cell type (8.4V), 8-cell are better.

author: Mike Warren
author_rank: Unknown
timestamp: May 16, 2013, 02:16:36 pm
content: I'm not too worried about poorer quality batteries not lasting as long. It basically comes down to doing the best I can with the available materials while keeping the cost low. The micro will be monitoring the battery voltage so I'll know when to shut it off and flash the low batt indicator.As for replacing the FET with a NPN, I thought about that, but the controlling transistor will have quite a load on its B-E junction in the -29V situation. By the time the base resistor is large enough to be safe in this mode, it's too high for normal operation. Yes, that could probably be solved too, but the circuit starts to become more complicated. I might as well stick with the FET and do the voltage doubler on the gate drive signal. I should be able to get 8V with 2 small diodes and capacitors, but I'll need to add another couple of FETs to do the switching.In the attached circuit, PA0 is already outputting a 10kHz square wave to multiplex the LEDs, so I can use that for the voltage doubler. I'll also change the regulator to a 1117.This won't have fast rise/fall times, but it'll be fast enough for this job. Also, the resistor values are just an estimate at this stage. I'll calculate them tomorrow.

author: muvideo
author_rank: Frequent Contributor
timestamp: May 17, 2013, 01:04:46 pm
content: Hello, consider also thatD1 SS14 at 30V reverse voltage will leak back some current,probably few to many 10's of uA. This current will reverse brakdownB-E of Q16 or worse of internal transistor of U4, not good. You canprovide a safe path adding a diode from out to In of U4.Parts count is slowly increasing

author: Mike Warren
author_rank: Unknown
timestamp: May 21, 2013, 03:22:55 am
content: Quote from: muvideo on May 17, 2013, 01:04:46 pmIndeed it is.I wouldn't have thought 50uA would be a problem. The normal protection diodes are to prevent enormous currents flowing throu the regulator when there is a very large output capacitor and the input is shorted.

author: muvideo
author_rank: Frequent Contributor
timestamp: May 21, 2013, 09:18:59 am
content: Quote from: Mike Warren on May 21, 2013, 03:22:55 amI dont know how bad is 50uA, if your "30V applied to output" condition is onlya rare event, probably it will never damage the junctions.I'm not a semicunductor expert, but recently free_electron mentioned thatreversing B-E junction is damaging for a transistor, lowering it's gain irreverrsibly.About "low current", it's funny how the feeling of magnitudes depends on howI can measure. When I had only an handheld anything less than 1mA was"low enough, dont bother" sort fo thing.When I had access to bench meters, 1mA started to be pretty big, but anythingless than 1uA was "low current". I recently scored a keithley picoammeter at prettygood price, and now anything over few pA is worth my attention...

author: Mike Warren
author_rank: Unknown
timestamp: July 17, 2013, 04:32:31 am
content: Just to wrap up this topic, here's the final circuit. I'm very happy with how it works on the bench and 5 prototypes being field tested now. Let's see if the users can blow them up.Edit: The regulator is actually a LM1117MPX-ADJ, not a 317. The circuit works down to 5.3V