Thursday, June 9, 2016

USB Power Supply

This project began as an idea to build a power supply (to avoid the need to use 9 volt batteries) for the Parallax BASIC Stamp Homework Board. This was for a friend beginning to learn electronics and robotics. He has just purchased a BASIC Stamp Activity Kit - USB (I have the older serial port model) which includes the What's a Microcontroller? text and lots of components for experimentation.

The concept was to use an wall power adapter (sometimes called a wall-wart) with a 9 volt output. I would then remove the end connector and attach instead a 9 volt battery connector. I knew it would need to be wired in a way to provide polarity that "looked" like a 9 volt battery to the Homework Board.

Note that the positive terminal is the small round one, hexagonal is negative
The problem came when I began measuring the actual output of the various wall adapters that I had in my junk box. All of them were supplying 50% to double the stated amount. 

Since the Homework Board has a 5 volt regulator to power the Stamp, attaching more than 9 volts was neither a good idea or really necessary. So, I started looking for power supplies that came closer to supplying around 5 volts...

Then the idea occurred to use a USB cable and charger like for a phone or tablet. They deliver 5 volts at 500 to 1000 mA. A computer USB power supply is toward the low end (about 500 mA) and most chargers to the higher end (1000 mA or 1A. When I measured some of them, thew were right to spec.

So that is direction I decided to try. Below is the build sequence:

1. Cut the USB cable exposing the 4 wires (Black is ground, Red is +5 V).

Here is the pinout for a USB connector.
The Green and White used for communication are not needed.

2. Meter shows the power supply is right on the money!

3. Cut off the Green and White cable wires, and prepare the 9 V connector. Note the heat shrink tubing already placed on the USB cable and battery connector wire (I used one on the red too.)

4. Solder the wires together. Note for proper polarity, the +5 V must connect to the small round terminal and the ground (negative) must connect to the hexagonal terminal. This makes the supply "look" like a battery (the colors are reversed, so it looks like a mistake - double check to make sure! See 9 volt battery photo above which shows the polarity. Heat shrink wire tubing should be in place prior to soldering the connection - cover individually and outside to finish.

5. Solder remaining connection (my iron tip was not as "dull" as it looks. It was properly tinned).

6. Shrink the heat shrink tubing using a hot air gun inside first and then outside to cover.

7. Final test showed just at 5 V and proper polarity to the terminals to match the battery.

8. Oops! 9 volt connector orientation made cable route inconvenient when attached.

9. Folding the cable back around (leaving some strain relief) and using a cable tie place between the terminals secured the cable, provided better routing, gave something to hold on to when securing or removing the connection! A happy accident...

10. The finished power supply cable can be used with USB chargers. Now I want  need to make one for myself! ;-)

The power supply worked great and powered the Homework Board and Stamp perfectly. My remaining concern was whether it would power a servo as required for some of the What's a Microcontroller? (WAM) experiments. Here is a test video with the servo powered from the unregulated connections or Vin. Worked like champ!

Special Note: On the power bus above the breadboard there are connection points for +5 volt (Vdd), Ground (Vss), and the direct voltage of the power source / battery, i.e., unregulated or (Vin). With a 9 volt battery, the Vin would, obviously, be about 9 volts (with my power supply it is 5 volts or the same as the Vdd). This is the only drawback, I have found or imagine for this power supply - so far!

No comments:

Post a Comment