H-bridge motorised volume control

By | December 3, 2013

I came across Ian Johnston’s project to modify a Pioneer surround amp to incorporate a motorised volume control and decided to use his design as the basis for a small project. For his part, Ian hacked his design from parts he had available, whereas my design is fully realised and value engineered.  My main goal was to develop the software, so I didn’t refer to Ian’s code at all when developing my code.

Motorised Volume Control

Here’s the schematic (click for a larger version):


And a close up of the finished board (click for a larger version):

Finished Board

Power Supply

The intention is to use (steal!) a supply from the positive power-amp rail. We could use the supply for the input stage (usually +/- 15V) but it may not be up to the job (not enough current). We need 5V d.c. to power the circuit and the maximum input voltage of a regular 7805 or LM317 regulator is 35-45V.

The power-amp voltage rail can be quite high  (depending on the rated power of the amp). For example, if the rated output is 120W into 8 Ohms, the voltage required is a minimum of 31V (using Ohm’s Law and the Power Law, we get V= sqrt(PxR) = sqrt(120×8) = 30.98V). So the power amp voltage rail will probably sit at 40V+, (allowing for some headroom).

Ian chose to use an LM2575 switching dc-dc converter to get his 5V.  The LM2575 is part of Ti’s Simple Switcher range. They are easy to use and Ti provide an excellent design resource. However, they aren’t cheap.

When I was looking at making phantom power supplies I came across the high voltage version of the LM317 regulator called the LM317AHV. This allows a maximum input to output differential voltage of 60V and as we need a 5V output, the maximum input voltage is 65V, which should be adequate for our needs. It is also cheap and takes up less real estate than the LM2575 solution. As the design has a quiescent current of about 7mA, the regulator does not run hot and the duty cycle is very low – even if you like to fidget with the volume control a lot!


Ian uses an Arduino Nano in his design – and he acknowledges that he uses this only because he had a few available at the time. We are going to be a little more adventurous and use an ATtiny13A – although you could also use an ATtiny13 or an ATtiny25/45/85 in the same circuit. The code compiles to about 500 bytes of executable.


Ian implemented a simple H-bridge using ZVP2106A and ZVN3306A small-signal MOSFET transistors. These are based on original designs by British company Ferranti, which became Zetex, which was bought by the American company Diodes Inc. The ZVP range is the only readily-available small-signal P-channel through-hole MOSFET range on the market and consequently, they are not cheap.  As there is no readily available substitute for the ZVP2106A I have used this in my design. However, the ZVN3306A may be substituted for the much cheaper BS170. I have also substituted the 1N5819 Schottky diodes for BAT42’s which are smaller and less expensive. I also omitted the pull-up/pull-down resistors – more on which later.

Infra Red

Ian uses a Hauppage remote sender/IR receiver in his design. For my part, I had an old Philips remote control to hand and a bunch of IR receiver chips which I had culled from scrap audio-visual equipment, so I decided to use what I had. In terms of having an off-the-shelf plug-in IR receiver option, the Keene Electronics product seems to be the most widely available, so I decided to use the Keene standard (3.5mm stereo jack, Tip = Data, Ring=+5V, Sleeve = GND) but you can always make up your own using a receiver module, screened cable and heat shrink sleeving.

A bit of mucking about with the help of an oscilloscope revealed that the Philips IR handset was putting out 36kHz standard RC-5  code. As it happens, the receiver module I picked at random from my collection is a Vishay TSOP2236 which is also 36kHz, so that was a result.


I decided not to implement a buzzer (piezo peeper), but I did want visual confirmation IR was being received, so I added an LED driven from a PNP transistor on the IR signal from the receiver to the microcontroller. I could have used the microcontroller to generate an LED signal, but it would have meant re-purposing pin 1 (the reset pin) which is a pain when you’re developing code as you can only use ICSP one-time, then you have to use an HV programmer which I don’t have to hand.

Power management

One of the problems of H-bridge design is that you have to be mindful of “shoot-through”, which is where you accidentally switch on (say) Q1 and Q2 at the same time and effectively short +5V to GND. Also, you have to consider providing short-circuit protection for your load terminals. One is a software problem and the other a hardware problem, but the effect is the same – blown transistors and/or blown fuses.

Ian uses two 15 Ohm 2W resistors in parallel to provide a 7.5 Ohm 4W ballast to prevent a short circuit from the supply. He has also prudently added pull-up/down resistors on the gates of his MOSFETs so that they won’t be confused by high-impedance outputs from the microcontroller. Finally, he has allowed for a (1Amp) glass fuse on the supply.

I wanted to eliminate the two 15 Ohm resistors and the glass fuse as they take up too much space on the PCB, so I did an analysis of the design.

If we consider the voltage available from the microcontroller and the switching characteristics of the MOSFETs it turns out that the maximum current this design can deliver to the load is 180 mA or so (360mA total if you had a double shoot-through). Consequently, we don’t need the resistors to limit the short-circuit current in the short-term. And – if we substitute the glass fuse for a 120mA Polyswitch fuse – we can easily protect against medium to long-term short circuits. Finally, a shoot-through event of a few microseconds when the microcontroller powers-up will not be a problem either. Note that if the microcontroller was on a separate plug-in module I would reinstate the pull-up/down resistors as a matter of course.

The only widely available and affordable motorised pots available are the ALPS RK16812MG099 and the ALPS RK27112MC030 designs, both of which use a d.c. motor rated at about 100mA @ 5V in normal operation and 150mA when the clutch slips at the end of travel.


I wanted the challenge of developing the software from scratch, so I didn’t refer to Ian’s code (or anybody else’s for that matter) and developed the IR algorithm from scratch. Here’s the source code.

The algorithm decodes RC-5 with two start-bits and uses a straightforward bit-banging technique. The code should be fairly self explanatory and is written in such a way that the compiler should reduce it to very compact object code. Note that whilst we decode and track the toggle bit, we don’t use it in this application.

The code was developed in Eclipse IDE for C/C++ with AVR-Eclipse and WinAVR plugins.

PCB Design

I designed a printed circuit board for the above schematic. The board is 56mm long and 37mm wide. There are two M3 holes on 48mm centres and the 3.5mm jack is 13mm in from the centre of the left-hand mounting hole. Print the copper @ 600dpi. It is mechanically designed so that if you want, you can drill a hole through the back panel of your amp for the IR receiver to plug directly into the 3.5mm jack, or else you can have a separate jack socket if you need to go to 2.5mm or different wiring convention and connect it via the 3-pin header.

PCB overlay PCB copper

Parts List

Qty Description Value/Part No Manfacturer Alternatives/Notes
1 Polyfuse 120mA holding current – 5mm lead pitch LVR012K Raychem
1 0.25W carbon film or metal film resistor 330
1 0.25W carbon film or metal film resistor 1k0
1 0.25W carbon film or metal film resistor 1k5
1 0.25W carbon film or metal film resistor 4k7
1 Electrolytic cap 6.3 dia x 2.5 pitch 47u/63V
1 Electrolytic cap 5 dia x 2.0 or 2.5 pitch 10u/16V
1 Electrolytic cap 10 dia x 5 pitch 1000u/10V
2 Multilayer ceramic cap 2.5 pitch (one can be 50V) 100n/100V
2 Small signal diode DO-35 1N4148 1N914, BAT42, BAV21
4 Small signal Schottky diode DO-35 BAT42 BAT43, BAT85
2 Small signal P-channel MOSFET TO-92/E-line ZVP2106A
2 Small signal N-channel MOSFET TO-92/E-line BS170
1 Small signal PNP transistor TO92/E-line 2N5401 2N3906
1 Microcontroller Atmel Tiny 8-Pin DIP ATTiny13A-PU ATtiny25/45/85
1 Voltage regulator positive, variable TO-220 LM317AHVT Fairchild Ti LM317HVT
3 2-way 0.1" Molex KK style pin header + shells & crimps
1 3-way 0.1" Molex KK style pin header + shell & crimps
1 3.5mm stereo PCB jack socket AV21208 CPC AKA PSG03613
1 IR receiver/demodulator 3-pin TSOP2236 Vishay 36kHz – select to suit transmitter
1 DIP socket 8-pin
1 LED 3mm (3mm will fit into holes for header) 2V/2mA
1 3.5mm stereo jack plug + cable to make your own IR receiver

No photo’s of the finished board in-situ because I am waiting for ALPS pots to come in from China and – as it’s the holiday season – I decided not to hold my breath waiting for them to arrive…  

Leave a Reply