MCU Examples.com
PIC Microcontroller Project Examples, free source codes and resources collection.
Here we are working on small microcontrollers like PICs and Atmel series, which are operating from 5V and require less than 100mA for complete system typically. There are some PICs operate from lower voltages like 3.3V, but the principals for power supply are almost the same.
This article covers power supplies with low power output which is suitable as simple source of reliable low voltage power for the microcontroller based projects. If you need currents higher than 1A to operate your circuit, you need high power capable power supply.
When developing circuits unexpected accidents are not uncommon. For an example short circuit due to Solder Bridge or a wire placed in wrong hole are mostly seen. If your power supply is not current limited and has rated few Amps, then these accidents can course severe damages to you and your valuable project. So always using current limited power supply is good idea.
It is recommended to use power supply based on 7800 series regulator for small microcontroller based project. 7805 regulator is widely used cheap and reliable solution which will out put regulated +5V on its O/P terminal. A good power source would be 12V 500mA power pack which is powered by mains power outlet.
The regulator should not be too much larger than actual expected current demand of project. When estimating power, calculate as 5mA for MCU chip, about 3 mA for TTL/CMOS ICs, 10mA for regular size LED etc. Always refer datasheets of your parts to find out their operating standard and peak currents and make power supply rated to peak operating current of project. For a load of 50mA or less use a 78L05 which is rated at 100mA but will deliver a bit more. If you need more than 50mA for your circuit, 7805 regulator can supply about 1A with heat sink on it.
Having series diode in the +ve line before the input capacitor is good idea because this protects power supply when the power-pack is connected the wrong way (it happens quite often during experiments). The input capacitor should be close to the regulator IC and at least 100uF/25V. On the output side of the regulator you should have a minimum 10uF capacitor.
If the regulator gets too hot to hold comfortably for a few seconds securely between two fingers you need a larger regulator or add a heat sink. Remember, the capacitors must be close to the regulator so don't run long wires from the board to the regulator to get to the heat sink.
It is good practice to have decoupling capacitor near MCU and other major ICs. This decoupling capacitor should be 100nF in general. If your circuit is large complex one or has components spared all over the PCB, (or Veroboard or breadboard) include few 10uF capacitors among other components which are tied to +ve and ground lines. This improves power quality and stability all over the board.
Also it is good idea to connect LED through 330 ohm resistor, directly to your power supply out put. When you have connected power-pack LED will lit and indicate you power is ON and will help you to avoid unfortunate accidents.
Refer following circuit schematic to design your power supply. Also if you think it is worth, design small PCB for your power supply board and populate components on it.

Fig.1. Basic power supply design for MCU based projects.

Fig.2. 7805 regulator pins
Never use a battery power supply without a fuse; especially a lead-acid battery. Locate the fuse close to the battery terminal so that it protects the leads as well. Many batteries can deliver large short circuit currents; well enough to fry lot of valuable circuitry and leave burn marks on you. Any way having fuse will not protect your circuit. But will prevent thing going worse.
Do not use a PC AT or ATX power supply to supply 5V or 12V when designing or testing small circuits. In case of short circuit, you will have 35Amps of current flowing, which you should not wish to experience first hand.
PC power supplies don't put out very smooth DC too; it contains reasonable amount of high frequency noise. A small linear 7805 series regulator will provide a better quality supply supplied with power pack will give you more stable and quality power to your project.
Generally CMOS based microcontrollers ask for only about 5mA for it self. But complete project has other elements like resistors, capacitors, LED and ICs. All together project will easily demand for 50mA to 100mA in general. Assuming it does not has motors, relays and servos like devices.
Since most of microcontrollers are CMOS devices they need very small average operating current. In most cases less than 5mA for microcontroller only. But for reliable CMOS based microcontroller operation, we need to feed it with power supply which can supply 10 times or even 100 times more current peaks than normal average case.
There are some types of loads which likely to generate noise in power supply lines. Mostly these loads are inductive and examples are motors, servos, solenoid switches and relays. It is always good idea to supply this type of noisy devices with separate regulator than MCU power regulator. However it is OK to use same power source for both loads. Also this type of loads typically requires much higher currents than semiconductor based devices.
The power will typically come from AC power supply or lead acid batteries which are named as power sources for us. The power supply can be mainly divided into two parts as power source and regulator. If regulator is properly designed and constructed, the power source is not that critical.
Simplest power source is likely to be AC/DC power-pack connected to AC outlet in house. If you supply regulator with this type of power pack, it should supply at least 5V above regulated output.
Data sheets for a typical regulator like 7805 says about 3V above out- put voltage is sufficient as input, but that doesn't allow for the extra ripple and the odd voltage dips that can occur with load and supply changes.
For a 5V regulator you should feed it with a measured 10V DC or more. At this supply voltage if you draw few hundred milliamps current from regulator, you will most likely need a heat sink on your regulator.
A typical 12V DC unregulated power-pack will have no load output of 14V to 18V. Current demand of about 50mA or more will pull this no load out put down by few volts.
The common 7800 series voltage regulators are cheap reliable and simple enough to use in wide range of MCU based projects.
If your circuit consumes more than 1A of current, you have to consider voltage drops and power dissipation. Then component selection and application should be carefully designed. There are large numbers of commercial power a supply available that are not live up to their specifications and comes with reliability problems.
The 7805 is good for simple 5V MCU based projects. If a variable or different voltage is required, the LM317 is low priced alternative to 7805. Also we can find 7800 series based fixed voltage regulators like 7808, 7809, 7812 etc, where two digits after 78 indicates their positive out put voltage. (ex. 7805 > 5V fixed, 7808 > 8V fixed)
7800 series and LM317 are linear regulators and hence they require input and output capacitors located close to the regulator to operate reliably. These capacitors should be used as minimum 100uF on input and minimum 10uF on output as general rule which always give good results. If you don’t have these capacitors or they are too small, output can oscillate in high frequencies which also depend on out put load and some other factors.
For voltage measurement we commonly use multimeters. Actually multimeter does its job and shows us voltage. But what is this voltage? Usually multimeters shows us average for DC input and RMS voltage for AC input.
But multimeters does’t experience power quality and hence we cant get idea about power quality using multimeter only. In reality even if the multimeter shows 5V DC the MCU could still be feeling oscillations of power supply which may have peaks and dips much higher and lower than expected regulated output from regulator.
But how these dips and peaks give us problems? For example let’s take PIC16F84 MCU clocked with 4MHz oscillator. At this speed this MCU execute one instruction in 1uS time. (I.e. one millionth of Second!) If one instruction is go wrong during execution because of power problems, whole program in MCU will likely to go wrong way. This happens when power supply has oscillations larger than 1uS in width for power surges. Remember we clock MCUs with 20MHz and higher rates for practical purposes which give us one instruction execution time 0.2uS or less.
To visualize power quality of your power supply, you should use good oscilloscope. This will show you spikes and dips in your power supply and how long they remain.
So that’s all about power supplies at this stage here. Need more information?