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.

[youtube=http://www.youtube.com/watch?v=lvVjsMMCx0U&w=470]

43 thoughts on “Microcontroller Communications Using Flashing Lights

  1. 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?!

  2. @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… ;-)

  3. 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…

  4. 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.

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

  6. 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.

  7. 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!

  8. 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?.

  9. 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

  10. 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.

  11. 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.

  12. 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.

  13. 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.

  14. 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.

  15. @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.

  16. 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.

  17. 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.

  18. 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

  19. 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?)

  20. 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.)

  21. @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.

  22. 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?

  23. 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

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.