Table of Contents

(under construction)

Adding a buzzer

The Silverware firmware has capability to add a buzzer to signal low battery and also function as a lost model alarm. This page contains instructions on how to configure the firmware and also how to build your own compatible buzzer.

Enabling in the firmware

To enable the buzzer in the firmware you need to uncomment the BUZZER_ENABLE define in config.h

// uncomment to enable buzzer
#define BUZZER_ENABLE

There are 3 other defines related to the buzzer functionality found in hardware.h

//#define BUZZER_PIN       GPIO_PIN_13 // SWDAT
#define BUZZER_PIN       GPIO_PIN_14 // SWCLK
#define BUZZER_PIN_PORT  GPIOA
#define BUZZER_DELAY     5e6 // 5 seconds after loss of tx or low bat before buzzer starts

BUZZER_PIN - Comment or uncomment the BUZZER_PIN defines to match your chosen hardware configuration (where you want to connect the buzzer to)

BUZZER_DELAY - Set the BUZZER_DELAY to the number of seconds to wait after loss of tx or low battery before the buzzer starts to sound.

Note: the value you choose for the BUZZER_PIN will define how you'll connect your buzzer to the quad. The current options allow you to choose between either the SWCLK or the SWDAT port for the signal connection. (this will become more clear once you're becoming familiar with the hardware and wiring explained below).

Hardware

You can either use a premade buzzer (we'll discuss the different types below), purchase your own components or salvage parts from a h101 (or similar) remote control (TX) to build your own.

Building your own using

You can build your own using either salvaged parts from a spare TX or source parts elsewhere.

Components required

For ebay searches remember to sort results by “Price + Postage: lowest first”. (I'll mention this a number of times, so forgive me)

IDComponentebay searchprice US$comments
PCB_1 4 * 3 hole prototype board10PCS Prototype PCB

AU DE US
$1.00You'll need to cut a small piece from one
BUZ_1 buzzer10pcs 5V piezo Buzzer continous

AU DE US
$1.20taken from TX or sourced elsewhere
T_1 Transistor NPN BJT (eg BC848C)100PCS BC848C SMD

AU DE US
$1.75taken from TX or sourced elsewhere.
SOT-23 package used in this example
R_1 1 kΩ resistor100pcs smd 1k 1206

AU DE US
$1.50taken from TX or sourced elsewhere
CON_1 4 pin strip connector10pcs 40 Pin Strip color

AU DE US
$1.30just snap the required portion off one

Note: for about $6 you'll have enough to build 10 buzzers + a lot of spare “stock” components. I intentionally gave advice to purchase larger quantity than needed as the cost between 1 item and 10-100 is often a few cents. It doesn't make sense to order a single component from ebay. Remember to sort results by “Price + Postage: lowest first”!!

Salvaging the parts from your controller

I'm using a spare Floureon H101 TX to salvage parts so your actual items could differ.

The diagram below shows the location of the three components you need to salvage. This example shows the location inside a Flourean H101 TX. Click on the image for a larger version to see detail.

h101-tx-salvage-parts-locations.jpg

Assembly

These assembly details are courtesy of Markus Gritsch who shared his details here.

The finished item we're describing here will look something like:

salvaged_parts_buzzer.jpg

Overview
Circuit diagram

When the signal from BUZZER_PIN is sent to the Base pin of the transistor, power from BAT+ is allowed to flow through the speaker(+ to -) into the transistors Collector pin and out of the Emitter to GND.

The signal line for BUZZER_PIN is defined in config.h and can be either SWCLK or SWDAT depending on your setup.  Note that H8 Blue boards have their CLK and DAT pins reversed.


Premade Hardware

There are a number of premade options available.

A premade item that matches Markus Gritsch's solution can be found on ebay (or similar) with a search for: 9012 Transistor Active Buzzer (AU DE US), these will cost about US$1.00 each. Remember to sort results by “Price + Postage: lowest first”!!.

Typically they will look like:

premade-buzzer.jpg

Design notes

Components

The resistor and transistor are required in this circuit for two reasons:

  1. To limit the current the pin has to supply (or sink). If the buzzer draws too much, it will destroy that pin's output drivers, and if that pin is also used for flashing, it will no longer be flashable. I see your buzzer specs say <25mA, it is a bit close for comfort.
  2. To provide enough current to produce a loud audible sound - without the transistor it may be too quiet (and risk damage to the output driver).

SWDAT or SWCLK?

Most users of the Silverware firmware install a three pin connector to their board to allow easy flashing. Taking this into consideration, the additional notes by Markus Gritsch explain his choice of SWDAT rather than SWCLK:

Because Vbatt is also necessary on the connector, I replaced my 3 pin programming header with a 4 pin one. Wiring and placement can be seen in the attached pictures.

The feature has to be enabled in config.h. For easier component placement, I used SWDAT instead of SWCLK, so my BUZZER_PIN reads:

#define BUZZER_PIN GPIO_PIN_13 // SWDAT
//#define BUZZER_PIN       GPIO_PIN_14 // SWCLK

References:

Markus Gritsch's original hardware link: http://www.rcgroups.com/forums/showpost.php?p=35468916&postcount=4240

Info for using a continuous beep type buzzer (possibly useful): http://www.rcgroups.com/forums/showpost.php?p=35893780&postcount=5656