|
IntroductionI've seen a lot of comment and recommendations regarding power supplies for microcontroller projects; some of which I don't agree with and is likely the cause of some reliability problems. Below I'm talking about small general purpose micros like PICs and Atmel Chips, mostly operating from 5V and requiring 10 to 50 mA. Some may operate from lower voltages such as 3.3V or 2.5V. The principals are mostly the same. I'm not referring to more complex power supplies such as switchmode and off-line or to larger micro systems requiring multiple supply voltages and/or significantly more current. What is a power supply?So far as I'm concerned here it's a simple source of reliable low voltage power for the micro and associated circuitry. The GoalThe goal is to provide a stable, low voltage supply to the micro. The operation of the micro must not be affected by the power supply. The power supply itself must be reliable and stable. The power supply should not cause problems during development. When testing and developing little accidents happen; the odd short or a wire pushed into the wrong hole. The power supply should be current limited so that little accidents don't do any damage to the parts. I RecommendFor a small micro project, for development and experimenting, use a 12V DC 500mA plug-pack supplying a 3-terminal voltage regulator such as a 78L05 or 7805. The regulator should not be too much larger than you actually need. So, for a 50mA load use a 78L05 which is rated at 100mA but will deliver a bit more. if you need more than 50mA use the larger 7805. Put a series diode in the +ve line before the input capacitor. This protects it when the plug-pack is connected the wrong way round (it happens). The input capacitor should be close to the regulator and at least 100uF at 25V. On the output side of the regulator you should have a 10uF capacitor. If the regulator gets too hot to hold comfortably for a few seconds securely between thumb and finger you need a larger regulator or add a heatsink. Remember, the capacitors must be close to the regulator so don't run long skinny wires from the board to the regulator to get to the heatsink. Remember also to dot a few 0.1uF decoupling capacitors around the circuit. Locate one as close as possible to each major IC, including the micro. If you have a fairly complex circuit or it's a bit spread out, include another 10uF capacitor or two at various positions. Do NotNever use a battery without a fuse; especially a sealed lead-acid battery. Locate the fuse as close to the battery terminal as possible so that it protects the leads a well. Many batteries can deliver large fault currents; enough to damage a lot of delicate circuitry. The fuse will never protect the ICs and transistors but it will prevent things from going bang and flying around the room. The voltage regulator limits the current to the electronics in the event of a fault. Noting protects a fuse like a semiconductor. Do not use a PC power supply to supply 5V or 12V when designing or testing small circuits. True, they are current limited but do you really want 35 amps flowing through your PICAXE chip when you accidentally short something out? PC power supplies don't put out very smooth DC; it contains quite a lot of high frequency noise. A small linear 7805 series regulator will provide a better quality supply to your micro. Do not leave out the regulator in favour of a cheaper series resistor or resistive voltage divider. The power supplied to the micro will not be smooth and reliable. A neat trick:When testing and you don't know what's going to happen and you don't want to blow anything up, connect a small incandescent lamp in series with the +ve supply lead. If there are any shorts or serious faults the lamp will light and protect the circuitry. The lamp size should be chose to suit the expected load. Auto parts suppliers have a good selection of small cheap 12V lamps. Power RequirementsThe micro will require 5 volts DC probably no more than 5 to 50 mA. The associated circuitry may require more current but can generally be run from the same +ve 5V supply rail as the micro. Remember that small micros are mostly CMOS devices and although the average current requirement is maybe a few milliamps, the power supply must be able to deliver peaks of many 10s or even 100s of milliamps for continued reliable operation. Avoid running motor, solenoids, servos, lamps etc from the same supply as feeds the micro. Power supply noise generated by these types of loads can crash the micro. You can often use the same power source but use a second voltage regulator for these other loads. Power SourceThe power will typically come from a mains power supply or batteries. The power supply as a whole can be divided into two sections; the power source and the local regulator. If the local regulator is properly designed and constructed, the power source is not that critical. The power source can be as simple as a AC or DC plug-pack or a transformer-rectifier-capacitor or a battery. You need to supply to the local regulator DC that measures at least 5 volts above the regulated output voltage. I know the data sheets for a typical cheap regulator says about 3V but that doesn't allow for the extra ripple and the odd voltage dips that can occur with load and supply changes. So; for a 5V regulator you should feed it with a measured 10V DC or more. A typical 12V DC unregulated plug-pack will put out 15 to 18 volts with no load connected. The 50mA of your micro and circuitry will pull this down by a couple of volts. RegulatorsThere are various ways to regulate and produce a stable DC voltage. It depends on the application and how many are being made but the simplest is usually the cheapest but also not well suited to development and experimentation. The common 7800 series voltage regulators are reasonably priced and produce simple and reliable power supplies if used correctly. I like the 78L05 for most micro projects. Once your load current gets up over an amp or so all sorts of things happen to complicate the power supply. You have to consider volt-drops and power dissipation and component selection and application becomes much more critical. It's much harder than most people realise to design a long-term reliable power supply delivering more than 1Amp. There are a surprising number of commercial power supplies available that are not quite up to their published specifications and suffer from reliability problems. The 78L05 and 7805 are good regulators for simple micro projects. If a variable or different voltage is required the LM317 is available. These are all linear regulators. They require input and output capacitors located close to the regulator in order to operate reliably. Without these capacitors or if they are too small or to far away, the regulator can oscillate at high frequencies depending on the load etc. The data sheets make recommendations but I've found that a minimum of 100uF on the input and 10uF on the output always seems to work. I also like to include a series diode on the input +ve side. This prevents reverse polarity of the incoming supply damaging the regulator or other circuitry. Usually a common 1N4007. Voltage MeasurementThe problem here is that multimeters indicate only the average DC voltage. They don't tell you the quality of the voltage being supplied to the micro. Even if the meter says 4.9V DC the micro could still be seeing peaks that are many volts higher and dips that are much lower. A micro is quite simple really, it works through a list of simple instructions one at a time very quickly. We know that if only one instruction in the list is messed up it can throw the whole program off course. If it takes 1uS to complete one instruction and your feed the micro with poor quality power with dips and spikes that exceed 1uS in duration, it's bound to go off the rails. The only way to see power supply quality is use a good oscilloscope. Failing that just take all care possible and build a robustly power supply with a voltage regulator. |
The end.