An LED You Can Blow Out Like a Candle!

35,619

273

62

About: Currently, I'm at a startup trying to change the world. In previous lives, I was an EE Prof., an Imagineer at Disney, and, according to Jay Leno, "a Japanese scientist" (I'm not Japanese, or a scientist). In...

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.

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!

Share

Recommendations

  • Plastics Contest

    Plastics Contest
  • Optics Contest

    Optics Contest
  • Make it Glow Contest 2018

    Make it Glow Contest 2018

62 Discussions

0
None
Hans15G

Question 5 weeks 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.

2 more answers
0
None
electron_plumberHans15G

Answer 5 weeks 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.

0
None
electron_plumberpower Bills

Reply 6 weeks ago

I haven't tried 1.8mm LEDs, but my guess is that they would not work well for this application. Because of the way these are molded, I would expect the thermal time constants to be annoyingly long.

1
None
Antzy Carmasaic

2 months ago

Great idea. Imagine the reverse. An LED that lights up when hit with wind. Then making lots of LED-Throwies with the circuit and putting them in trees. When the wind blows, the LEDs twinkle in the forest path.

2 replies
0
None
MikeA255Antzy Carmasaic

Reply 8 weeks ago

1) Turn LED on.

2) Wait 1s, measuring the temp (voltage) the whole time.

3) Did the temp vary outside a specific range during the wait?

4) If yes, it's gusty. Turn the LED off for maybe 250-2500ms and then back on. Then loop back to (1) and this time leave it on for a random value of 250-500ms (maybe the more it varied, the shorter both periods are.)

5) If no, leave it off for 5 seconds (plus maybe some random number of ms) and then loop back to (1) with the 1s delay back in step 2.

Something like that wouldn't leave them off completely with no wind but WOULD allow for some variability when the wind does blow. It'd need some calibration but would be workable. By adding a small randomness to (5) as well as step (4), you'd also keep them all from cycling in sequence..

Also using an ATTinyXX, you could easily run it at a lower voltage and that'd make the ADC have a larger range (if Vdd is 3V, for example, then the ADC has a resolution of 2.9mv, but at 5v, it's 4.9mv/step.)

0
None

Unfortunately, that's harder to do because to make the measurement you need to turn on the LED so it can get warm allowing the wind to cool it down...

0
None
electron_plumberRyanK84

Answer 2 months 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...

0
None
dlilochRyanK84

Answer 2 months 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...

0
None
electron_plumberdliloch

Reply 2 months ago

The noise might be coming from your power supply. Try using a cleaner supply (like a battery), and see if that helps...

0
None
dlilochelectron_plumber

Reply 2 months 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..

BF8841BF-09F3-4DFC-993C-8B6B10CBC9D9.jpeg286D255F-637E-4832-AE36-E10CC72B30D4.jpeg
0
None
electron_plumberdliloch

Reply 2 months 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!

0
None
dlilochelectron_plumber

Reply 2 months 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!

1DF42835-6FBF-43EB-A4C3-1AFF96430B52.jpegimage.jpg
0
None
NoseyNick

2 months ago

Very cool! Pity you can't just use the built-in pullup for an even lower part-count :-D

pinMode(A0, INPUT_PULLUP); // set pull-up on analog pin 0

0
None
YigitElectroMan

2 months ago

Seems like a very cool idea but I can't manage to get it work properly on a breadboard. The values jumped from the serial monitor had fluctuated between 110000-120000 even when there was absolutely no air flow. Both increasing and decreasing the sensitivity didn't work. I highly doubt that the problem is because of the interference caused by the breadboard tracks. Gonna try and make a soldered one tomorrow since I'm too lazy to heat up the iron today :D

Implementing this with a self-flickering or maybe put in some random flickering in arduino code to make It look and feel like a led candle that you can blow. That is very interesting but I think the flickering led effect may also cause some unstable tempratures. I will edit the comment If I every try something like that :D

1 reply
0
None

You might see that amount of change as the LED goes from cold start to warm. It depends on your LED and resistor value. However, if you just have the LED on, the curve should be pretty smooth in still air. I'd suggest setting MINJUMP to something very large so the LED never goes out, and then just look at the plot to see what's happening. If you are still seeing a lot of noise, my next suspect would be a noisy power supply. If you are on a laptop, try running from battery and see if it makes a difference.