User Tools

Site Tools


misc:hacks:buzzer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
misc:hacks:buzzer [2015-03-16 18:11]
macke
misc:hacks:buzzer [2021-06-24 16:43]
kimberly
Line 1: Line 1:
 +<WRAP center round important 60%>
 +This page has deprecated and will be archived. Please go to [[https://www.bitcraze.io/]].
 +</WRAP>
 +
 +
 +====== Adding a buzzer ======
 +This guide shows how to add a piezo buzzer to a Crazyflie 2.0 prototype deck and control it using the parameters from the Crazyflie Python client.
 +
 +====== What you need ======
 +For this hack you will need:
 +  * Soldering iron
 +  * Piezo buzzer
 +  * [[projects:crazyflie2:expansionboards:proto|Crazyflie 2.0 prototype deck]]
 +  * [[projects:crazyflie2:expansionboards:breakout|Crazyflie 2.0 breakout deck]] (optional, just needed for testing different buzzers)
 +  * Some wire
 +
 +====== Building ======
 +To get extra volume out of the buzzer we will use differential-drive using PWM on two pins, each connected to one terminal of the buzzer. This will give a -3V to 3V swing instead of 0-3V between on/off.
 +
 +The buzzer should be connected to the [[projects:crazyflie2:expansionboards:index|TX2/RX2 pins on the expansion header]] which also has PWM functionality using TIM5 channel 3/4.
 +
 +1) Try out different buzzers using the Crazyflie 2.0 breakout deck and a few wires
 +
 +{{:misc:hacks:cf2_proto_board_buzzer_2.jpg?direct&200|}}
 +{{:misc:hacks:cf2_proto_board_buzzer_1.jpg?direct&200|}}
 +
 +2) Select a buzzer to solder to a Crazyflie 2.0 prototype deck using a few wires
 +
 +{{:misc:hacks:cf2_buzzer_material.jpg?direct&200|}}
 +{{:misc:hacks:cf2_buzzer_proto_bottom_1.jpg?direct&200|}}
 +{{:misc:hacks:cf2_buzzer_proto_bottom_2.jpg?direct&200|}}
 +{{:misc:hacks:cf2_buzzer_proto_top_1.jpg?direct&200|}}
 +
 +3) Attach the prototype deck with the buzzer to the Crazyflie 2.0 with the male headers in the box
 +
 +{{:misc:hacks:cf2_buzzer_proto_top_2.jpg?direct&200|}}
 +{{:misc:hacks:cf2_buzzer_proto_top_3.jpg?direct&200|}}
 +
 +====== Firmware ======
 +In order to do fun things with the buzzer there needs to be some firmware. The firmware can be found on the [[https://github.com/bitcraze/crazyflie-firmware/tree/dev-buzzer|dev-buzzer branch]] in the Crazyflie 2.0 repo on GitHub.  Build the firmware and flash it.
 +
 +The buzzer is implemented in a similar fashion as the [[projects:crazyflie2:expansionboards:ledring|LED-ring deck]]. Using a parameter you can set the current effect of the buzzer. Below is a list of the parameters that are interesting.
 +<WRAP group>
 +<WRAP half column>
 +^  Parameter  ^  Comment  ^
 +| buzzer.effect | Sets the current effect (max buzzer.neffects - 1) |
 +| buzzer.melody | Set the current melody (needs buzzer.effect = 2) |
 +| buzzer.freq | Set static frequency (needs buzzer.effect = 0) |
 +| buzzer.radio | Set the duty cycle (in 8 bits) for the PWM (should be 127) |
 +</WRAP>
 +<WRAP half column>
 +^  Effect ID ^  Comment  ^
 +| 0 | Static tone/ratio |
 +| 1 | Alarm |
 +| 2 | Play a melody (selected by buzzer.melody) |
 +| 3 | Frequency varies with pitch (when above 5 or below -5 degrees) |
 +</WRAP>
 +</WRAP>
 +
 +Have a look in the [[https://github.com/bitcraze/crazyflie-firmware/blob/dev-buzzer/modules/src/buzzer.c|modules/src/buzzer.c]] file for adding new melodies and effects.
 +
 +====== Result ======
 +[[https://vine.co/v/OViKTETHt99|Vine]] (enabling the sound is a good idea :-) )
  
misc/hacks/buzzer.txt · Last modified: 2021-06-24 16:43 by kimberly