Sunday, April 22, 2012

Voltage box

Voltage box sans labels

As described in my last blog post I decided I needed a small hand held variable voltage supply box. The output voltage would be in multiples of 1.5V to match the various multiple AA/AAA battery combinations. Also I would also want 3.3 and 5 volts outputs. The entire thing would be powered by a 9V battery if possible with maybe the option of a DC input.

The basis of the design is a LM317 voltage regulator. Since the output voltage is determined by a resistor ratio it would be simple to use a rotary switch to swap what resistor was used. Thus the output voltage could be changed and to a fixed value. I didn't want to use a variable resistor as I would need some kind of output screen to show what the output voltage was currently. Originally I was going to use a single pole switch (limited to 6 positions). However that changed later as the design evolved.

Using the LM317 was quite simple. Following the datasheet I added the various recommended filter capacitors and protection diodes and tested the circuit on a breadboard. Using the output voltage equation from the datasheet I determined what resistors would be needed for the output voltages of 1.5, 3, 3.3, 4.5, 5 and 6 volts. Not all the values were "standard" values but most were available. My aim was to be within 5% of the desired voltage.

Now that I knew the resistors needed it was time to go shopping to Jaycar. For a case I used the remote control case (Jaycar part HB5610) as it had a battery access port built into the case. A 9V battery fits in but is a tight fit and needs a bit of wiggling to get the battery cover on. Although I don't normally use binding posts I wanted some on this project to future proof it. The standard way of connecting this project will be via a 2 pin molex connector exactly the same as my previous variable resistor box was setup. This also allows me to reuse the same cables. I might even go back to my variable resistor box and put on binding posts there too.

While doing the breadboard design it occurred to me that having an led light up as each voltage was selected would add a nice bit of bling to the project. Much better than just a sticky label, I would have six leds and as each voltage was selected the appropriate led would light. To enable this I changed the rotary switch to be a 2 pole 6 way type. The original 1 pole 12 way switch went into the parts box. I would use a 5mm red led for the power light and 3mm green leds for the voltage selection display. I like big obvious power lights.

Needing a way to secure the leds to the case I considered hot glue but I don't like this. Wandering in Jaycar again I came across some 3mm and 5mm led bezels. Very nice and they give a nice clean finish. However when I got home I obviously had this idea previously as I already had some in the parts box. The disadvantage of doing projects very occasionally is you forget what you have in stock at home.

After machining the case for the components I had to fit in all the components on a prototype board. Due to the rotary switch and binding posts I lost approx. 50% of the space in the case. All the components fitted but were rather tight. Also having the circuit board on the bottom of the case and the rotary switch and power switch on the top of the case made the construction harder than it needed to be. I needed to keep the wires short so they would fit once the case was closed but long enough so I had access to solder the connecting wires. The six green leds connecting to the rotary switch needed the most fiddling to get them to fit and not take up too much room as the leds were 10mm away from the rotary switch.

Everyone says not to do work when you are tired. I wouldn't but I'm never not tired or sick or both. The joys of young kids. So as expected a few mistakes were made. Some were simple like forgetting to connect the output terminal to a binding post. The worst was when I connected the green led power line directly to the 9V rail, not the 2.2K current limiting resistor. On power up the green leds were either not working, really dull or bright orange. I switched between the 6 leds a few times before powering off. Then I discovered what I had done. Three out of the six leds were burnt out. Much painful unsoldering and wiggling components out of the way resulted. It was during this work another issue was introduced that I discovered later. I also looped the battery cables around a screw inside the case to provide strain support in case the 9V connecter was jerked out to far.

Closing the case up however one of the green leds turned off. Open the case, it turned back on. There was only .5mm of difference when putting the case together between the led working or not. So some joint was flexing and disconnecting. This led was also one of the ones that had been swapped out earlier. A few prods with the soldering iron fixed the dry solder joint on the led. The tight access from the short wires made access a bit of challenge.

Finally everything was together and working. The kids love the leds and my son keeps trying to turn off the red led by pushing it like the switches on some other household items. A bit scary to see in a one year old the learnt response that a red led is a power switch. I just need to make up some labels.

Enough time wasted on little projects. Time to get back to my second mini sumo bot.