Introduction: An LED You Can Blow Out Like a Candle!
LEDs are designed to emit light, but they also make surprisingly capable sensors. Using only an Arduino UNO, an LED and a resistor, we will build a hot LED anemometer that measures wind speed, and turns off the LED for 2 seconds when it detects you are blowing on it. You can use this to make breath controlled interfaces, or even an electronic candle that you can blow out!
Materials:
An Arduino UNO (with USB cable to connect to your computer)
A 1/4W 220 ohm resistor (https://www.amazon.com/Projects-25EP514220R-220-Re...)
A pre-wired, 0402 yellow LED (https://www.amazon.com/Lighthouse-LEDs-Angle-Pre-W...)
Breakaway header (https://www.amazon.com/SamIdea-15-Pack-Straight-Co...)
You will also need:
A computer to run the Arduino environment
Basic soldering equipment/skills
Step 1: How Does This Work?
When you run current through an LED, its temperature rises. The amount of rise depends on how effectively you are cooling it. When you blow on a hot LED, the extra cooling lowers the running temperature. We can detect this because the forward voltage drop of an LED increases as it gets cooler.
The circuit is very simple and looks much like driving an LED. The only difference is that we will add an extra wire to measure the voltage drop of the LED while it is on. To work well, you want to use a very small LED (I suggest using an 0402 surface mount LED) connected by the thinnest possible wires. This will allow the LED to heat and cool very quickly, and minimize the heat lost through the wires. The voltage changes we are looking for are just millivolts - at the very edge of what can be reliably detected via the UNOs analog pins. If the LED is resting on something that conducts heat away, it may not be able to get hot enough, so it works best if it is up in the air.
Step 2: Get the LED and Resistor Ready to Connect to Your Arduino UNO
Soldering extremely thin wires to very small surface mount LEDs takes a fair amount of skill. Fortunately, you can simply buy pre-wired, 0402 LEDs. These often come with a resistor (covered in heat shrink in the picture) that is sized for 12V operation. If that's what you get, you will need to cut off the resistor. If you cut through the heat shrink tubing next to the resistor bulge, you'll probably be able to pull off the remaining tubing leaving some exposed wire lead for soldering. If you just cut the wire, you will need to strip off a small amount of insulation so that you can solder, and given the thickness of the wire, this can be tricky.
The wires are much too skinny to make a good connection in an Arduino header, so we will need to solder them to something fatter. I used pins from a breakaway header to do the connections, but you can use just about any scrap of appropriate gauge wire. The back (cathode) wire from the LED is soldered to a single breakaway header pin. The red (anode) wire should be soldered to the bent resistor as shown. Trim the leads on the resistor to equal length and solder them to two adjacent header pins as shown in the figure.
Step 3: Connections
Connect the LED/resistor as shown in the figures. The side of the resistor connected to the red LED wire goes to A0. This will be where we measure the voltage on the LED using the analog input capability. The other side of the resistor goes to A1, which we will use as a digital output, setting it high to turn on the LED. The black wire must be connected to GND. Any of the Arduino GND pins can be used.
Step 4: Code
Download the code and open it in the Arduino IDE. You can then upload it to your Arduino.
The program first sets up the pin directions and lights the LED. It then measures the forward voltage drop of the LED via an analogRead on pin A0. To improve the accuracy of the measurement, we read the voltage 256 times in quick succession, and sum the result. (Oversampling like this can increase the effective resolution of the conversion so that we can see changes that are smaller than the smallest step on the converter.) If the data buffer sensedata[] is full, we compare the latest sum to the oldest we have stored in the buffer to see if a recent cooling has raised the LED voltage by at least MINJUMP. If it hasn't, we store sum in the buffer, update the buffer pointer, and start the next measurement. If it has, we turn off the LED for 2 seconds, reset the buffer and then start the process over again.
To better understand what's going on, we write the each sum out as serial data, and use the Arduino IDE's Serial Plotter (under the Tools menu) to graph the LED voltage as it changes over time. Remember to set the baud rate to 250000 to match the program. You will then be able to see how the voltage falls as the LED warms up after turn on. This will also show just how sensitive the system is. After the LED is triggered off, it will have cooled off somewhat by the time it turns back on, which you will see as a jump on the graph.
Attachments
Step 5: Enjoy!
When the code is running, you should be able to blow out your LED with a quick puff of air. I have found that I can blow out my LED from over 1 meter away! In some rooms, air currents may cause false triggers. If this is a problem, you can lower the sensitivity of your system by increasing MINJUMP. The Serial Plotter can help you visualize what a proper value might be for your application.
You can replace the LED with one of a different color. White LEDs work particularly well. Because they have a higher voltage drop, you will need to change the resistance value to get the right current. Given the drive capability of the UNO, shoot for a current in the 10-15mA range. For a white LED, 100 ohms is a good starting point.
Because an UNO has 6 analog input pins, you can easily modify this code to support 6 independent, hot LED anemometers! This makes it possible to build simple interfaces that can recognize when you are blowing in different directions. This can be incredibly useful when building interfaces for the disabled, expressive controllers for musicians, or even for birthday cakes with many electronic candles!
Finally, if you ended up using this technique to do something cool, please leave a comment below!

Participated in the
Creative Misuse Contest
72 Comments
Question 1 year ago
This is awesome !!
I try to do it with 2 Led but I don’t get what to change in your code ?
Can you help me ??
Thanks
2 years ago
Excellent idea, practical code. I used 2 tiny SMD yellow LEDs in series, and increased the minjump value slightly. t works perfectly. I plan to do a short video to show how it works.
3 years ago
I built it but the LED (0402, I soldered the wires myself! :D) kept turning on and off.
I modified your sketch a bit to work better / more stable:
https://pastebin.com/999uTiSm
- Instead of 256 cycles I use 1024 (found trough try and error).
- I added a counter variable and a time treshold. Only when it reaches 4 the led turns off. The 4 detections have to happen in a time span of 500ms.
I did this because the ADC noise leads to (in my case) 1-3 false triggers every second.
4 triggers in 500ms works great for me and I had not more false triggering of the LED
3 years ago on Step 5
I have used this project with my students to explain them the diference between analog and digital current. It was great! Thank you, from Spain. I did it with students who are 15 years old.
3 years ago
Гениально! Прекрасная идея!
Question 4 years ago
Can you this be made with and arduino nano or mini?
Answer 3 years ago
سلام خوبی
Answer 4 years ago
Yes, I think it should work just fine. Apparently, the Due, Zero and MKR family Arduinos have 12 bit ADCs rather than 10, so you may not need to do any averaging with those...
Reply 4 years ago
okay, thank you :)
Answer 4 years ago
I was successful with the arduino uno .. I then tried the pro mini and it is too "noisy" for me to detect when I blow on the led .. I soldered the led directly to the pins that did not help .. It is a great project .. I wish I knew how to damp down the "noise" on the pro mini. I even tried a plastic straw over the exposed led wires but that had no effect...
Reply 4 years ago
The noise might be coming from your power supply. Try using a cleaner supply (like a battery), and see if that helps...
Reply 4 years ago
Thanks so much for getting back to me! I tried the battery but that did not change anything...I’m going to attach a few photos that show my setup. I used the exact led you said to and I am using a 200 ohm resistor rather than 220 but it works on the adruino uno. I pulled the a0 and a1 pins and soldered the resistor directly to the unit. I program the pro mini with an inland ftdi usb connected to a Raspberry pi mod 3 using a raspberry pi power adapter 2.5 amps. The power should be good. The programming part is flawless..loads every time. With a minjump of 150 it basically blinks every 2 seconds. 250 did not help. A real stumper..
Reply 4 years ago
A few things to check come to mind. First, do you have the 3.3V or 5V version of the Pro Mini? If you have the 3.3V one, you will need to use a smaller resistor to get the requisite current. The 3.3V version is also slower, so you may need to change some of the timing. It looks like your LED is touching the table, which could steal heat away. You can always make MINJUMP so large that it never triggers. Then you can watch the plot to see exactly what's going on without the switching confusing things. Since you have a working UNO version, I'd compare the plots from the two versions. That might give you a better idea what's going on. Finally, I'd double check the resistor value to make sure it's 200 ohms and not 2k. (I couldn't tell from the pic)
Good luck!
Reply 4 years ago
Will purchase 220 resistors..misread the meter. So instead of 15.9 mA getting 1.75 mA and maybe that was my issue too low to measure? However, the other unit worked with the 2k resistor..This unit is a 5 volt setup. I will get another uno next week to run a check on the plot like you suggest..Thanks again..at least I have some different things to try..
Great project ..and learning how to read resistors and use a meter!
Question 4 years ago on Step 5
where I can get this led in uk ?
4 years ago
Okay so I have a question maybe someone can answer , the difference is measured between A0 and A1 , is possible to reduce the amount of pins used if using multiple leds ? with each led using two Analog ports each the ports get used up quickly, maybe someone knows a way to use less ports for multiple leds?.
Reply 4 years ago
Only A0 is being used as an analog port. You could use any output in place of A1. I only choose A1 so I wouldn't have to run a wire to the other side of the board. Given that you have more digital pins than analog ones, you could have as many LEDs as there are analog pins...
4 years ago
This is awesome. I like projects like this those use Arduino board and only small components. This is a new experiment for me.
Question 4 years ago
Do you mind if i use this the code from this instructable two make a birth day candle
intractable for the tips & tricks contest? cool if not would toltily understand. I will say that I got the code off your instructable and that you inspired me to make this intractable.
Answer 4 years ago
Thanks for asking! I would appreciate the attribution and a pointer back to this original Instructable. But you should feel free to build on this - it's kind of the point of making it public! I'd also ask you to post a link to your Instructable here, so others looking for inspiration can find your work easily.