Homemade Bluetooth Class AB Amplifier with Power Management Automation

    It all started with laziness.
    Or rather, with Vega 50u-122s, inherited along with the acoustics Electronics 25as-033. And at first everything was fine. And then, tripping over a wire, a laptop was killed. After that, a BT module appeared in Vega, and Vega herself learned to turn on by connecting devices to this module.

    Time passed and quality became scarce. Then Vege was the first upgrade. Then the second. Then acoustics. Then ... Then came the understanding that something qualitatively new needs to be done. Well, when Vega began to wheeze and the prospect of completely soldering all the electrolytes loomed ...

    And the construction began ...
    Who is too lazy to read the technical details and just want to see how it works - you can scroll to the end, there is an abridged video version for my channel.

    image


    This is not a story about how to solder this. This is not an instruction: there will be no schemes, there will be no description of settings, etc.
    This will be a story about the ideas and technologies that I use in my devices.
    The ideas that I embodied myself, and which you may want to realize.

    So.

    Basic idea. I want an amplifier. But I do not want to get confused in the wires. This is not convenient and not as high quality as we would like. You need some kind of wireless solution.

    Second idea. I don’t want to run around and poke buttons. Especially if I want to listen to relaxing music before bedtime. Yes, I’m a lazy beast, I want to lie on the couch, press the laptop’s power button and everything turns on and starts playing itself. And when I fall asleep and the laptop turns off with a script - it turned off after him.

    The third idea. Timers. In other words - on weekends I do not turn off the laptop for the night. And this means that if you simply turn on the power on the bluetooth, then the amplifier will be turned on all night. Somehow it's not cool, considering that, firstly, filtering capacitors are worn out. And secondly, it is corny heated and devours electricity.

    The fourth idea. I want an indicator. Big. Beautiful. Indicator. And then I found the IN-33, in the joys of having written the previous article . But not to say that it is big, so a trick was found with a film from the monitor, which visually “bifurcates” the scale.

    As a result , after considering all the ideas, I came to the conclusion that we need to make a new amplifier from scratch.
    A bluetooth module with apt-x was
    image

    ordered : Were orderedready-made AB class amplifiers :
    image

    A gorgeous TOP 200 W was purchased from my grandfather for just 1000 rubles. with finished bends 2x26v and 2x12v. But the rest has already been done by myself.

    Body.

    The case was made 300x300mm, the bottom - a 5mm thick duralumin plate, a P-shaped bent corner 50 * 100 * 5mm is attached to it, to which transistors are attached through silicone gaskets and sets, and on top everything is pulled together by bolts and a 20 * 6mm strip.

    image

    image

    The front panel is mineral glass. Glass was taken from the photo frame for 300 rubles and cut to the desired size with a conventional glass cutter.
    Then silk-screen printing was ordered. Moreover, I recommend not to cut on the paint and still make it with glass paint. Otherwise, it will sooner or later exfoliate and it will be a pity.
    image

    Moreover, I recommend silk-screen printing, because direct printing is garbage. Let me explain:
    Direct printing on the lumen (another project)
    image

    But the silk-screen printing on the lumen:
    image

    The hole for the volume control is simply drilled with a drill on glass.
    Moreover, if you are doing this for the first time, I recommend that you still practice. It is not as fast and simple as it seems.
    image

    Then the sensors. White double adhesive tape was glued to the glass. Then a copper foil was taken, on one side it was sealed with tape, on the other side, a drawing was applied and etched “through and through”.
    It turned out like this:
    image

    Then the foil was removed, everything was washed and it turned out:
    image

    These are ready-made blanks for sensors. Branches were soldered to them and the whole structure was molded on the front panel.
    image

    Precise alignment is important. Because everything should work in the light.
    image

    Further indicator. To “expand” the scale, a prismatic substrate from the monitor matrix was used. And what would she exactly lay down, glued with superglue. Do not spare glue!
    It is important to drive out all the bubbles and apply the film much wider than the indicator itself, otherwise the glue will flow to the back and ruin everything.
    Well, we must take into account that this film “bifurcates” only in one plane, so it is important to maintain the strict horizontal prism of the film.
    image

    On this, if everything is highlighted from the inside, it will turn out something like this:
    image

    But making equal illumination of characters is not as easy as it might seem.
    The fact is that if you just take the LED and start to shine, then the light also illuminates part of the icon. It looks ugly. Moreover, if in the gloom it may still seem that everything is not bad, then in complete darkness there will be a mass of jambs of illumination. Annoyed.

    The solution is this:
    The foil was taken, twisted into a cone:
    image

    Then hot-melt adhesive was heated. I liked the iron for that, although my wife did not share my joy ...
    image

    Then it was poured and cut to the size of the highlighted icon, a recess for the LED was drilled on the back side.
    image

    Well, it stuck. I glued superglue. But then I thought that it would be better just to heat the glue of the cone and stick it directly on it.
    And small gaps between the foil of the cone and the foil of the icon were sealed with putty and painted over. Putty - so that the paint does not flow between the filter and the sensor. After installing the LEDs of the icons, they were painted over from the end. Only in this way was I able to completely get rid of third-party covenants.

    According to the scheme.
    I'll start with the power supplies. Their 2.

    The first is a power supply unit, not voltage stabilized. A block of electrolytes shunted with 0.33 μF film and 1 μF ceramic was assembled according to the scheme with 2 separate diode bridges, each arm with 33 volts constant and 3 × 10,000 microfarads. Also, the transformer windings themselves are shunted with 1uF ceramic.

    Power wiring: from the transformer to the bridges 2.5mm ^ 2, from the bridges to the blocks of capacitors - 4mm ^ 2, from the capacitor blocks to the amplifier plan 6mm ^ 2.

    The second is on duty. The bluetooth module board must be constantly powered, so that you can always connect to it. Well, what would you understand that they connected to the amplifier and turn on the main power - you need to power the controller board. Therefore, the standby unit is low-power and pulsed. They just took charge from the asus eee. Moreover, the analog part, namely the bluetooth module, is powered through an additional linear stabilizer.

    Amplifier boards also had to be completely re-soldered. One board was still nothing, but the second was soldered simply obscene. + additionally proludil power paths.

    As the central "brain" was selected STM32. In principle, I could use arduino on an AVR, but megas have, firstly, few legs, and secondly only one ADC, which is why the indicator does not work well. The fact is that while we are digitizing one channel, the sound is changing in both, and by the time the second is digitized, the difference is already quite large. It catches the eye and wanted to avoid it. Therefore, STM32.

    The indicator diagram is not much different from the diagram from the previous article (by the way, no one seems to have noticed the error in the diagram, but oh well).

    Control.
    We needed touch keys. Having rummaged in articles about the sensorics for STM32, I found several options that I was not happy with.
    Firstly, I did not understand anything)))
    Secondly, I needed 5 buttons. Yes, and what would it work through 3 mm mineral glass.

    As a result, I had to taste the principle, experiment a bit and got the following code:
    Sensor Read Code
    //Чуствительность
    #define SenseMinLevel 100
    //Пины
    #define ButZ GPIOA, GPIO_Pin_10
    #define BtnOn GPIOB, GPIO_Pin_15 
    #define BtnOff GPIOA, GPIO_Pin_8
    #define BtnAuto GPIOA, GPIO_Pin_9
    #define BtnBT GPIOA, GPIO_Pin_3
    #define BtnRCA GPIOA, GPIO_Pin_2
    //Значение автокалиброки
    volatile uint16_t CalibrateTimeB1 = 0; 
    volatile uint16_t CalibrateTimeB2 = 0; 
    volatile uint16_t CalibrateTimeB3 = 0; 
    volatile uint16_t CalibrateTimeB4 = 0; 
    volatile uint16_t CalibrateTimeB5 = 0;
    //Возвращает код нажатой кнопки
    uint8_t SenseButton(void)
    {
    		uint16_t m;
    		uint16_t b1 = 0; uint16_t b2 = 0; uint16_t b3 = 0; uint16_t b4 = 0; uint16_t b5 = 0;
    		for (m = 0; m < 21; m++)
    		{			
      			b1 += scan_sense_pin(BtnOff);
    			b2 += scan_sense_pin(BtnOn);
    			b3 += scan_sense_pin(BtnAuto);
    			b4 += scan_sense_pin(BtnBT);
    			b5 += scan_sense_pin(BtnRCA);
    		}
    		if (CalibrateTimeB1 == 0)
    		{
    			CalibrateTimeB1 = b1;
    			CalibrateTimeB2 = b2;
    			CalibrateTimeB3 = b3;
    			CalibrateTimeB4 = b4;
    			CalibrateTimeB5 = b5;
    		}
    		else
    		{
    			if (b1 > CalibrateTimeB1)	b1 -= CalibrateTimeB1; else b1 = 0;
    			if (b2 > CalibrateTimeB2)	b2 -= CalibrateTimeB2; else b2 = 0;
    			if (b3 > CalibrateTimeB3)	b3 -= CalibrateTimeB3; else b3 = 0;
    			if (b4 > CalibrateTimeB4)	b4 -= CalibrateTimeB4; else b4 = 0;
    			if (b5 > CalibrateTimeB5)	b5 -= CalibrateTimeB5; else b5 = 0;
    		}
                    //Сравнение с калибровочными уровнями
    		if (b1 > SenseMinLevel || b2 > SenseMinLevel || b3 > SenseMinLevel || b4 > SenseMinLevel || b5 > SenseMinLevel)
    		{
    			if (b1 > b2 && b1 > b3 && b1 > b4 && b1 > b5)
    				return 1;
    			if (b2 > b1 && b2 > b3 && b2 > b4 && b2 > b5)
    				return 2;
    			if (b3 > b1 && b3 > b2 && b3 > b4 && b3 > b5)
    				return 3;
    			if (b4 > b1 && b4 > b3 && b4 > b2 && b4 > b5)
    				return 4;
    			if (b5 > b1 && b5 > b3 && b5 > b4 && b5 > b2)
    				return 5;
    		}
    		return 0;
    }
    uint16_t scan_sense_pin(GPIO_TypeDef* port, uint16_t pin)
    {
    	uint16_t ret = 0;
    		GPIO_ResetBits(ButZ);
    		delay_t(1800);
    		GPIO_SetBits(ButZ);
    		while (!GPIO_ReadInputDataBit(port, pin) && ret < 500)
    		{
    					ret++;
    		}
    		GPIO_ResetBits(ButZ);
    	return ret;
    }
    void delay_t(uint32_t ms) {
    //        nCount=(RCC_Clocks.HCLK_Frequency/1000)*ms;
    //        for (; nCount!=0; nCount--);
    	for (; ms!=0; ms--);
    }
    



    Where - ButZ - seed pin, in GPIO_Mode_Out_PP mode, the rest - reading in GPIO_Mode_IN_FLOATING mode.
    The idea is simple. All sensing sensors are connected to the seed pin through a 3MΩ resistor. Next, we give a unit to the seed pin and see how long it will take to charge up to the logical unit of the sensor pin. If it’s longer than the calibration time, it means you have to charge your finger, leaning against the sensor. So - there is a touch to the sensor.

    Operating modes

    There are three of them.

    First - Just off. And that’s it.

    The second mode is continuous inclusion. In this case, the amplifier always works. However, in the case of downtime without sound, after a minute the level indicator turns off.

    The third is "A". But this is the main mode, automatic. If a bluetooth input is selected, the amplifier turns on and off by connecting a sound source. But if the device is connected and does not play, after 15 minutes the amplifier will go into sound standby mode. And, of course, if there is no sound for a minute, the level indicator turns off.

    Moreover, it does not matter which audio input is used - be it bluetooth or an external RCA input.

    In general, everything else is standard. The volume knob is just a variable resistor. Just because the main volume control is supposed to be on a laptop and no one will go to the amplifier for this.

    The result is beautiful. And it doesn't sound bad!

    Video:

    Also popular now: