This project is documented in the project logs. A handy index with links:
Modifying and building out a low cost TPA3116 class-D amplifier board with bluetooth
This project is documented in the project logs. A handy index with links:
Overall the project was only a days work, low cost mostly using parts I had on hand. The result works great, with amazing sound and power for such a tiny amplifier. My intended use is to provide portable well distributed sound in a conference room and it will work perfectly. The amplifier, power brick, all 4 speakers, 200ft speaker cable and 50ft extension cord all fit within a 16x10x5 box. The issues with speaker pop and bluetooth sounds can be avoided using the volume knob, turning it down when powering and connecting, turning the source to max, then using the volume knob to adjust.
There a a number of things I might do in the future.
Antenna. I might look into putting a better antenna on it to increase the range.
External input. I'd like to have a line input so that it could be used without bluetooth if possible. It wouldn't be hard given the volume is inserted at a line level, would just need to switch over it's input and AC couple the line.
Auto muting/anti-pop. In thinking through how to deal with some of the issues, I realized I could add an output relay so that the speakers are disconnected before the power goes off, and connected after a delay upon power up. This circuit wouldn't be difficult and would eliminate the pop and connecting tones(if connecting right away).
Volume pot. I think the slight hiss at loud volume would reduce if I changed the pot out for a 1k device.
Power switch. In some use cases this might be handy, especially if I make a battery powered version.
In testing, I've found it quite handy to have this little amplifier and have been thinking about building a bracket that would hold the amplifier, 2 of the speakers and a battery pack all together. The result would smaller than a shoe box, and yet much more powerful than most on the market. Given that it works fine on 12V, I would probably use a 4S hobby battery pack which could easily have a very long run time given how little power this uses.
For a case, I needed something plastic in order to allow the internal bluetooth antenna to work. I ended up using a small Linksys router I thrifted for $2.
I selected banana sockets for my output terminals, and mounted them on one edge, 0.75" center between +/-, and 1.0" between the pairs. This spacing is to allow a dual plug to be used, but also to prevent a dual plug from accidentally bridging between the channels. These sockets have a double-D shape to prevent rotation and a nut. I used a rotary tool to cut these slots, and mounted them. (picture taken at the end)
Note that the negative output is not ground as the speakers are driven with an H-bridge circuit.
To make it fit in the case, I mounted the volume knob along another side. I intentionally left space for a switch and line input if I ever wanted to add those in the future. (I wanted to, but don't want to spend the time right now) There is a small plastic frame on this side which used to frame the ethernet jack. I cut a rectangular "washer" to fill over this space using galvanized sheet steel. This was later epoxied onto the plastic to make it easier to get together. Drilling the hole in a strip of thin metal like this required sandwiching it between two pieces of wood and drilling all the way through so that the bit didn't grab and rip the steel.
The potentiometer simply went through the hole with a nut holding it in place from the outside.
The case didn't have any screw bosses that I could use so I needed to come up with my own way of holding the board in. On one side, the board could lay on a shelf which was held down by the other case half. This would allow the DC jack on the amplifier to be at the edge of the case so I wouldn't have to relocate it, simply cut an opening.
However the other side was still floating. I cut some hooks out of the plastic from a different router and glued them into the case. This allowed the board to be slid under those hooks and layed down oh the shelf on the other side.
The amplifier has two LEDs on it. The Blue one, D2, flashes 3 times about once per second when a bluetooth connection is made. The Red one, D3, flashes 2 times about once per second when a bluetooth connection is lost(only after it was initially made). After power up and before any connection is made, they will rapidly flash alternately. As they are handy, I wanted to be able to see them on the outside as well. Instead of desoldering them and moving them, I just left them on the board, and paralleled additional LEDs. Note that they are not paralleled across the LED itself, but instead, a new LED and new resistor were paralleled across the original LED+resistor. Looked at another way, I tombstoned a new resistor on the 3.8V rail(where the original LEDs were powered from), then ran a wire from that resistor to the LED, and back to the BTM825 pin.
I chose to use a dual color red/green led I had from stock, connected to both the board blue and red. I also added a green led which was simply powered from the 3.8V rail to ground to act as a power indicator.
The router case already had light pipes to direct the on board LEDs out the front. They were long and curved, and I had cut them off in order to fit the amplifier board in the case. I used a small sanding disk to sand the edge flat and then glued the LEDs down to the surface which worked great.
Here is all the modifications done and everything installed
I drew out the parts of the schematics that I needed.
The audio path between the BTM835 and the amplifier:
This is one of the two channels. As described before, the circuit takes the differential output of the BTM835, AC couples it to bias to 6V common mode, and converts it to single ended with some gain through a NE5532 opamp. The output, also biased at 6V feeds into a capacitor before the amplifier. If it is truly using a TPA3116, AC coupling like that is required as the amplifier provides it's own bias of 3V.
The output of the opamp I measured up to about +/-0.75V (measured AC mode to remove bias), so is pretty much line level. This means that non-populated connector could be used as a line out, as long as it is AC coupled first to remove the bias.
Conveniently this means there is an easy way to insert a volume potentiometer in the path.
But why is the audio biased at 6V you might ask? By doing this, the designer could keep the audio directly in the middle of the opamp range, while only using a single polarity power supply.(that is, the opamp is powered by +12V/Gnd and not say +6V/-6V)
The power supplies relevant in this circuit:
A simple 7812 linear regulator is used to provide the 12V rail for the opamp, but also for generating the 6V bias. The 6V bias is simply created with a voltage divider, so is not suitable for providing significant DC current. It does have substantial bulk decoupling, 220uF, so can provide plenty of power at audio frequencies.
There is also a 3.8V linear regulator which powers the BTM835 and the LEDs. I couldn't identify the SOT23 part, but it should be a linear as there are no coils.
Knowing this circuit, we can understand more about the input voltage. The module is labeled 12V-24V. The 24V max is sensible given the TPA3116. But I would have expected the minimum to be closer to 14V as the rail is used through a (non-LDO) linear to create 12V. In the end, running it at 12(and lower) will work, it will just change the circuit as the opamp will then run around 10, and the audio bias around 5.
I did test this with input voltages as low as 11 to work fine as I might want to battery power the module in the future.(4S lithium ion modules are much more common than 5S or 6S) In testing, current stayed below 100mA until the volume started getting pretty loud. It wasn't until near maximum(too loud for me in the same small room as the speakers) that the current went about 1A, with the highest peak I saw around 4A.(I did not use a scope so didn't catch quick pulses very well) Partly because of the low current draw, I decided not to add any additional input capacitance as the amplifier already has 6*330uF caps across the rail. If running the amplifier near it's max, it might help to add some more, but I would recommend doing some testing first to see what voltage drop you have from your supply and how high the currents peak.
I initially tested with a regular 1k pot and it worked great.
I switched to a stereo/dual audio taper potentiometer as a volume control. I didn't have many audio taper stereo pots in my stock, and initially used a 50k one. This worked, but increased hiss, and was more subject to 60hz hum. I switched to a 10k one which improved the situation, removing noticable hum, and reducing hiss down to a low level. The hiss and hum was mostly when the pot was set away from the ends, so it seems the amplifier doesn't want an input impedance this high. A 1k would have been much better if I had one or was purchasing one.
I wired this into the schematic like this:
This is one of two channels shown. Notice that the other end of the pot(CCW rotation) is connected to 6V, and not ground. This is because at this point in the circuit, it has a 6V common mode. If I were to connect it to ground, excess DC current would flow through the...Read more »
The module is intended to have volume adjusted on your playback device, so does not have a volume control directly on it.(the buttons just send a signal back to your phone to adjust it's volume) The bluetooth module puts out a beep every time you adjust the volume. I intend to use this a room sound which will be faded in and out, so those beeps are not workable. Combined with the bluetooth connecting sound and the speaker pops when powered on, I decided that the simplest solution would be to insert a volume control into the audio path. This would allow me to just turn it all the way down when connecting, and then do my fading with the knob instead of my phone.
I knew from the product picture and the information I could find about the components, that audio comes from the BTM835 module, through capacitors and into the TPA3116 chips. I figured I could just insert a stereo potentiometer between those. One concern I had was that the audio was differential. To proceed, I needed to trace out a bit of the schematic from the board.
The output of the BTM835 module is indeed differential, and all 4 of those lines go through capacitors. However, the other side of those capacitors do not go directly to the TPA3116. Instead, they are fed into a dual op-amp, which is providing some gain, but also converting the single to single ended. This circuit is powered from a 12V LDO(which means it'll run lower if the main input is 12V), with the audio biased to 6V so a single ended supply could be used. I am not sure why they convert the audio to single ended, given that the TPA3116 has a differential input(which can be used single ended. Perhaps the output of the bluethooth module was not enough, though with a configured op-amp gain of only 1.3x, I'm surprised.
The output of the op-amps go to the not populated connector marked L - GND - R, and then under the heatsink. I can see the traces connect to some ceramic capacitors, but I cannot confirm if they connect elsewhere.
Measuring the output of the op-amps with a scope, I saw that the audio gets to about +/- 750mV, with a 6V common mode. This 1.5Vp-p is pretty much line level, though the 6V common mode offset means it wouldn't be a good idea to directly use this signal as a line out from the bluetooth receiver.(though could be fed through capacitors to go out)
The end result of this is that I can easily install a potentiometer as a volume knob, after the op-amp. I separated the op-amp output from the amplifier input by cutting the bottom side traces. Given the 6V common mode, I wired one end of the pot to the 6V rail, the other to the op-amp output and the wiper to the amplifier input.
I did some initial testing with the amplifier board, wiring in some speakers on the bench to run the amplifier through it's paces.
The board is a simple 2 layer design with most traces on the top side.. There were some lose solder balls on the board, so the quality is not the best. The first board I got had the ferrite broken on one of the inductors, but the replacement was fine.
Speaker outputs have screw terminals and are labeled.
DC power input is labeled 12-24V with a barrel jack. While not labeled, it is center positive.
There are 3 tact switches for bluetooth control.
In theory the board is based on a pair of TI TPA3116 class-D amplifier chips, each doubled up to provide a 100w channel. I did not pull off the glued on heat sink to look, so I can't guarantee they are genuine parts, but it seems to work pretty good. The output is very powerful given how little power this module takes, barely getting warm. There is some hiss when there is no signal source, pretty typical for low cost consumer audio.
The Bluetooth interface is handled through a BTM835 bluetooth module which is soldered on the board. I couldn't find much information about the module, except for this document which I think was part of a legal filing. It at least includes a pinout, and seems accurate.
The range is not the best, as indicated in some of the product reviews. I could always maintain a solid connection with my phone within about 16 feet. Past this, connection depended on who or what was in between, and other factors I couldn't be sure of. Sometimes I could maintain a connection through walls and people about 30ft, other times it broke up around 16. I may try to connect in the wifi antenna in place of the PCB trace antenna on the module, but that may be more than I want to put in the project.
The play pause button worked as expected. The skip back/volume down button and skip forward/volume up button were different. pressing and releasing causes a track to be skipped. Holding the button for a second changes the volume.
When powered on or off, there can be notable speaker pops, which is not good. I will need to see what can be done about this.
With the bluetooth interface, it will play a connection tone when it is initially made. This is fairly loud, much more than one would want. This complaint can also be see in product comments. When adjusting the volume from my phone, there were also beeps each step. While I can see the desire here, to offer feedback, they can be annoying, and won't work for my application of setting up audio for a room. These will also have to be worked around.