Introduction
Some time ago, I had to replace the volume pot/power switch in my Creative computer speakers.
Unfortunately, they use a non-standard pot with a switch, and I didn't bother finding a proper replacement, just did a quick fix with a generic pot and switch.
It worked well, but looked bad. So now I decided to repair it properly and put everything back together, while I'm working on it, might as well mod it a bit...
The volume control PCB and my quick fix |
At first I just wanted to add a rotary encoder instead of the volume pot, but if I'm going to put a microcontroller inside I might as well add some more features, so I grabbed an LED and a Bluetooth module and got to work...
Hardware
Here's a list of hardware used in this project:
- Creative 5.1 speakers
- TPL0202 digital potentiometer
- Rotary encoder with switch
- ATmega8A
- RGB SMD LED
- BTM-5 Bluetooth SPP module
Basic diagram of the project |
Speaker PCB
The original volume/power/bass control PCB is very simple, just two pots, two jack sockets, some resistors, cable connector and an LED.
The main speaker unit supplies 5V to this board, and the speakers are turned on when this 5V is applied to one of the pins.
Unfortunately I have overestimated the power of of that 5V source and so my modification requires an external 5V power supply, but that's no problem.
There is not much I had to do to the PCB, just removed the pot, removed the green power led, changed some resistors (because the original pot was 50k and the digital one is 10k) and cut out some more room for the rotary encoder.
Digital potentiometer
I'm using a TPL0202 digital potentiometer from Texas Instruments. It has two outputs, 256-position resolution and is controlled via SPI.
The chip is QFN16, but I have somehow managed to solder it (after a couple of tries :P) onto a home-made PCB using hot air.
Rotary encoder
It's just a 20-step encoder with a button. The button is used for a couple of functions. Firstly, it is used as a power switch. Secondly, when the button is pressed while turning the knob, the volume is changed in more precise steps. And lastly, when pressed during power-up, it causes the chip to enter the bootloader (yes! wireless software update!).
The shaft of the encoder sticks out higher than the original knob, but instead of shortening it, I've decided to make the knob a little taller (with a piece of PVC), so there is no gaping hole and it is easier to manipulate.
The microcontroller
The ATmega8A is the best chip ever, costs less than $1 and has so much to offer.
Here's the schematic:
Schematic of the microcontroller part |
I've uploaded a serial bootloader to the chip, which allows me (thanks to the Bluetooth SPP module) to update the firmware wirelessly (trust me, I'm not opening that case ever again ;P).
RGB LED
Every project needs blinkenlights! I used a cheap SMD RGB LED, controlled with software PWM by the uC. It lights up when the speakers are turned on and shows the current volume in color (pink means 'ear damage imminent').
Bluetooth module
The module I'm using is a BTM-5 SPP module. It acts as a UART-Bluetooth bridge and works automatically and transparently. It's the easiest way to add wireless connectivity to your project.
You can get one of those off ebay for less than $10.
The communication protocol is just a couple of short commands sent over UART to the chip, for example: 'on', 'off', 'get' (get the current volume), 'v099' (set volume to 99).
Software
I wrote the uC firmware in C, compiled using avr-gcc of course, and a simple GUI application in PyQt.
Head over to GitHub for the sources:
https://github.com/Emeryth/avrdigipot
Putting it together
Here's some crazy kynar soldering action. I've managed to squeeze everything back into the original case, although I didn't tighten the screws all the way in. :P
All the components in place |
At this point I though the soldering was over... (spoilers: it wasn't) |
Conclusions
It works!
I can finally control my speakers without getting out of bed.
The clicking action of the rotary encoder is very nice, at last I can set the volume precisely, without fiddling with the pot.
It was a simple project in theory, but getting it done proved much more difficult.
I'm glad it works and that I've managed to make it look presentable (unlike some of my other projects).
Wow this looks really nice... ! I know what you mean by "simple in theory, but difficult to be done", I get this all the time with my projects ! :)
ReplyDeleteDan
http://trandi.wordpress.com
Crazy Clever. Think I would have been tempted to go for broke and simply replace the entire enclosure with a featureless plastic box and gone to ONLY bluetooth control...but that's just me extending on your great idea.
ReplyDeleteAwesome solution.
Awesome. How much trouble would it be to actually stream audio to that control pod? Would you have to have any processing done on the actual pod itself or could you just send the song over the bluetooth?
ReplyDeleteI think when pressed during power-up, it causes the chip to enter the boot loader. It's very informative article which i really like it.
ReplyDeleteFor anyone just looking to repair their volume knob - here: https://www.aliexpress.com/item/5pcs-Straight-Angle-Radio-Potentiometer-RV12MM-B503-B50K-Power-Amplifier-Volume-Potentiometer-With-Switch-Free-shopping/32905164338.html?spm=a2g0s.9042311.0.0.6d094c4dvMzyWr
ReplyDeleteIt works flawlessly - exactly as it used to ;)