Serial control of LEDs

Discussion in 'General Electronics Chat' started by JoshK, Dec 24, 2009.

  1. JoshK

    Thread Starter Member

    Dec 24, 2009
    23
    1
    I need to control 12 standard LEDs with my computer's DB-9 serial port. Only one would be lit at a time. I would like to send an ascii character like "A" and have the light known as 'A' come on and stay on until the next time. Next time I would send "D" the LED known as 'D' would come on and all the others would be off.

    What kind of chip do I need? I assume it would have to be programmable to acomplish this, but as the PC software is my own I can adapt.

    I have spent alot of time researching and honestly this is my first post EVER on the internet asking for help, so whoever can help me accomplish this would be MY HERO.

    Thanks.
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You'd need a couple of serial in, parallel out, latching shift registers. You could control up to 16 LEDs with two of them.

    You'll also need an RS232 to logic level translator, like a MAX232.
     
  3. JoshK

    Thread Starter Member

    Dec 24, 2009
    23
    1
    SgtWookie - Thank you- your idea seems wonderful... but making it a reality is beyond my abilities.
    Can someone explain how they interact a bit so I can learn?
     
    Last edited: Dec 24, 2009
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You are using a serial port.

    It communicates in a serial fashion, one bit at a time.

    You want to light none, one, several, or all of the 12 LEDs using this serial interface.

    This implies a serial to parallel interface.

    Also, the RS232 port does not necessarily communicate at logic level voltages. This is why you need a MAX232 interface IC. It changes the RS232 signal levels to valid logic level signals.
     
  5. JoshK

    Thread Starter Member

    Dec 24, 2009
    23
    1
    SgtWookie - Thank you- your idea seems wonderful... but making it a reality is beyond my abilities.
    Can someone explain how they interact a bit so I can learn?
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Why don't you start off by finding a datasheet for a CD4014B, or an HEF4014B? Actually, find both. The Philips datasheet for the HEF4014B is pretty well done.

    They are both part numbers for the same IC, an 8-bit serial to parallel shift register.
     
  7. JoshK

    Thread Starter Member

    Dec 24, 2009
    23
    1
    thank you, part numbers are wonderful. I think I will look then first then the MAX6955 tommorrow, but tonight I need sleep.

    Thanks again.
     
  8. JoshK

    Thread Starter Member

    Dec 24, 2009
    23
    1
    SgtWookie, You are obviously alot better at electronics than me. I have researched for four hours and don't feel any smarter.

    I can't understand where the clock feed would come from, it seems that baud would have the same purpose, but I really don't know.

    The HEF4014B seems to only have 3 parallel outputs.

    I found this: http://www.arduino.cc/en/Tutorial/ShiftOut it would be a godsend if only I knew what to do with the three wires that are labeled Microcontroller DataPin, Microcontroller LatchPin, Microcontroller ClockPin.
     
  9. VoodooMojo

    Active Member

    Nov 28, 2009
    503
    53
    more shift register info
     
  10. TrevorP

    Active Member

    Dec 8, 2006
    55
    0
    Another way to do it is to get a micro-controller with at least two output ports (16-pins), PIC16F737 for example. Then do:

    Computer DB-9 connection -> MAX232 (amazing little chip) -> Microcontroller -> LEDS

    You would use the USART interface on the uController to read the serial packets from the serial line then pass on the data to the output ports.

    Most computers now don't output RS-232 serial data, so you could easily switch to USB by using a chip like FTDI232BM, but that's a more advanced solution.
     
  11. JoshK

    Thread Starter Member

    Dec 24, 2009
    23
    1
    Thanks for the info guys, I am learning more and more.

    I run across IO Warrior 24 while researching and think it might work. Please tell me if I am wrong. http://www.codemercs.com/index.php?id=79&L=1

    I originally chose RS232 because I believed it would be easy...
    USB would be a good future-proof decision.

    I downloaded the IO Warrior 24's SDK and I can interface my software to that no problem. The outputs are digital, but this would work if I amplified with a transistor, correct?

    Hoping for good news, I will post the final solution so anyone that runs across this will be able to view my solution.
     
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I didn't see any specifications for the card, just some general info.

    If the outputs are digital, yes - you can use transistors to drive your LEDs. I suggest using NPN transistors with the emitter grounded, a 1k resistor between the base and the logic output, your LED's cathode connected to the collector, and the anode of the LED connected to +5v via a current limiting resistor.

    Calculate the current limiting resistor as:
    Rlimit = (Vsupply - Vf_LED)/DesiredCurrent
    where:
    Vsupply = 5v
    Vf_LED = the typical Vf rating of your LED
    DesiredCurrent = the current at which the typical Vf rating was specified.

    Note that the USB port has a current limit of 500mA when used on a tower or desktop PC. If you are powering it from a laptop, it'll be much less.
     
Loading...