(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)// ^ID^Component^ebay search^price US$^comments| |**PCB_1** |4 * 3 hole prototype board|10PCS Prototype PCB \\ \\ [[http://www.ebay.com.au/sch/i.html?Prototype+PCB.TRS0=&_nkw=10PCS+Prototype+PCB&_sop=15|AU]] [[http://www.ebay.de/sch/i.html?Prototype+PCB.TRS0=&_nkw=10PCS+Prototype+PCB&_sop=15|DE]] [[http://www.ebay.com/sch/i.html?Prototype+PCB.TRS0=&_nkw=10PCS+Prototype+PCB&_sop=15|US]] |$1.00|You'll need to cut a small piece from one| |**BUZ_1** |buzzer|10pcs 5V piezo Buzzer continous \\ \\ [[http://www.ebay.com.au/sch/i.html?_sacat=0&_nkw=10pcs+5V+piezo+Buzzer+continous&_sop=15|AU]] [[http://www.ebay.de/sch/i.html?_sacat=0&_nkw=10pcs+5V+piezo+Buzzer+continous&_sop=15|DE]] [[http://www.ebay.com/sch/i.html?_sacat=0&_nkw=10pcs+5V+piezo+Buzzer+continous&_sop=15|US]] |$1.20|taken from TX or sourced elsewhere| |**T_1** |Transistor NPN BJT (eg BC848C)|100PCS BC848C SMD \\ \\ [[http://www.ebay.com.au/sch/i.html?_sacat=0&_nkw=100PCS+BC848C+SMD&LH_PrefLoc=2&_sop=15|AU]] [[http://www.ebay.de/sch/i.html?_sacat=0&_nkw=100PCS+BC848C+SMD&LH_PrefLoc=2&_sop=15|DE]] [[http://www.ebay.com/sch/i.html?_sacat=0&_nkw=100PCS+BC848C+SMD&LH_PrefLoc=2&_sop=15|US]] |$1.75|taken from TX or sourced elsewhere. \\ SOT-23 package used in this example| |**R_1** |1 kΩ resistor|100pcs smd 1k 1206 \\ \\ [[http://www.ebay.com.au/sch/i.html?_sacat=0&_nkw=100pcs+smd+1k+1206&_sop=15|AU]] [[http://www.ebay.de/sch/i.html?_sacat=0&_nkw=100pcs+smd+1k+1206&_sop=15|DE]] [[http://www.ebay.com/sch/i.html?_sacat=0&_nkw=100pcs+smd+1k+1206&_sop=15|US]] |$1.50|taken from TX or sourced elsewhere| |**CON_1** |4 pin strip connector|10pcs 40 Pin Strip color \\ \\ [[http://www.ebay.com.au/sch/i.html?_sacat=0&_nkw=10pcs+40+Pin+Strip+color&_sop=15|AU]] [[http://www.ebay.de/sch/i.html?_sacat=0&_nkw=10pcs+40+Pin+Strip+color&_sop=15|DE]] [[http://www.ebay.com/sch/i.html?_sacat=0&_nkw=10pcs+40+Pin+Strip+color&_sop=15|US]] |$1.30|just 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?direct&400x300|h101-tx-salvage-parts-locations.jpg}} === Assembly === These assembly details are courtesy of Markus Gritsch who shared his details [[http://www.rcgroups.com/forums/showthread.php?t=2512604&page=283#post35468916|here]]. The finished item we're describing here will look something like: {{:salvaged_parts_buzzer.jpg?direct&400x400|salvaged_parts_buzzer.jpg}} == Overview == * Assumed input voltage: 3.2 - 5v * Buzzer + (positive) goes to Battery + (positive) * Buzzer - (negative) goes to collector on T1 * Signal (SWCLK or SWDAT) goes to base on T1 via R1 * Battery - (negative) goes to emitter on T1 == Circuit diagram == {{:buzzer1.jpg?direct&|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.}} {{:buzzer2.jpg?direct&|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'' ([[http://www.ebay.com.au/sch/i.html?_sacat=0&_nkw=9012+Transistor+Active+Buzzer&_sop=15|AU]] [[http://www.ebay.de/sch/i.html?_sacat=0&_nkw=9012+Transistor+Active+Buzzer&_sop=15|DE]] [[http://www.ebay.com/sch/i.html?_sacat=0&_nkw=9012+Transistor+Active+Buzzer&_sop=15|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?nolink&400x400}} ===== Design notes ===== ==== Components ==== The resistor and transistor are required in this circuit for two reasons: - 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. - 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|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|http://www.rcgroups.com/forums/showpost.php?p=35893780&postcount=5656]] \\