This shows you the differences between two versions of the page.
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:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== 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: | ||
+ | * [[projects: | ||
+ | * 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: | ||
+ | |||
+ | 1) Try out different buzzers using the Crazyflie 2.0 breakout deck and a few wires | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | 2) Select a buzzer to solder to a Crazyflie 2.0 prototype deck using a few wires | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | 3) Attach the prototype deck with the buzzer to the Crazyflie 2.0 with the male headers in the box | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | ====== Firmware ====== | ||
+ | In order to do fun things with the buzzer there needs to be some firmware. The firmware can be found on the [[https:// | ||
+ | |||
+ | The buzzer is implemented in a similar fashion as the [[projects: | ||
+ | <WRAP group> | ||
+ | <WRAP half column> | ||
+ | ^ Parameter | ||
+ | | 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 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) | | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Have a look in the [[https:// | ||
+ | |||
+ | ====== Result ====== | ||
+ | [[https:// | ||