Regulating voltage for a high(ish) amp load

For my first foray into microcontroller design/programming, I've apparantly chosen a project that is well beyond my limited EE experience. I am attempting to use an Arduino Duemilanova to regulate the voltage to a nichrome heating coil. The voltage must be maintained at a user-applied setpoint between 3.5V and 6V. I intend to measure the output voltage on an analog input pin (with a voltage divider to bring it into range) so that a constant voltage can be maintained regardless of battery charge. The power source is 7.4V (2 Li-Ion cells in series). Different heating elements will be used, which can have anywhere between 1.5 and 5 ohms of resistance.

I had two ideas for achieving this, both of which failed my initial attempts. At first, I tried to use the PWM output of the Arduino to switch a MOSFET, but it would appear I bought the wrong type. Using the 5V source from the Arduino and a 100k resistor as a dummy load to test the setup, the output of the FET is a steady 4.8V no matter what I set the PWM output to. If this method is feasible, what would be the appropriate part?

The other method I tried was to use a digital pot to set the voltage of a variable regulator. I didn't even get to the point of hooking up the regulator, because I was unable to send any commands to the digipot using the SPI example code. I hooked it up as recommended, but the wiper stayed firmly planted in the middle position. Can anyone either provide some code that will work with the part I linked, or suggest a part that will definitely work with existing code? The final device needs to be as small as possible, so I'd prefer not to have to use a big 6-pot DIP when I only need a single pot. I've gone cross-eyed staring at the data sheet, and I just don't have the capacity to figure out the protocol for sending commands.

Any help with getting either of these methods working, or even suggestions for a different method would be greatly appreciated.

Thank you.

Sorry, it wouldn't let me post links in my first post. Here are the parts I currently have:

MOSFET
Digital pot
Variable regulator

I should also clarify that I am aware of this thread on digital pots, and tried the code provided. I had hoped that because my digipot was from the same manufacturer (MCP) as the one mentioned that it would work. Unfortunately, it does not. I tried hooking the write-protect pin (11) to 5V, gnd, and leaving it unconnected. I got no response from the chip in any configuration.

Would you try to explain the effect needed? The answer might change the advice offered.

Usually folks want a set temperature from a something like a nichrome wire which is often used in heaters.
Is the need for a set voltage across the wire, or is that a way to estimate its temperature, or something else?

HTH
GB

At the risk of being judged, the purpose of the device is a variable-voltage power supply for an electronic cigarette. These devices are customarily classified by the voltage they provide, so a voltage setpoint is ideal. Obviously wattage is the real measure of how they perform, but that's not how they're thought of now, so voltage would be easier to understand. A current-control scheme would be acceptable, as long as it could be monitored by the Arduino for feedback-based control and converted into voltage for display/setpoint purposes.

I have no idea what one of them is, but that's okay.

I had thought you might be using it as a heater, in which case, I'd probably drive it using PWM, and ponder a bit more about measuring the voltage across it (need to synchronise driving and sampling, which is very doable, but the Arduino library has no facility for it).

To integrate a PWM signal to supply a relatively stable, specific voltage is doable, but it is using quite a lot of current, so I think that would need the PWM frequency increased (normally 500Hz or 1KHz set up by the Arduino libraries), and quite a decent MOSFET.

An alternative is your variable voltage regulator idea. I haven't played with them.

Do you know how much voltage ripple is acceptable?

GB

Sorry - Off to bed, maybe someone else can help

Ooops, for got to comment on

Using the 5V source from the Arduino and a 100k resistor as a dummy load to test the setup, the output of the FET is a steady 4.8V no matter what I set the PWM output to. If this method is feasible, what would be the appropriate part?

I have a couple of thoughts:

  1. The datasheet says its switch on is 10V
    Have a look at this thread, someone else has suffered the same problem:
    http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1271478766

Looking closely, it does look like it might start to turn on. What were you measuring the voltage with?

How did you wire up the MOSFET? Was it tied to ground, with the resistor connecting it to the 5V?

If you do want to pursue the PWM path ...

A neat solution is to use a logic level MOSFET like these:
http://www.rapidonline.com/Electronic-Components/Discrete-Semiconductors/MOSFETs/TO-220-Logic-level-power-MOSFETs-N-Channel/77687

The key value is RGS(on) which, I'm told, needs to be under 1.5V for it to be mostly conducting, when driven by an Arduino pin.

You'd also llike something with a much, much lower RDS(on). About 5%, or less, of the lowest resistance you need to drive would seem reasonable.

If you search the form, for logic level MOSFET, you'll likely find some useful advice on finding them in your locale.

HTH
GB

Night!

MOSFET test was set up like this:

Gate   Drain    Source
  |     |         |
 PWM    |        +5V
output  |
        --------------
        |            |
       100k        volt
     resistor      meter
        |            |
      ground----------

Which I'm now realizing is almost certainly wrong for a n-channel FET. I also tried sticking a 10uF cap in parallel with the meter to "smooth out" the output, but I got the same reading.

As far as ripple goes, it's not going to affect the heating coil one way or another. The only concern is how well the Arduino can read a noisy output. That's why I got the caps, to level it out a bit. I had planned on accounting for this by taking a bunch of readings at different voltages and applying a fudge-factor in software if necessary.

I did try looking for logic-level MOSFETs, but I couldn't find any that meet my amp requirements. Digikey and Mouser don't really indicate whether a part is "logic level" or not, and it got frustrating having to dig through all the datasheets individually. The part you linked just might do the trick. For 63 cents, it's certainly worth a shot.

Thanks!

My only question is drop-out voltage. I'm not sure what the technical name for it is (as in what they call it on the data sheet), but what is the amount of voltage "lost" across the junction? The 7.4V battery source can drop as low as 7V as the batteries run down, so I need to make sure I can still get at least 6V out of the MOSFET.

Okay, swap the resistor and MOSFET. Don't use PWM, just use an ordinary digital out. HIGH and LOW are the same values as PWM, and with the digital out, you can program it to hold a state and make your job easier.

The only concern is how well the Arduino can read a noisy output.

Is there noticeable inductance in the nichrome wire set up, or are you concerned about trying to measure voltage while a PWM output is wiggling around? If it's only the PWM that is worrying you, then that is what I was alluding too when I said synchronise sampling and PWM. That can be done, but the Arduino library doesn't do it. I can explain how I would do it using an interrupt from the PWM timer.

it got frustrating having to dig through all the datasheets individually

Yes, that drives me nuts. Rapid are one of the few who seem to pick that out. AFAIK, RGS(threshhold) needs to be under 2V, for a good chance of switching fully on with a digital pin.

As retrolefty pointed out in the long thread I linked to (sorry for not summarising) manufacturers usually put an 'L' in their part number for logic-level MOSFETs.
In the same thread, there is an approach to switching the MOSFET on using a pull-up resistor and ordinary bipolar transistor, but you only have 7V to pull up to, which looks a bit small to give the 'on' that is needed.

My only question is drop-out voltage. ... what is the amount of voltage "lost" across the junction?

I think we have a similar mental model.
In a bipolar transistor, there is a diode junction in the conducting path, so they drop a diodes-worth of voltage.

AFAIK, and I am not an proper EE, a MOSFET is a near perfect voltage-controlled switch (more accurately voltage-controlled resistor, but we don't want that part of it), the voltage drop across the MOSFET is given by
V = I * RDS(on) (RDS(on) = MOSFET 'on' resistance)
So, if you can get a MOSFET with a low RDS(on), and 0.02 ohm is quite feasible, and you need 3 amps, then the voltage drop is
V = 3 * 0.02 = 0.06V
Providing it is fully on, i.e. the gate is well above VGS(threshold). If you look at the data sheets, they will have graphs for this, plotting ID against VDS for different values of VGS.
I think the VDS, the drain source forward voltage, needs to be as big or bigger than the Gate Source voltage too, but that isn't a problem.
[edit]There are two more thing to think about.

  1. MOSFETS can have quite big gate capacitance, the example STB55NF06L isn't too bad with only 1700 pF. The Arduino's ATmega can only supply 20mA normally, 40mA max, so there is a time delay while the gate capacitor is being charged up. It looks to the gate capacitor as if it is being charged through a 5V/0.04A resistor, or 125 ohm resistor. This means that the gate will take about 1251.710-9 seconds to get to 63% of 5V, and about 5x longer to get to 99% of 5V. While the gate is charging, it is a much bigger resistor, and consequently will dissipate more heat. All this means for your task is to make sure you check that the on and off time is much smaller than the PWM frequency (I'm very conservative, so I'd say 100x would be good).

  2. Most heating elements (which is what I associate nichrome with) have a much lower resistance when thay are cool, and hence draw a lot more current. So get a MOSFET with a low on resistance, and current capacity significantly more than you might estimate. [/edit]

The best book I've found on any of this stuff is The Art of Electronics. It seemed very expensive until I got it, when I kicked myself for all the time I'd wasted without it. If you have a good library nearby, get them to order it for you. It is easily the best electronics book I have ever seen (and I've been into electronics, on and off, since the 70's)

Thanks for all the info. I'm poking around rapidonline now to see if the part you linked earlier is indeed the best for the job. Once it comes in, I'll play around with it and see if I can't get it to do what I want. I'm sure I'll be back in a week or so with more questions, since this is actually only the first part of a fairly complicated project.

I just picked Rapidonline because they specifically pick out Logic level MOSFETs. If you are in the UK, they are very competitive for the parts they sell (smaller range, lower price), but I don't know how they compare outside the UK.

GB

Mouser carries the STP36NF06L, which was listed on the page you linked earlier. I've just placed an order for a few of them.

My only question is, which direction do these work? What I mean is, are these enabled by applying voltage to the gate, or by pulling it to ground? Do these go before or after the load? I was never 100% sure on the difference between N-channel and P-channel transistors.

In other words, this

Source   Gate     Drain
   |       |        |
+7.4V     PWM      load
        control     |
                  ground

or this?

+7.4V    Gate    Drain
  |       |        |
load     PWM     ground
  |    control     
Source

Or does it not matter?

The STP36NF06L is an N channel FET so it is non of the above but:-

+7.4V Gate Source
| | |
load PWM ground
| control
Drain

By the way the other isn't the configuration for a P channel FET, it is the configuration for a source follower, the load voltage will never exceed the gate voltage. Also put a 100R between the base and the gate for limiting the transient current when the gate's capacitor charges.

The difference between p and n-channel is simple, just reverse all polarities, basically swap + for -.

Put another way the circuitry is flipped upside down - the first of your options is the correct one for p-channel. For n-channel source->GND, drain->load->+ve rail

7V should be just enough to switch it on, 10V prefered.

Someone thought the cold current would be much bigger - but this isn't true, NiCr wire is used for heating elements because its resistance is nearly constant between cold and hot (2000F) - and because it doesn't burn away (stable oxide film on surface)

The inductance of a heating coil is unlikely to cause significant transients on switching.

Thanks.

But that being the case, how the heck am I going to measure the effective voltage with the Arduino? If I measure before the load, it will always read 7.4. If I measure after the load, it won't be accurate.

7V should be just enough to switch it on, 10V prefered.

The data sheet for that device says it will switch on quite well with 4.5V

how the heck am I going to measure the effective voltage with the Arduino

With this circuit you are not controlling the voltage at all it is on or off. Non of the circuits you have considers so far are capable of producing a voltage in the range you want:-

The voltage must be maintained at a user-applied setpoint between 3.5V and 6V.

To do what you want you should use a PWM signal boosted up to the maximum supply voltage you have with a transistor. Then you need to smooth that signal with a R&C, then you need to apply that to a FET in the source follower mode.

This FET will get hot, hotter than the wire at low voltages. This is because the FET is burning off the power that is not going into the wire. You will need a hefty heat sink to stop it all melting.

http://www.thebox.myzen.co.uk/Tutorial/PWM.html

how the heck am I going to measure the effective voltage with the Arduino?

I can think of two tactics:

  1. Put a voltage divider across the load. This is just a pair of resistors in series, and the centre of the pair will be a voltage which is a fraction of the overall voltage. The fraction is the ratio of the two resistors. Calculate that to give a convenient range, and get the sum of the two around 10k.
  2. Get a fixed low value resistor, e.g. 0.1 ohm, put it at the ground-end of the serires, and measure the voltage drop across that.
    (Check using a voltmeter or multimeter.)

HTH
GB

With this circuit you are not controlling the voltage at all it is on or off. Non of the circuits you have considers so far are capable of producing a voltage in the range you want

Agreed.

But, if I've understood the working of an electronic cigarette, the nichrome wire is acting as a heating element.
Assuming its temperature changes it's resistance, the voltage set-point is one way that temperature is set and also measured.
The current through the nichrome wire must also be directly related to resistance too (at a known voltage), and that could be measured as a voltage drop across a known, fixed value resistor.

Assuming (bear with me) there is some thermal inertia, then the temperature of the nichrome can be adusted by adjusting the duty cycle of a PWM. It might take some adjusting of the PWM frequency.

Proposition: the heating effect of the nichrome wire can be reproduced with a PWM signal, and the nichrome wires 'set point' measured by measuring current through it, and voltage across it (to account for the batteries dropping), and the PWM duty cycle adjusted.

The temperature of the nichrome can be deduced from the voltage drop across a fixed value resistor in series, and the voltage experienced by the nichrome wire measured with a voltage divider.

Is that a reasonable set of assumptions?
GB

That's correct, though I don't actually need to know the temperature of the wire. Knowing the voltage is enough to know how the wire will perform. To include a voltage divider and cap, is this approximately correct?

Gate    Source    Drain
  |       |         |
 PWM     GND        -------------
control             |  |        |
                    | 150k   cap=
                    |  |        |
                 Load  --Analog |
                    |  | input  |
                    | 100k      |
                    |  |        |
                    -------------
                    |
                  +7.4V

It seems to me the analog input would still be getting a constant voltage reading no matter what, because it compares against an internal ground reference. This whole "switching the ground" thing has me very confused.

I think I have confused things.

Grumpy_Mike is correct when he writes that the PWM switching technique will put (near enough) the whole battery voltage across the wire. (That voltage still needs to be measured so that the batteries can be monitored so they don't go flat, and to get a reading for the voltage drop across the load as the batteries run down.)

I also believe Grumpy_Mike is correct when he says if you want voltage control across the wire, it can be done as described, and the FET would need to dissipate quite a lot of heat, and may need a heatsink.

I realise Wikipedia is not very reliable, but, the commercial electronic cigarettes they show don't seem to be big. They don't look like they need to dissipate a lot of heat. So, one possible explanation is they adjust the temperature with PWM, and the temperature is either measured with a sensor, or the resistance of the wire.

I think the ASCII schematic is about right. According to the Atmel ATmega datasheet, the resistors should be about 10x smaller. As the top voltage from Lithium batteries is about 8.4V (can't quite remember), it could be two equal value resistors of 10K.

I'm assuming you can avoid the need for a capacitor by sampling the voltage at the right point in the PWM cycle.

HTH
GB

They don't look like they need to dissipate a lot of heat. So, one possible explanation is they adjust the temperature with PWM, and the temperature is either measured with a sensor, or the resistance of the wire.

They don't have any voltage control at all, short of using different batteries. Some use two 3.7V batteries and a linear 5V regulator, but other than that, they're mostly simple battery-button-load circuits.

I wouldn't have thought there would be any need for a heatsink for a setup like this. I thought the whole point of PWM vs linear regulators was that PWM didn't waste all the extra voltage as heat. Since it's a logic-level part and will be switching fully on and fully off, there shouldn't be much waste, should there?

I'm assuming you can avoid the need for a capacitor by sampling the voltage at the right point in the PWM cycle.

Probably, but like you said, that's not something that is built into the Arduino's libraries. I would have no clue how to implement that, and I can pretty much avoid the issue entirely for the cost of a 10uF cap.