Close

Building more pieces of the circuit: adding buttons and piezo speaker

A project log for TrinketPro Movement Alarm for Bag Theft Prevention

A portable, battery powered device that sounds an alarm when your bag is moved. Once armed, can only be turned off by your secret code.

makerselfMakerSelf 12/16/2014 at 04:440 Comments

For this project, I need to have a secret security code that can shut off the alarm. I wanted to have this be very simple, so just use a multi button interface. For the project, I decided to chose 4 buttons.

So I built on top of the power circuit I wrote about in the last project update, to add both the buttons and the speaker.

To add the buttons, I connected one side to the positive power rail through a resistor (1K), and the other side directly to the ground rail. If I connected it the other way (through a resistor to ground, and the other side to the positive rail), then the ground would be connected to the board through the resistor, and it would turn on before I wanted it to (before the power button had been pressed). I also put in a 47k resistor between the button and the input pins on the board, as otherwise the code buttons would be able to turn the board on (I want to only be the power / arm button that does this)

To add the speaker, I utilized a 2n3906 transistor, with the base connected to a PWM output pin via a variable resistor (I used a 100k pot). I needed the resistance else the board would turn on automatically. I connected the source to ground, the drain to the negative side of a small piezo speaker, and the positive side of the piezo speaker to the positive power rail / the +5V out of the Uno I am prototyping this with until my Trinket Pro arrives.

Here is a picture of the circuit when finished on the breadboard:

I am still missing the Trinket Pro, the accelerometer, and a better speaker.

Discussions