Microcontroller communications using flashing lights

phototransistor_pc_microcontroller_communications

[Scott] was driving in the pouring rain behind a car with its blinkers on when inspiration struck. He had previously created a simple communications system using his sound card that allowed him to send data to a microcontroller from his PC, but he thought that doing the same thing with light would be an interesting exercise.

He decided that the best way to go about building such a system would be to use a phototransistor along with his computer monitor to send data to his microcontroller. While he couldn’t really think of any practical application for the project, that didn’t stop him from putting it together just for grins.

[Scott] says the circuit is dead-simple, and includes a pair of phototransistors along with their required resistors. The receiver was tied into the ADC of his microcontroller, where he was easily able to pick up some simple light patterns. His ultimate goal is to put together a javascript application that sends data to his microcontroller, though he’s looking for a bit of assistance on the programming side of things – any takers?

While [Scott] couldn’t come up with any applications off the top of his head, we know of at least one. Anyone familiar with the Bloomberg financial application will likely have come across their “B-Unit”. This piece of hardware is about the size of a credit card, but thicker. Armed with a fingerprint scanner and a photodiode, it reads a series of flashing lights from your computer screen in order to ‘synchronize’ the unit for each login session that is not initiated with an official Bloomberg keyboard. So there’s one for you!

Continue reading to see a video of the system in action.

Comments

  1. The Steven says:

    Chat via IrDA?

    Interesting idea.

    How about a Line-Of-Sight-Car-To-Car messaging system?

  2. JohnPower says:

    pretty cool! even though the calibration for levels of brightness gives me headaches which is solved by an empircal threshold value.
    maybe one could use the supplied clock signal not only for synchronization but also as calibration source for readings of the ADC in charge for the data?!

  3. JohnPower says:

    @The Steven: hehe, I can see the first hackers fiddling around with their indicators ;)

  4. Colecoman1982 says:

    @The Steven: I don’t know how good of an idea that would be considering the kinds of things many drivers would want to communicate to their fellow motorists… ;-)

  5. bogdan says:

    this reminds me of some sort of mini pda like devices which could get some data/games from a pc just by sticking it to the monitor.

    The idea is of course simple, but it should be suited only for cheap and low data rate applications, as irda or radio are sufficiently cheap nowadays. And is getting data directly from the pc to a micro, the serial or usb2serial port is the preffered method…

  6. GaspingSpark says:

    Receiving data from a PC monitor was actually done quite often in the old days. DIY books from the 80’s had devices that used this method.

    Commercially Timex Datalink watches used this method as well as a number of electronic organizers. Many of these devices stopped working correctly on newer hardware with higher refresh rates and LCDs.

    I love the fact that he used two photo transistors. With clock and data separated, it would be much easier to synchronize.

  7. justDIY says:

    along these same lines, google a paper from MERL (put out some years ago), detailing low cost uC to uC communications using nothing but LEDs, bidirectonally … in fact it’s the #1 google result.

  8. alan says:

    I have been working on a project for my employer using a similar design.

    Basically we have a sealed unit with only a bi-colour indicator LED (reg / green), but we now need to get a few bytes of data out from the processor. Notably a product identifier and the device serial number.

    I am using a photo diode and an Atmel RC5 decoder IC to receive the light pulses and decode to an LCD.

    Data is transferred using manchester encoding to aid reliability. Due to EMC issues, data is also sent twice and compared, although a checksum would have been a better solution if we had space in the target device.

    I am sending 80 bits of data, twice, in around 2 seconds. Using some light pipes I had knocking about, it was possible to get a reliable read range of over 2 meters.

    One application that had sprung to mind was an “photo dide to FTDI RS232 converter”. This was you could use a single LED on your development board to send out full debug messages to a PC running hyperterminal.

    There is also a white paper published by Mitshbushi talking about an “i-Dropper” (search Google). Same thing again, except this uses LEDs to both transmit AND receive the data (two way comms using a single LED). These can be used, for example, as alternatives to RFID tags.

  9. This is very similar to our Blinky POV and Blinky Grid kits: http://www.wayneandlayne.com/projects/blinky/

    We also use separate sensors for clock and data. The data transmission is used to update the message display by the POV or grid of LEDs, unlike most LED toys that require extra hardware like a PIC or AVR programmer. We have a nice little webpage programmer where you can type in your text- or pixel-based message, and it will properly package up and transmit the data to the kit. It turned out pretty neat!

  10. Threeck says:

    You could make an optical-credit-card thingy with those, or a swipe version of a QR-code for downloading/web-links perhaps? Have you tried it on printed paper yet?.

  11. pekkhum says:

    SparkFun did something similar for a few of there projects(e.g. http://www.sparkfun.com/products/10091). I like this as a way to keep a project low cost but allowing custom programming by the user.

    I wonder how hard it would be to make a full bootloader that used this…

  12. @pekkhum The Blinky POV and Blinky Grid kits I mentioned above has a bootloader that uses the two-sensor blinking technique to update either the display message (stored in EEPROM) or it can even update the client program (as a bootloader usually does). Check out our design documentation for more details: http://www.wayneandlayne.com/projects/blinky/design/

  13. Khanzerbero says:

    I have some nice application in mind(maybe a commercial one),so i am really interested in the javascript side of things, anyone interested drop me a line: pabloec20 at the electronic mail service from google.

  14. mark429 says:

    I have an old Lego R2D2 Mindstorm kit I bought in Germany that is programmed in the same manner… Very cool to come up with one on your own though! Cheers ~ mark429

  15. Nik says:

    Timex had a line of databank watches back in the 90s that used an optical sensor to read data from the corner of the computer monito. The data eas presented as a small flashing block.

  16. mark429 says:

    holy cow, a quick google search shows that thing is going for $270 US… Hello EBAY =)

  17. Matt says:

    http://en.wikipedia.org/wiki/Visible_light_communication

    IIRC, there was a watch that used a flashing monitor to synch data.
    I believe the NES zapper worked on the same principle too.

    I can’t find the articles, but along the same lines as the car thing, there was a proposed vehicle network system that would take advantage of the LEDs used in the external lights to transmit data.

    So there are lots of applications, it’s just a matter of what you want to do with this idea.

  18. adamoutler says:

    Ill help write a java app. You can find me at gmail.com

  19. Sean McBeth says:

    Oh man, replace the LED with a laser diode and with the right alignment you could do a lot of long-distance communication. Use a beam-splitter at the destination and reflect the beam back to the source and you could probably setup some sort automatic alignment system.

  20. adamoutler says:

    btw… i think you wany a java app…. not javascript.

  21. Skitchin says:

    Very cool, I love projects like this – now imagine what sort of bandwith you could achieve using a high-res image sensor and a HD tv – it would need to be a two way communication, and even so the algorithm and protocol is well over my head. Picture a dialup modem type of connection, but using light.

  22. Skitchin says:

    Btw I got that idea from an alleged UFO sighting where it was described two crafts hovered in place and flashed bright colors back and forth and then took off. :P

  23. The Cageybee says:

    Nice one! I can think of loads of practical purposes for this.

    The obvious one is firmware updates for CE hardware which would mean they wouldn’t need to rely on a physical connection yet is a lot cheaper to implement than wifi and more ubiquitous than bluetooth.

    But the most interesting might be if used in conjunction with toys aim at young kids. I’m thinking like how the teddy rukspin and barney toys worked to make them interactive. I think they used data encoded in the sound as opposed to via light as a line of sight is not needed.

    Thinking about it further though, I guess you’d need to have the device/toy pretty close to the screen for it to work and any sizeable mounts of data might cause seizure inducing fitting bouts.

  24. MoJo says:

    @The Steven some people fit laser parking sensors to their cars. Basically range finding. One of the “benefits” is that police laser speed guns are jammed by them, as presumably would any other kind of optical communications. It is a shame because it could have worked well and helped reduce the burden on the already overcrowded 2.4GHz radio frequency.

  25. yetihehe says:

    Almost two years ago Siemens researchers transmitted 500mbits/s with one (super bright) white diode at a distance of 5m.
    http://www.siemens.com/innovation/en/news_events/ct_pressreleases/e_research_news/2010/e_22_resnews_1002_1.htm With standard diodes this could probably work easily up to 100mbit.

  26. kak says:

    I remember way back when, I had this “toy” PDA thing that would only take its upload from flashing blocks from a computer monitor.

  27. The Steven says:

    Hey, it’s an idea. We still have to assume that the end user will use it responsably.

  28. Threeck says:

    Tried this upon reading. I lack the LCD, so I grabbed my rs232 adapter and used hyperterminal.. Soon I could interface this with C# or VB and make stamp cards with it. Or make playlists with music stamp cards.

  29. Stevie says:

    Oh, you mean like morse code? *groan*

  30. tanmasko says:

    A friend of mine had a bloomberg security token where part of the identification process was holding it up to the monitor and a flash app would send data to it by flashing colors.

    http://blog.robwebb2k.com/2007/08/03/corporate-branding-the-bloomberg-b-unit/

  31. 1000100 1000001 1010110 1000101 says:

    About 20 years ago (?) I had a Timex watch that could be programmed by holding it facing the computer monitor while running included software. The program would flash a sequence of white lines of variable duration across a black screen, which would be registered as pulses by a phototransistor on the watch face.

    The user could set the date and time, and could store names and phone numbers in the watch.

  32. nes says:

    Before Timex, way back in the early 80s the BBC ran a TV series where they transmitted data via a flashing square in the corner of the picture. They published schematics and code so you could receive it, but then canned it after something like 6 episodes :-)

    For long range light comms, there is Ronja which hooks up an LED/photodiode pair to a regular 10 base Ethernet card. It works ok, but a directional antenna on a wifi card works better I think.
    http://en.wikipedia.org/wiki/RONJA

  33. Brad says:

    So kinder, gentler HaD aside… does anyone read the previous comments before they post?

    How many times do I have to read about the Timex watch?

    And +1 to Stevie (no application? REALLY?)

  34. cutandpaste says:

    Someone else mentioned the Timex Datalink. I had one of these, back in the day — it worked well.

    They also offered a widget which was driven either from the serial port or the parallel port (I forget), which consisted of a single blinking LED. This allowed the device to work with the slow-response LCDs that laptops had back then.

    Some time ago, at work, I was programming up a new barcode reader to work with our POS systems. This usually involves scanning special barcodes from a printed manual but the manual in this case was just a PDF file.

    Somewhat disdained, and not really wanting to fire up the printer, I aimed the barcode scanner at the PDF file as it was displayed on the CRT. And — lo — it worked fine.

    (Didn’t work at all with LCDs, though. I blame the polarizing filter.)

  35. Whatnot says:

    @cutandpaste I looked it up and I read that on quality barcode readers they put crossed polarization filters to defeat reflections on plastic barcodes.
    Live and learn eh, I had no idea, seems obvious when you know it but not something you’d think of offhand.

  36. Mike says:

    Great idea!!!… maybe with a infrared led could be a nice DIY identification system whit paper print bar code.

  37. HHH says:

    Really interesting. Now I can’t stop thinking about it!

  38. Scott says:

    Thanks for the suggestions and support! I finished the project with a little help with the javascript (yes, web interface javascript) and it’s a beautiful success. The final web interface is http://swharden.com/tmp/flasher/test5/v4.html and the working demonstration is seen in the photos/video on http://www.swharden.com/blog/2011-07-31-pcmicrocontroller-wireless-data-transfer-part-2/

  39. I was thinking about this awhile back.

    It could work as a way to send data to a POV display, if you have a hollow shaft, you can use two LEDs, one at the base of the shaft which isn’t spinning, and one in the spinning part, and do two way communication.

    You could also do direct window-to-window communication with your neighbor if you want to avoid wifi…

    I was thinking about, outdoors, if you have a clear view of the sky, and powerful enough lights, you could have as many broadcasters as you wanted shining pillars of light up at the sky, and “receivers” would just have to scan the sky…. (making two way pretty simple) Maybe this could be done with infrared as well?

  40. Jesse says:

    This could be useful for a device that needed to be completely sealed or water proofed. That way you could have a clear plastic window for programming, and an induction charging system for a completely self-contained unit.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 92,278 other followers