Using a MOSFET for a current source
I'm working on a project that needs an adjustable current source. As a whole, this project will be used to measure the power output of a large amount of solar panels. The mechanism of measuring the power, is to measure the voltage and current under various loads. To do this, I will need a device that "looks" like a variable, digitally controlled, resistor. What I had in mind, was using a MOSFET or BJT.
To make this variable resistor, I thought I would start by using a PWM output from a uC like the Propeller. Using this PWM, I could create a DAC. This DAC could then be used to adjust the voltage at the base or gate of a transistor. By adjusting the voltage, the transistor now becomes the variable resistor I was after.
What I want to do, is be able to control the amount of current being allowed through the transistor by controlling the voltage to the gate/base. The problem with MOSFETs, however, is the exponential relationship between the gate-source voltage, and the drain-source current. I suppose I could just correct for this in software, but here's the question...
Is there any sort of hardware or circuitry that could correct for the exponential relationship? Is there a better way of doing this?
To make this variable resistor, I thought I would start by using a PWM output from a uC like the Propeller. Using this PWM, I could create a DAC. This DAC could then be used to adjust the voltage at the base or gate of a transistor. By adjusting the voltage, the transistor now becomes the variable resistor I was after.
What I want to do, is be able to control the amount of current being allowed through the transistor by controlling the voltage to the gate/base. The problem with MOSFETs, however, is the exponential relationship between the gate-source voltage, and the drain-source current. I suppose I could just correct for this in software, but here's the question...
Is there any sort of hardware or circuitry that could correct for the exponential relationship? Is there a better way of doing this?
Comments
·
You need, first, a way to measure the current.· Use a resistor for that, say one that will drop one or two volts at maximum anticipated current.· One end to ground, the other end to the source of the FET.· The voltage across the resistor is then a measure of the current.· Feed an ADC of sufficient resolution, read it with the microcontroller, and the microcontroller knows the current.
To control the current, feed a DAC from the microcontroller.· Use a DAC that has the resolution you think you need.· Feed the DAC output to the gate, and you can control the drain current, which you're constantly measuring as in the paragraph that precedes this one.· This will likely be easiest with an enhancement-mode FET, by the way, but ought to be feasible, also, with a depletion-mode FET.
If the current is higher than you want, adjust the gate voltage to lower it.· If the current is lower than you want, adjust the gate voltage to raise it.
There's no reason to worry about, or even to be curious about, the shape of the FET's characteristic curves.· All you need·know is the end points, to be sure you can reach them with the gate voltage.· You may need to amplify the output of the DAC to feed the base, for which an appropriately chosen op-amp fed directly from the solar panels would serve nicely.
With all that, you can measure and control the power from any number (not "amount", which is singular) of solar panels.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net
I'd probably use an NPN bipolar transistor rather than a FET, by the way.· What I've described, after all, is simply a source follower, or emitter follower, controlling the current through the current-measuring resistor by controlling the voltage across it.· Bipolars are cheap, and there's nothing stabler than a follower, except at Gaza.· Some of the structures there are very stable.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net
Just to get the terms straight, what you need is a programmable load or current sink, not a current source. Your PV arrays are the source.
My inclination would be to use a PWM or DUTY-mode output, as you've suggested, and filter and voltage-divide it to feed te positive input of an op amp. The output of the op amp would drive the base or gate of your load transistor (which will need a heatsink, BTW). The emitter or source will connect to a current-measuring resistor to ground and feed back to the negative input of the op amp. That way you can just dial in your current requirements with the duty cycle input and don't need to involve the micro with any feedback issues.
The only thing you won't know with this arrangement is whether the PV array is providing as much current as you've requested. But you can determine this indirectly by varying the requested current a little and seeing if the voltage changes.
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 8/8/2009 2:25:17 AM GMT
I still don't like the idea of using PWM for this, though.· To use PWM you've got to insert some pretty aggressive filtering -- which I have never found desirable inside a control loop.· In this particular control loop, you'd have to slow the entire system down by a factor, probably, of at least hundreds.· Also, with what resolution can you adjust the duty cycle of a PWM output?· That would directly affect the precision with which you can control the current.
Me, I'd use a nice, fast, hi-resolution DAC for control, which I'd probably build using only resistors.· That way you can get whatever resolution you want, and resolution and monotonicity are the only specs you care about.· Neither linearity nor differential linearity matters at all in the control portion of this loop -- although they matter a little in the sensing portion.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
I agree that a normal PWM may slow things down a lot, but the DUTY mode output from a Propeller, for example, is 40MHz at a 50% duty cycle, which makes it easy to filter, with a theoretical (but unachievable) 32-bit resolution. I guess this is what I had in mind.
"Formally, however, a current sink that is controlling the current is a current source." True enough!
-Phil
The story behind this, is that my dad, working for the local Electric Co-op, was in charge of a project a couple of years back, involving a bunch of solar panels at a guy's ranch - all for a tax credit. The system turned out to be a flop(no fault of my dad), so the Co-op was just going to throw the panels away. My dad ended up hauling these things off for them, so now he has about 80, 2'x2' 15W panels in the storage building out back. I wanted to go through these panels, one by one, and measure the power ratings to see which are good and which are bad - and at what ideal load conditions.
So, using a uC to generate a votlage reference, running it through an op-amp, and controlling a transistor is the best way to go with this?
(1)· Measure the output.· It's too high.· Lower the drive.
(2)· Repeat (1) a couple dozen times because the control circuitry is slow and the output didn't change yet.
(3)· Finally the output starts moving, but you've lowered the drive multiple times and now it's too low, so the output eventually·goes way lower than intended.· Now you'll raise the drive a bunch of times to correct it, and again you'll go too far.
The result is a divergent system that oscillates between its limits because the control portion of the loop is slower than the measurement portion.· This isn't just theory -- I have screwed up this way myself, back in the 1970s when I did process (temperature) control with an IBM 1800.· I was watching, and switched back to an older control system before the molten glass in the forehearth froze up, but it took me some thought to understand why the system was divergent.
The solution may be to slow down the measurement process.· Even smarter might be to take (each time through the loop) several consecutive measurements of the output at intervals long enough to see significant change, and then calculate the asymptote and base an adjustment on·that.· It gets complicated in a hurry, but if you get fancy enough you can achieve faster-than-critical control performance while avoiding control overshoot, which is impossible to do in an all-linear system.
For this application, probably two-bit resolution would yield the information·desired, though.· Me, now that I know the purpose is to evaluate each panel, I'd likely·do it manually (with an ammeter, and toggle switches for changing the load) rather than use a microprocessor at all, since there are only 80 panels to evaluate, and most of the work will be hooking them up and then unhooking them.· But I'm an inveterate minimalist, eh?
Quite a windfall, by the way -- 1200 watts' worth of solar panels!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net
And Carl, yes, a pretty big score! These were all free, but it's going to take some work going through them and grouping them by performance, then working out some kind of installation.
The main reason I'm doing all this, is to be able to group them based on their performance curves as I test them. One slightly bad solar panel can sure screw up a string of them in a hurry.
Post Edited (Philldapill) : 8/8/2009 8:28:17 PM GMT
"One slightly bad solar panel can sure screw up a string of them in a hurry" - how are you planning on connecting them in the long run? Series or Parallel or a matrix combination? ... just curious
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Don't most solar panels have blocking diodes? Or are they typically omitted due to the forward voltage losses?
-Phil
I'd like to have these at a fairly high voltage because they will most likely be set up in my dad's field, which is around 500' to the building where batteries and a controller will be housed.
"Don't most solar panels have blocking diodes?" - usually yes, but only one per panel and sometimes they are put in as a market afterthought. <-- IOW - user optional ... Depends on where your panels are coming from though.
"Or are they typically omitted due to the forward voltage losses?" - In series configurations this is a big problem. What you want to watch out for is that a single series group of panels do not generate enough voltage to over ride the zener breakdown voltage of any single cell. A diode for the most part will eliminate this potential problem.
Philldapill,
"The OC Voltage of these panels is about 35V, and the maximum power transfer voltage is around 18V(from my observations)." - that's about right... generally it's about half of the OC rating
Ideally you would have all of your panels in parallel and do the AC conversion right there, but if that's not a possibility, I think the best aspect ratio would be a square matrix .... Assuming %75 of your 80 panels are good, that's about 60 panels, I would gear the matrix so that it's an 8x8 or something close to that.
The next obstacle would be to convert the higher voltage into something compatible with standard AC equip. What method are you using for this? Grid-Tie? Grid-Sync? Off-Grid?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.