Low-cost Sensing And Communication With An LED


LEDs are extremely common in electronic devices. They are used as light emitters, but can also be used as light detectors since they are photodiodes. By quickly switching between light emitting and detecting, you can use the LEDs to determine the ambient lighting and even do bidirectional communication. MERL has a good paper covering the basics of how this system works and how they used it as a “last-centimeter” communication device. The system can be implemented using one LED, a resistor, and two I/O pins. So, it could be used cheaply in almost any device. The microprocessor quickly switches the LED between emitting light, detecting light (LED acts as a charging capacitor), and measuring the discharge rate of the LED to determine light level. Jeff Han has a neat video demo of how this system can be used as a proximity sensor.

UPDATE: [hawkeyeaz1] pointed to a blog covering one person’s investigations into LED sensors.

[thanks branen]

75 thoughts on “Low-cost Sensing And Communication With An LED

  1. Lame, HackADay ain’t what it used to be. Before they’d publish hacks that an average guy could do with just a minimal understanding of electronics, and some extra stuff as well for guys who were far more advanced. That was great, and half of the hacks were fun things like how to get around this or that. Now its just all stupid stuff like mousepad coolers and technical reports on LED’s with no actual hack.

  2. i’m sorry straus that you’re stuck in ignorance, read up a little – this is near ground-breaking stuff.

    I had no idea an LED could hold a charge. Simply by reading the RC time from it, you can use it to sense light. Wondering if the BASIC Stamp RCTIME is quick enough to handle this.

  3. Oh no, its so HARD to wire up an LED a resistor and a uC. I think this is a good hack, I had never thought of using an LED as a sensor instead of an output. I may be able to use this system in a robotics project I am working on.

    Just because you don’t have a use for this “hack” doesn’t mean everyone else on HAD doesn’t.

  4. Get over yourselves, people. This hack is great, it’s one of the coolest things I saw lately, and I saw a lot of them. It’s a LIGHTING device that is used to SENSE movement. Now, if this isn’t great, I don’t know what is. Plus, it uses a LED, one of the most common devices found out there, in ways that others didn’t even dreamt of. For me, it clearly beats downgrading the PSP firmware. No offense.

  5. Not really groundbreaking (as the NYC experimenters note, this is mentioned in the 1977 Forrest Mims book), but a good primer on an often forgotten topic. At least Hackaday isn’t posting daily about how to crochet your own pirate robot ipod cozy like some other publication (cough, Make)

  6. This has been featured on other sites similar to hack-a-day, but it is no less cool. Since I saw it not long ago (the multi touch display mention the other day is by the same group), I’ve been looking for resources on it. I have found one guy who did this after originally seeing the article, and he has blogged about his experiences, and has schematics, etc. His blog about this is here: http://projects.dimension-x.net/technology-and-projects/ledsensors/

    I am personally wondering if LEDs as sensors can be used as sensors for glass. The Multi touch display works by frustrated total internal reflection, but requires a camera on the back. Why not use LEDs on the edge (like the MT-FTIR suggests – http://mrl.nyu.edu/%7Ejhan/ftirsense/index.html) but a mirror on two edges so the sensors can sense when something touches the screen (causing a dark spot where the light is reflected down, not back at the LED)…. Kinda hard to explain without a pic. :P

  7. “I had no idea an LED could hold a charge.”

    Ditto, and I’ve got an electrical engineering degree. You’d think they would have mentioned it.

    Anyway, I’m sorry the first two commenters need their “hacks” springing fully formed from this website like Athena from Zeus’ forehead, but some of us don’t mind learning new things that we can apply to our own projects with a little work.

    LEDs as photosensors? Awesome!

  8. I was thinking that you could use this as a type of biometric password device. If you could interface this with usb (or serial, easier), build a driver that detects each led as a part of a matrix, then by simply doing a getsture on the pad while detecting it, waving a certain way or giving it the bird, it would detect that as the proper password. Pretty cool if you ask me.

  9. Well, i agree, it is a good hack (and it is a hack), however generally speaking these hacks all have some feasable albiet unconventional uses. This lacks that. It isn’t even partially economical to use LED’s for an input device, unless total stealth is required (secret agents needs keyboards too i suppose). I guess it would be a cool way to replace your pressure sensative tracking surface on your mouse, or it could make a neat tablet, but from a cost standpoint it just plain isn’t economical to mass-produce. Sure, it’s cheaper then BUILDING your own pressure sensative tablet, but it isn’t cheaper then BUYING one. And is this even all that accurate? Sure, it has loads of pressure layers to be abused, but you would need alot of little LED’s arranged in a dense manner just to get what you want, and even then, you have a bright red (or whatever color you choose) light.

    I guess if you manipulated it in such a way that you could use this to add real hand gestures to your computer it would be cool and cost effective since there is no real product out on the market for that, but in comparason to all of the current interface devices it isn’t all that great.

    Don’t get me wrong, it’s cool, it’s neat, and if i had the time i sure a hell would do it myself, but it isn’t practical, atleast for the time bieng.

  10. Straus, Dacidboome, maybe you two have forgotten that this site is driven by reader submissions. Instead of getting pissy, maybe you should find or make something cool.

    Just a thought…

  11. One of the coolest uses of LEDs I’ve seen in a while.

    I love the stuff that gets posted here but most of the time is just “oh that’s kind of cool… completely useless to me but kind of cool” This is actually something I can use.

    Interesting enough I think I saw something just like this only a few days ago. I happened to be in Redmond visiting a friend and stopped by the MS visitors center and they had a display with 2 large LED arrays pointing at a piece of glass with a map of the campus projected on it by a separate projector. It responded to hand gestures on or near the glass that allowed you to move, rotate, and zoom the map. considering I didn’t see anything in the apparatus outside of the Projector and the LED arrays (both plugged into a PC) I wouldn’t be surprised if the LEDs were being used in a similar fashion to collect the hand gestures.

  12. hey, LEDs, photodiodes, and solar cells are the same thing, as any engineer ought to know. They’re just optimized for different properties.

    I knew this was basically possible — I think I probably read the Forrest Mims thing as a kid, come to think of it — but what makes this cool (and it is cool IMHO) is the clever way of hooking it up to the micro.

    Also, that LED-array touch sensor demo is just slick.

  13. Ya I agree that this hack is even more interesting than the FTIR display because I think i have a chance of doing this one myself. I was about to order some LEDs for an xbox I’m modding so I guess I’ll be ordering some extras. If you check out the parent site of this and the FTIR post: http://mrl.nyu.edu/%7Ejhan/ you’ll see they’re working on some really freakin cool stuff.

    Twistedsymphony – are you the Twistedsymphony on the xbox-scene forums?

  14. Anybody else wondering if this can also run in infrared ? :) By the way, #10, you pointed out one of the first thoughts I had while reading this. It’s definetely doable.

  15. This is sweet. I’m going to build myself an interactive multipoint touchpad.

    I suppose this works for OLEDs, too? Imagine a flexible transparent display with multipoint touch recognition. The future is now.

  16. This is cool! I have a boatload of those matrix led things and never realized I could use them as an input. I’m thinking of putting like 5 by 5 of them together now to make a little drawing table. WOuld love to have seen the source code for the pics on that though to save some time duplicating the effort.


  17. hi all – thanks for the linkage!

    it has been a while since I’ve worked with this project – but if anyone sees anything they’d like on my blog (hires pics, etc), incl source code, just drop me a note (g-mail gordonthree) … the code is nothing fancy, and its written in Proton Plus Basic for PIC microcontrollers.

  18. “I suppose this works for OLEDs, too? Imagine a flexible transparent display with multipoint touch recognition. The future is now.”

    I did imagine it… And now I have to change my pants.

    Since OLEDs operate on the same basic physical property — a p-n junction created by a boundary between two different semiconductor materials — and just are built and applied in a different way, I assume you probably could implement a multitouch interface with them. Which would be crazygonuts awesome.

  19. what was up there awhile ago? ”
    Microsoft OLE DB Provider for ODBC Drivers error ‘80004005’

    [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SQL Server does not exist or access denied. Line 530 ”
    Hackaday — hacked?? :)

  20. Read about LED keyboard a year ago. It looked nice but the probable cost wah increadeble. I don’t think that this guy will be well-accepted by customers due to its cost.

    to AM ET by sully: do you really what to have such a thing at your apartment? Can’t believe this :))

  21. had – Please ignore my ignorant peers. Hacks are not “getting around this or that”. This particular post has a lot of applications (for your _creative_ readers) and the ball and plate one had a few interesting “hacks”. It had object recognition, real time feedback, etc.

  22. LED’s photo voltaic properties can be used to design a simple robot that would find the brightest local spot. Connect two LEDs to a comparator and use the comparator output with an inverter to drive two cheap DC pager motors.

  23. #22 – Thats funny that you posted that right after me because the first thing I thought of when I started shopping for LEDs was to use IR! The one downside to using this in a practical application that I can see is that it will light the whole room up red.

    Also does anyone know if there are even any oled panels (no matter how small and what inputs) available at all to do any testing? I know its a fairly new tech so I don’t know how available it is. Just thinking about a 1/2mm thick display/touch screen makes me want to start building right now.

  24. i dont see how this is worthy of hackadays attention, and the other multitouch display han is working on gets dissed a few posts back.

    as far as the oleds, im pretty sure you can buy them at mouser now.

  25. I don’t see why people think that this (and other electronics construction projects) are not worthy of being on hack-a-day.

    But I also don’t see why three of the top commented on posts are “HOW-TO: PSP 2.00 to 1.50 downgrade (146),” “How-to: PSP 2.00-2.60 homebrew with eLoader (76),” and “Xbox 360 ATX power supply (73).” I am usually rather dissapointed when I see things like this posted. I’m not saying they don’t qualify as hacks, they just aren’t very interesting.

  26. This is indeed a very cool hack!

    Would it be possible to just read the leds at a certain interval and display something the rest of the time? That would make a very cool keyboard, that could displat information as well.

    And just imagine, a keyboard wich could be transformed into a gigant touchpad with the press of a button… That sure would be something :)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.