The Arduino 5V boosted to 40V, with a hand made inductor.
The same circuit, with the Arduino regulating at 9V instead.
Inductors resist changes in current. When Q1 is active, a larger current begins to flow through L1 to GND. When Q1 is switched off, the current through L1 trys to remain the same as it was, causing an increased voltage. By varying the PWM duty cycle, the current through L1 and output voltage can be controlled.
There are many ways to explain the relationship between PWM (analog output) and output voltage. The simplest way to put it, is that as PWM duty cycle increases, the voltage also increases. This is true when the output load remains constant. What the PWM does is control power, and if output current remains constant, then the voltage increases (P=VI). Alternately, at any given PWM if the output current is reduced, the voltage will increase. Without regulation, the output voltage would change as the load changed.
Don't worry about the gain of the transistor. (I've tested 2N3904, 2N2222, 2N4124, etc.) Connecting it correctly, is all that's important. When the circuit is powered by batteries or the Arduino, the gain of the transistor will have little effect on ouput power. Also note that even though the transistor is rated for 30Vdc (in most cases), it should be safe to use up to 60Vdc for two reasons. 5V logic on the transistor base doesn't saturate it, so the voltage drop across the transistor is generally less than 1/2 the circuit output voltage. The second reason is that the voltage rises when the transistor is off and not conducting. By the time the transistor is turned back on, the voltage should have dropped back down closer to the input voltage. This is why most 30V NPNs can handle generating 60V.
The exact inductance of L1 doesn't matter. The circuit is capable of using almost any inductor. Any insulated wire wrapped at least 16 times around metal should work, regardless of the wire's gauge (thickness). I don't even own an inductance meter, and this is the first time I've used inductors in a project. I randomly wrapped wire around metal, and had a working inductor on my third try. It's easy, my advice is don't let it intimidate you. Just remember the important parts: insulated wire (not bare wire) wrapped tight around a smooth metal object (sharp edges could cut the insulation), and wrap the wire around the metal more than a dozen times. Take a look at the pictures below, try making your first inductor about the same size as them.
If you're trying to get more than one watt, then use a darlington pair. With BJT power transistors, the most you'll get is about 4 watts, efficiently. With N-Channel power MOSFETs, it's possible to get 25 watts at about 70% efficiency with a good power inductor (it's very difficult). To get past 30 watts, you'll lose efficiency, need a different frequency PWM, or an elaborate/expensive switch.
The Arduino ATMega168 regulates the output voltage. Regulation is important when the output load varys. The software senses changes in the output voltage, and adjusts the PWM to compensate. The output voltage depends on load and input voltage, which are "unknown" variables, so the mathematical relationship between PWM duty cycle and output voltage are "guessed" by the program. If the input voltage and output load were constant, the Arduino analog input wouldn't be necessary. Because of regulation, almost any load and input voltage can be used to make an accurate output voltage.
The program was written for both the ATMega8 or ATMega168. However, the ATMega8 might not work with as many inductors, since its PWM frequency is lower.
Each inductor behaved a bit differently. The ones with thick wire didn't regulate well, and the barrel/can shaped inductors in the top row generally wouldn't go above 24V.
The bottom row has two hand made inductors. One is an aluminum heatsink, the other is a torroid. Two different gauges of enameled wire.
The quarter is there to show the image's scale.
The top two inductors were hand made, but didn't work. The washer had sharp edges that probably scratched enamel off the wire, shorting it. The screw just doesn't have enough turns.
THE #1 RULE: Do not charge large capacitors to high voltages. Capacitors can discharge instantly, and that can be hazardous.
Voltages exceeding 60V may be possible
Assembly
Power Up Check (Don't connect PWM pin 10, or analog in (ADC) pin 0 until instructed to)
Power Down Check (still, do not connect pin 10 or 0)
Operation
Shut off the circuit before touching, removing or replacing components or wires (see above)
Power Up Check Step 3
The voltage wasn't between 0V and 5V
The voltage was 5V
The voltage was above 5V
Power Up Check Step 4
The analog out voltage was above 400mV
The analog out was 0V (or open and floating)
Operation Step 4
The voltage dropped slightly
The voltage increased only slightly
The voltage increased beyond the chosen voltage by more than 1V
Nothing happened; the voltage didn't change
Further Troubleshooting
Different circuit output voltages are off by a relatively constant amount
The circuit has poor regulation, it varys by more than half a volt
The circuit wont generate a voltage above 6V.
---
Created 12/17/2008 by Amp, last updated 2011