Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

USB Variable Power Supply 5V - 15V



Introduction

I didn't want to buy an expensive variable power supply for my small, low-power projects, so decided to make my own. I couldn't find much inspiration online, so I thought I'd write up my design in detail here in case it helps anyone else. Circuit schematics, layout, source code, compiled hex file and a complete parts list are all provided.

The main features are:

  • 5V - 15V regulated DC output
  • Powered by standard micro USB (phone charger) connector
  • High efficiency "boost" switch-mode power supply
  • Optional built-in output voltage meter with dual-digit display
  • Extremely compact, cheap design
Before diving into the technical detail, here's the finished product:

2014-03-02_10-50-35_933.jpg



2014-03-02_10-38-06_47.jpg


And here is some additional detail of the layout. The "skywiring" next to the dual 7-segment display is a bit cluttered. However, full schematics will be provided below for clarification.

layout.png



Project Constraints

USB chargers are everywhere these days, so I wanted this power supply to take its input from a micro USB connector. Since USB is limited to 100mA at 5V, this would be for low-current applications only (no more than 30mA at 15V). Apart from that, I wanted all other parts to be standard, cheap and easy to solder (through-hole).

I wanted a step-up variable supply able to achieve 5V - 15V output. With minimal modification, this project can be reconfigured as a step-down (providing 0V - 5V variable). For combined step-up step-down, it would need a little more thought.

The main physical constraint of this project was that I was determined to fit the whole thing on the smallest stripboard (Veroboard) type. These have a 0.1" pitch and comprise a grid of just 9x25 holes.


The Power Supply

To keep things simple, I based the boost switch-mode power supply around the cheap and widely-available MC34063 switching regulator IC. The full details of designing this circuit are outlined in this application note: [link]. However, a neat shortcut is to use this nifty design tool: [link].

The values are pretty flexible, so here is my schematic of what I built using bits I had lying around:

boost.PNG


This is actually just a small part of the final circuit. So, if you don't need a voltage display, you can stop after you get this far:

2014-02-05 20.10.37.JPG

Construction Tip

The only difficult (non-through-hole) soldering job in this project is the micro USB connector, which has tiny pins. Since the USB cable will be pulled in and out, the connection of the micro-USB socket to the stripboard needs to be mechanically strong. To achieve this, I decided to solder five standard 0.1" pitch header pins directly to the micro-USB socket casing. Header pins are convenient for doing this, since they are held in the correct alignment by the black plastic holder:

header.jpg


After soldering, you can slide the plastic part off, giving something like this:

micro_usb.jpg


Although soldering the electrical connections is still fiddly, the mechanical connections are now through-hole and very strong.


The Voltage Meter

Hardware


The voltage meter can be built around just about any microcontroller with:

  1. An Analogue-to-Digital Converter (ADC)
  2. At least 9 digital output pins for driving the dual 7-segment digit displays
I only chose to use the PIC16F88 because I managed to pick up a batch of 64 on eBay for £20 a few months ago.

In total, the microcontroller needs to drive 15 LED segments (7 + 7 + one decimal point). This can be done using only 9 output pins by harnessing the magic of multiplexing (switching between the digits so quickly that it looks like both digits are always illuminated). A good discussion of multiplexing 7-segment displays can be found here: [link].

In order to achieve more accurate voltage readings, I chose to add a simple 3.3V external voltage reference for the ADC. I did this using the super-cheap TL431 Precision Programmable Reference IC.

So, putting all that together, here's the circuit schematic:

voltmeter.PNG


You can use just about any dual-digit 7-segment display for this project as long as a decimal point is available. I chose the OSL20561-IX because that's what my usual supplier had in stock and it fits my stripboard perfectly. This is a "common-anode" type device. Of course, a "common-cathode" device is also fine - you just have to wire the control circuitry low-side rather than high-side.

Note: The "Digit Select" circuitry in the schematic corresponds to the slightly cluttered "skywiring" that can be seen in the photos above. The way the corresponding segments of the two digits are wired together is not visible in the photos, so here is a picture for clarification:

skywiring.png


The letters A-F in the picture denote the segment name (see OSL20561-IX datasheet) and dp denotes decimal point.

To pack the transistors into a tight space, I placed their flat edges face-to-face (and top-to-bottom) and wrapped the connecting legs around so they hugged each other. After soldering, they then stay firmly together.

Software

There are a couple of tricks worth noting regarding the voltmeter software I wrote to run on the microcontroller.

Firstly, I used a look-up table (LUT) to make it easy to activate the correct LEDs in order to display the digits 0-9. This table summarises which segments (A-G) need to be activated to display the required digit N (0-9):

Code:
N    A    B    C    D    E    F    G    Byte Code
[HR][/HR]
0    1    1    1    1    1    1    0    126
1    0    1    1    0    0    0    0    48
2    1    1    0    1    1    0    1    109
3    1    1    1    1    0    0    1    121
4    0    1    1    0    0    1    1    51
5    1    0    1    1    0    1    1    91
6    0    0    1    1    1    1    1    31
7    1    1    1    0    0    0    0    112
8    1    1    1    1    1    1    1    127
9    1    1    1    0    0    1    1    115

In the last column, "Byte Code" is the 8-bit number we need to store in the LUT, assuming "g" is bit 0, "f" is bit 1, "e" is bit 2 and so on. Bit 7 is reserved for the decimal point.

A second point to note is that I used basic IIR filtering to smooth the ADC input readings. This helped to prevent the voltage display from flickering between different values. I also used the (filtered) input variance to help determine when the user is actually changing the voltage intentionally. I experimented with a few approaches and stuck with values that worked for me.

I compiled my code using the free HI-TECH PICC (v9.83) compiler. The source code and compiled hex file are included in this attachment: View attachment voltmeter.zip.

Parts List

Almost all of these parts can be changed for similar equivalents. I used whatever I had or could obtain easily. My only recommendation would be to use a good quality inductor, capable of handling several hundred mA maximum current.

Power Supply
  • 1x MC34063 switching regulator IC
  • 1x good quality radial leaded inductor ≥ 500μH (approx.)
  • Capacitors: 1x 470pF (approx.) ceramic, 1x ≥ 470μF (approx.) electrolytic
  • Resistors: 1x 220Ω, 1x 1kΩ
  • 1x 10kΩ potentiometer
  • 1x Diode
  • 1x Micro-USB connector socket
  • 1x small slide switch (SPDT)
  • 7x 0.1" pitch header pins
(Optional) Voltage Meter
  • Any suitable microcontroller (e.g. PIC16F88)
  • DIP18 socket for microcontroller
  • 1x TL431 precision programmable reference IC
  • Any suitable dual-digit 7-segment display (e.g. OSL20561-IX)
  • 1x NPN transistor
  • 1x PNP transistor
  • 1x 100nF ceramic capacitor
  • Resistors: 1x 6.8kΩ, 1x 4.7kΩ, 1x 2.2kΩ, 3x 1kΩ, 1x 470Ω, 8x 330Ω (approx.)
  • 1x Diode
  • (Optional) 2x 0.1" pitch header pins and jumper for enabling/disabling voltage display

Comments

good job,some question to ask:
1.step-down ?(0~5v OUTPUT)
2.How to regulation voltage?
3.output port ? case?
 

Part and Inventory Search

Blog entry information

Author
weetabixharry
Read time
5 min read
Views
2,074
Comments
3
Last update

Downloads

  • voltmeter.zip
    4.6 KB · Views: 1,054

More entries in Uncategorized

More entries from weetabixharry

Share this entry

Back
Top