# Voltage regulators a go go

I’ve been spending some of today working on a couple of voltage regulators, so I thought I’d write it up here as it might be useful.

The first one is a simple 12V to 5V linear regulator to recharge various USB devices – the interesting part of this is getting an iPhone 3G to charge with this circuit.

The other regulator is a switching regulator to efficiently step-down high voltages to give me a 5V supply.

Read on to find out the details.

I wanted a 12V to 5V regulator for my solar bike trailer (more on that in a later post). I use the classic 7805 regulator a lot in my projects. Its low cost, easy and robust. Check out the data sheet and millions of examples for the circuit diagram. I use a couple of capacitors to stabilise the input and output voltages, but some folk do not. The USB ports that I used came from a junk box of parts, probably from an old computer. There are two USB ports right next to each other, which was perfect for me.

The parts: 7805 3 pin regulator, 2 x 100uF capacitors, 1 x 100nF capacitor (not used in the end), veroboard to solder the circuit on and the USB ports on a circuit board.

The completed power supply (I added a power-on LED later).

Close up of the circuit.

When tested this gave me 5V to the correct pins on the USB port. I plugged in my phone (a second hand iPhone 3G) and nothing happened. It turns out the Apple in all their wisdom only want you to use their phone charging appliances. A quick google search later and I found everything I needed to solve this issue. It is best explained by Lady Ada here, but basically Apple products also use voltage sensing on their D- and D+ lines (the data lines). The voltage on these lines tells the phone at what rate to charge the battery (depending upon if its plugged into the mains or from a battery source). You need to apply approximately 2.0V to both the D- and D+ lines which will set the maximum rechrge current to 500mA. Using a voltage of 2.8V on the D- line (along with 2.0V on the D+ line) tells the iPhone that it can have 1A, as a mains charger could supply. Lady Ada suggests potential dviders made from 75kΩ and 49.9kΩ. I did not have those values so used 82kΩ and 47kΩ. This gave me around 1.8V on the D- and D+ lines. This seemed to work fine, with 500mA current draw.

Attaching the two potential dividers to the back of the circuit board.

Here is my phone re-charging when 12V is supplied. Great – now I need to install it onto the solar bike trailer.

The second voltage regulator was a switching regulator based upon the LM2574 0.5A step-down switching regulator. I had not used this IC before but, as discussed in my open-design charge regulator prototype page, I was having trouble stepping down from a high voltage with a linear regulator. Linear regulators are not an efficient way of regulating voltage as they must dissipate any excess voltage drop at the supply current (volts x amps = power) and hence they get hot. This IC comes in two versions, the normal one for up to 40V operation and a high voltage version for up to 60V operation (but costing twice the price). I used the standard configuration circuit for a 5V supply (please check the datasheet). It required 2 capacitors, an inductor and a diode. The total cost of these parts is around £2.50.

The parts: LM2574 IC, IC holder, 300uH inductor, 22uF and 220uF capacitor and 1N5819 diode.

The completed 7-40V input, 5V output efficient voltage regulator.

This was tested at 30V with a 5V 100mA load. The input current was around 20mA (not accurately measured) so the efficiency was:

Power in = 30V x 0.02A = 0.6W

Power out = 5V x 0.1A = 0.5W

Therefore efficiency is around 0.5/0.6 x 100 = 83%, which is pretty good and certainly better than the 16% efficiency that a linear regulator would have.

## One response to “Voltage regulators a go go”

1. Great post. Maybe some oscilloscope measurement pictures will be better. Thanks