Class D Amplifier for ATtiny15L

Class D amplifier for ATtiny15LRecently, the widespread use of amplifiers have high efficiency – 90% or more. The sound signal is converted into a PWM (pulse width modulated), which explains their high efficiency, since the output stage while working in a key mode. Modern designs of such amplifiers – a monolithic chip, integrate processor and powerful output stages. Experiment with them, for example, to change the PWM conversion algorithm is difficult.

These units can get acquainted with one embodiment of the amplifier is Class D. Controller ATtiny15L AVR family firm Atmel is perfectly suited for this purpose, because it contains a ten-digit analog-digital converter (ADC) and a timer with a pulse-width modulator (PWM).

ADC reference voltage is selected voltage (register bits ADMUX REFS1 = 0, REFS0 = 0). Signal input of the controller – one of the inputs of the ADC, in this case, the input – 3 (RS 4). PWM output is – OS timer output 1 (PB 1). Auxiliary outputs: RV0 and PB2 commute positive and negative wave signal -, respectively.

For pre-amplification signal required linear gain stage with gain K = 10, and the voltage at its output in the absence of a signal should be half the supply voltage, so the values ​​of resistors R1 and R2 are equal, and the operational amplifier (op amp) TL071 has a large input resistance.

The program uses two interrupts: the timer overflow T1 and at the end of the cycle of the ADC. ADC is configured to equalize the result to the right. At interruption of the ADC result is read into the working registers and shifted one digit to the right, thus, zero discharge of the high byte is the test switching the positive and negative half-waves. Overflow timer is updated contents of the register PWM.

For the signal required to control the bridge output amplifier is designed gate-4 and not (561LA7). The amplifier incorporates composite transistors KT972A, KT973A.

Adjustment of the amplifier should start with the pre-amplifier assembly, first of all, make sure that the output of op amp there is a voltage close to 2.5 V when powered by 5V

The next stage – the firmware of the microcontroller. To flash microcontroller programmer used Tiny15L PonyProg. It is convenient because it requires no additional power source (powered by the COM port of your computer) and does not contain microcontrollers. After programming the controller serve a test signal of 1 kHz from the generator to the input of op amp so that its output amplitude was less than 2 V. The outputs of the microcontroller RV0 and PB2 must be square wave with the same frequency as in PB1 – PWM signal with a frequency of approximately 100 kHz .

Require high sound quality from the amplifier should not be, the controller used in it are not designed to handle the audio signal.

The firmware file is named Amp_t15.hex , the listing file (for fans of programming) Amp_t15.asm .

For writing the program used the standard software from Atmel – AVRStudio version 4.12, the debugging was done using version 3.14 VMLAB.

Download the archive with the files in the format of the scheme PCAD-2002 and firmware of the controller can be here
source :http://www.rlocman.ru

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.