Friday, August 26, 2011

Lets Get Programming!

Got the my Pickit 3 to wired up and talking to my chips today.  Wiring was really simple but had a bit of trouble initially getting it to recognize my PIC16F887.  Took me awhile to figure out why I was ID errors trying to connect, but apparently I accidently specified in MPLAB that I was using a 16F877 and not the 16F887.  Also set up using the 16F887 internal oscillator for the first time.

Diagram for hooking up PICKIT

PIC16F887 with simple LED blink test program. 

Thursday, August 4, 2011

5V 1A Linear Power Supply

5V 1A  Linear Power Supply

        Just got through putting together a new 5V supply to use with my digital projects.  The adjustable supply I have is fine, but thought it would be nice to have a dedicated supply for TTL and micros.  Its a simple circuit but I would prefer to not have to breadboard it all the time and have it take up precious work space.  Decided to slap this supply together quickly with some extra parts that I had laying around.

'Parts List'
These are not ideal, but what I had laying around.
click to enlarge
'Schematic for 5V/1A Linear Regulator'
click to enlarge
!note! should have a reverse biased protection
 diode going from Vin to Vreg (pins 1 to 3)



Testing unloaded AC output
 of a transformer.  The grey box is a
little fused AC outlet I built for testing.
       The supply is based off the 7805 linear regulator. (datasheet) It is a simple circuit and the regulator portion was pulled straight from the datasheet.  120V/60hz AC from the wall is reduced down to 10.7V/60hz AC  then rectified through a full-wave diode bridge.  The diode bridge doubles the frequency to 120hz, as well as drops the voltage an additional 1.4V. This signal is then fed into a filter capacitor, which because of the time delay of the charge and discharge, helps to produce an approximate DC voltage level with some ripple on it. This is in turn fed into the 7805 regulator which produces a clean 5V DC on the output.



    A switch and fuse were added to the 120V side of the transformer, as well as a power-on LED on the output which also helps drain any stored up charge left on the large filter capacitor. Wouldn't want the cap to discharge into some circuit after the power is assumed to be off.

Simple block diagram of different stages.
     I used a 1 amp fuse on the 120V side of the transformer cause that was all I had, but I'm pretty sure about a 250mA fuse is needed and here is why. The transformer reduces the voltage from about 120V to approximently 10V for a reduction factor of 12.  (120V/10V = 12)  This means that the amperage should be reduced by a factor of 12 going from the low voltage side to the high voltage side.  So ideally if the regulator can only use 1A total. (I'm not factoring current draw from the caps charging) then the amperage seen from the high voltage side should only be 1A/12 = 120mA.  So am I correct in thinking a 250mA slow-blo fuse would be safe?

Wish I had a working oscilloscope for testing.
Voltage dropped to 4.99V @ 800mA.  
       Although not all the values of the components are ideal, I have tested the circuit up to 800mA and it holds the voltage up to about 4% of a no-load condition.   I didn't calculate the exact value of the filter cap to give 10% ripple, and instead just followed the rule of thumb of 1000uF for every 1A of power.  Initially I was having problems  with the voltage dropping significantly whenever a load of more than 500mA was applied, but it turns out the "unrated" transformer I was using couldn't keep up and was dropping the voltage fed into the regulator to about 6V. The 7805 needs about 2V of headroom to function properly, so I swapped out to a beefier transformer and its voltage fine now.


It was a tight fit with the new
transformer but I got it all in there.
Love me some hot-glue.
        I will probably end up building another 5V supply, but this one will work out fine for now.  I would like to order all new parts from digikey for the build.  There are a couple improvements to add as well, namely using two 1000uF capacitors with a small 2ohm/5W resistor between them. (T-Configuration?)  This will help limit the initial rush of current when filter caps are charging, putting less stress on the entire system.  Also try and get some beefier rectifier diodes and a rated transformer.   I also forgot to add a reverse biased diode from IN to OUT on the regulator to help prevent damage from reverse current flow into the supply. Next time I'll probably build everything on a PCB too and maybe add some transistors to supplement the output current of the regulator.

        All in all the build went pretty smoothly and I finished it in about a day. Originally I was going to have the whole thing built on a single board with "headers" so I could plug directly into a breadboard but I think its better with the banana plug outputs.  Frees up breadboard space, and the plugs will still go directly to the power rails of the breadboard.  It hasn't been used extensively yet, so I'll report back if anything  goes up in smoke.


LED with resistor and wire "heatshrinked"
Using the Dremal to remove metal burrs.