1
\$\begingroup\$

I've found a usage of a buzzer with volume regulation that I hadn't seen before.

Here's the schematic:

enter image description here

Timers PWM are activated like this (Atmel MCU) :

//off
PORTC.DIRCLR = 0b11110000;

//4k7 + 1k
//Enable Timer B/C
PORTC.DIRCLR = 0b01100000;
PORTC.DIRSET = 0b10010000;

//4k7
//Enable Timer A/C
PORTC.DIRCLR = 0b10100000;
PORTC.DIRSET = 0b01010000;

//1k
//Enable Timer B/D
PORTC.DIRCLR = 0b01010000;
PORTC.DIRSET = 0b10100000;

//0k
//Enable Timer B/C
PORTC.DIRCLR = 0b10010000;
PORTC.DIRSET = 0b01100000;

I've cut the complete code since I'm interested only on electrical side.

Can you explain to me how current flows through it to allow volume regulation?

What is not clear to me is that any way I enable or disable pins (GND or VCC), the current should always flow through lines without resistors and will not allow to power BUZZ in other configurations than:

  • PWM3 +
  • PWM2 +
  • PWM0 -
  • PWM1 -

Maybe I didn't understand the purpose C9 or buzzer principles.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Looks like a capacitance piezoelectric resonator tuned with C and 4 ports to inject different signals 2 of them attenuated. \$\endgroup\$ Mar 25 at 13:45
  • \$\begingroup\$ a poor man 2 bit DAC, maybe? \$\endgroup\$ Mar 25 at 15:19
1
\$\begingroup\$

The code is not setting pins to high or low (VCC or GND), but is instead disabling the output entirely. If you examine the circuit with two pins disabled, neither sourcing nor sinking current, it will make sense.

Consider, for example, PWM2 and PWM1 as outputs and PWM0 and PWM3 as high impedance (for these purposes we can treat them as disconnected). The current must pass through R19, as it can't pass through PWM0. The voltage across the buzzer is decreased as it is effectively forming a divider with R19, and the volume decreases.

If you consult the datasheet for the microcontroller (possibly in the XMEGA line?), you should find a diagram of the GPIO pins, including which registers control them. The code is simply reconfiguring the unused pins to be inputs (disabling the output drivers), and enabling the output drivers that include the appropriate resistors.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.