Tuesday, April 26, 2011

IR Serial Communication Demo

I found a good deal on Infrared LEDs a few months ago, and have finally gotten around to starting to play with them.  This first demo is a basic low-speed serial communication system that allows up to about 2kbps communication through line of sight, though I've only tested it for 512 baud.
This is done using two MSP430G2252 microcontrollers, one bit-banging out 38kHz continuous wave modulated serial, and the other using a fixed frequency 38kHz receiver to demodulate the IR and decode it.  Both processors use a seven segment LED display to display their current state, which can range from 0-9 or an E(rror) state.

The limiting factor in the baud rate is the IR receiver, which has a 200us response delay, which means if we try and modulate information faster than that, the receiver will just ignore it.  That being said, the 512 baud rate I tested is still perfectly useful for basic telemetry information like "change channel" or "Turn on/off" like is used in television remotes.

Video:


The range is quite good, covering most of a room with 40mA into the IR LED.  The software leaves something to be desired, since it consumes almost all of the processor time bit-banging out 38kHz and trying to do anything else would likely glitch the modulation.  Error detection coding will be the next priority.

Transmitter parts list:
  • 1x MSP430G2252 (TI)
  • 1x IR LED
  • 1x 50Ω resistor
  • 1x 32kHz crystal
  • 2x push buttons
  • 1x seven segment LED display
  • 8x 100Ω resistors for LED display
Receiver parts list:
  • 1x MSP430G2252 (TI)
  • 1x 38kHz IR receiver (TSOP39338 Digikey $0.91)
  • 1x 32kHz crystal
  • 1x seven segment LED display
  • 8x 100Ω resistors for LED display
Source code:

8 comments:

  1. Basic idea should also work well for turning on lights as we drive in, with a IR LED mounted on a car.

    ReplyDelete
  2. Great post and nice video will be useful. Thanks!!

    ReplyDelete
  3. hi, can you send to me circuit schema ? bahadir.karaman91@gmail.com

    ReplyDelete
    Replies
    1. The pin uses are in the comments at the top of each source file, and the specific seven segment pin assignments is long-lost, but can be completely changed by changing the digits[] bitmap.

      The LEDs need current limiting resistors, and the IR receiver circuit was pulled straight out of it's datasheet.

      Delete
  4. Hi kenneth, Good Day. Can you please send me a circuit diagram of these IR Serial Communication project because I need it badly if it's okay for you sir. This is my email address, janry_malon@yahoo.com. I hope you can help me, Thank you.

    ReplyDelete
  5. Hi kenneth, Good Day. Can you please send me a circuit diagram of these IR Serial Communication project because I need it badly if it's okay for you sir. This is my email address, janry_malon@yahoo.com. I hope you can help me, Thank you.

    ReplyDelete
  6. hi,
    i have a problem in your code:
    TAIV &= ~(0x02); - Error[Pe137]: expression must be a modifiable lvalue.
    can you help me?
    i'm using IAR.
    Thank you.

    ReplyDelete
    Replies
    1. I only use CCS. Are you maybe using the wrong macro for the registers?

      Delete