# Blow OFF the LED

2,247

27

4

Published

## Introduction: Blow OFF the LED

My kids are wondering and curious about the digital candle in my Rusty Candle Lamp. They love watching the light of flickering LEDs. The next day I showed them, my eldest son asked "Can we blow off the candle?".

"Hah? This is digital candle. We can't blow it off. Simply unplugged the power, " I replied.

"Candle should be blown off, isn't it?" He insisted.

Last week I ran into an electret microphone amplifier circuit. The circuit is interesting. The parts used are simple and easy to get, and I have them all ready in hand. This circuit reminds me to my son's question : "Can we blow off the candle?". This might be able to hear my blowing "Huff!" sound. And yes it can ^^

Then I showed them this video.

Well.. let's take a look on the parts list.

## Step 1: BOM : Bill of Materials

• An Arduino Uno or compatible.
• 1 piece of Push Button.
• 4 pieces of 10K resistor.
• 1 piece of 100K resistor.
• 1 piece of NPN resistor, I use BC548.
• 2 pieces of 100nF capacitor.
• 1 piece of electret microphone.
• Some male to male jumper wires (7 to 9 pieces are enough).
• 1 piece of LED (or you can use the onboard LED on pin 13).

## Step 2: Circuit Diagram

Here is the circuit diagram. I drew it with hand because there was blackout at the moment I was writing this instructables. I enjoyed drawing it ^^

You might notice that there is no LED on the diagram. Well, it is plugged into Arduino digital pin 13. Why pin 13? Because there is a GND pin next to it. So plug the anode of LED into pin 13 and cathode of LED into GND pin next to it. It doesn't matter if you can't find a LED around. Arduino Uno has a built-in LED on the board on pin 13. That's the fun of playing with Arduino Uno ;)

## Step 3: Power Rails

I try a different approach to deliver circuit wiring instructions. From this step forward, I will show you how to place part by part on the mini breadboard and wiring it to Arduino. Just follow/count the hole position to avoid wrong connection. The photos tell your everything but I still provide some text in case they don't. Well, you can place them on your liking though, according to the circuit diagram :D

Mini breadboard doesn't have a dedicated power rails like those on half size and full size breadboard which have "+" and "-" marks on them. And we will connect several parts on 5V and GND, so we need more holes. I always join the top rail to the bottom rail, so now we have 8 holes for each 5V and GND. You can do this with a jumper wire, but I use two pieces of short wire because I always need this all the time when working with circuits ^^

## Step 4: The NPN Transistor

Any NPN transistor will do. Here in this project I used BC548.

Place it in the middle of second row from top.

## Step 5: The First 10K Resistor

Place a 10K resistor on the first row, from 5V rail to transistor's collector.

## Step 6: The First 100nF Capacitor

Place the right lead of a 100nF capacitor in front of transistor's collector.

## Step 7: The Second 10K Resistor

Place the second 10K resistor from left lead of the first 100nF capacitor to the ground rail.

## Step 8: The 100K Resistor

Place the 100K resistor vertically from transistor's collector to transistor's base in front of the first 100nF capacitor.

## Step 9: The Second 100nF Capacitor

Place the second 100nF capacitor from transistor's base to the hole below it crossing the gutter in the middle of the breadboard.

## Step 10: The Third 10K Resistor

Place the third 10K resistor from the second 100nF capacitor to the 5V power rail.

## Step 11: The Electret Microphone

Place the positive leg of the electret mic below the second 100nF capacitor, and the negative leg next to it on the right side.

## Step 12: The Push Button

Place the push button on the right side of the breadboard, in the middle row crossing the breadboard's gutter. If you are using a half or full size breadboard, put the button as far as possible from the microphone, because your button's click can be heard by mic and it will turn off the LED if you don't add "treshold" in your code :D

## Step 13: The Fourth 10K Resistor

Place the fourth 10K resistor from the button's right lower pin to ground rail.

## Step 14: The First Wire

Connect black wire from transistor's emitter to Ground rail.

## Step 15: The Second Wire

Connect black wire from electret mic's negative lead to Ground rail.

## Step 16: The Third Wire

Connect a red wire from button's upper left pin to 5V rail.

## Step 18: The Fourth Wire

Connect a green wire from button's upper right pin to Arduino digital pin 2.

## Step 19: The Fifth Wire

Connect a blue wire from the left lead of the first 100nF capacitor to Arduino analog pin A0.

## Step 20: The Sixth and the Seventh Wire

Connect a black wire from breadboard's Ground rail to Arduino GND pin.

Connect a white wire from breadboard's 5V rail to Arduino 5V pin.

## Step 21: The LED

Plug a LED. Anode (small piece inside/long lead) to Arduino digital pin 13. Cathode (large piece inside/short lead) to Arduino GND pin next to pin 13.

## Step 22: Arduino Sketch

Copy this code and paste it on your Arduino IDE then upload the sketch to your board.

```/*
*  Turn on the LED with a button
*  Then blow off the LED just like blowing off a candle
*  By Chienline @2016
*/

int buttonState = 0;
int micValue = 0;

void setup() {
pinMode(13, OUTPUT); // LED on digital pin 13
pinMode(2, INPUT);   // Button on digital pin 2
pinMode(A0, INPUT);  // Microphone read at analog pin 0
}

void loop() {
buttonState = digitalRead(2); // Check the button state
if (buttonState == HIGH){
digitalWrite(13, HIGH); // Turn on the LED
}
if (analogRead(A0) > micValue){ //Check the microphone state
digitalWrite(13, LOW); // If sound is detected, turn off the LED
}
}
```

## Step 23: Power on and Test

Power on your Arduino and test your circuit. Turn on the LED with the push button. Then BLOW it off ... Huff! Don't forget to test the SNAP it off and CLAP it off :D

Another way to turn the old fashion way into digital :D

## Recommendations

• ### 3D CAM and CNC Class

495 Enrolled

• ### Casting Contest

We have a be nice policy.

## Questions

See my happy daughter... moreover when she knows that it react to sound and not only to a blow :D

https://youtu.be/2G7z8tv4urY

I like this. Out of the mouths of children... and so on. You can't beat his logic. Nice instructabel

Yes. Sometimes the kids are just asking too much because they are learning and they need answers. Then they make us thinking harder and harder to answer their questions :D

If you are in a noisy environment, you can add "threshold" so that the LED will not be off by surrounding voices.

Add this line : "int threshold = 30;" before "void setup(){"

Then replace this line : "if (analogRead(A0) > micValue){ //Check the microphone state"

with this one : "if (analogRead(A0) > micValue + threshold){ //Check the microphone state".

Set your threshold to over 30 you need a very hard finger snap to turn it off. But it still okay with a harder blow. Setting the threshold more will need more blowing power, you can test it to suit your need.

On youtube channel I got a comment asking if we can make it "Blow to turn on the led." Absolutely yes.

Simply change the line : "digitalWrite(13, LOW); // If sound is detected, turn off the LED"

with this one : "digitalWrite(13, HIGH); // If sound is detected, turn on the LED".

Then you should change this too : "if (buttonState == HIGH){digitalWrite(13, HIGH); // Turn on the LED}"

with this one : "if (buttonState == HIGH){ digitalWrite(13, LOW); // Turn off the LED }".

So now we switch to : button press will turn off the LED and blowing will turn on the LED ^^ Have fun with your kids and family ^^