Connect with us

Controlling LEDs using the serial port

Discussion in 'LEDs and Optoelectronics' started by max_torch, Oct 17, 2014.

Scroll to continue with content
  1. max_torch

    max_torch

    111
    1
    Feb 9, 2014
    I was reading about how to interface with the serial port, but all I kept seeing was stuff involving the use of a UART. All I want to do is put 5 LEDs in a row and make light patterns with them.. Is using a UART the only way to interface anything to the serial port? Also I don't even know where to start actually, I need some advice.. And what is the advantage in today's world of interfacing with the DB9 serial port using the old RS232 system when we now have USB 3.0, bluetooth, firewire?
     
  2. Arouse1973

    Arouse1973 Adam

    5,164
    1,087
    Dec 18, 2013
    This is how the PC converts the data you want to send into a serial stream of bytes. After all it's a serial port. The limitations of the serial port is speed which is where the other standards come into play. With the ever increasing amounts of data being used today and our ever decreasing patience, faster data throughput is inevitable. If you have a parallel port on an old PC you could look at using that.
    Adam
     
  3. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    If you want to control external devices from a PC, the best method is to get a USB interfaced GPIO board like this one:

    http://numato.com/8-channel-usb-gpio-module

    This connects to you PC and lets you control 8 separate outputs or read them as inputs.

    Bob
     
    Arouse1973 and hevans1944 like this.
  4. max_torch

    max_torch

    111
    1
    Feb 9, 2014
    I looked at the link. What is the meaning of 20mA source/sink.. Also, I am trying to do it from scratch as I want to avoid acquiring a module
     
  5. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    It means that the output pins can source 20mA when high and sink 20ma when low. If the load you are controlling requires more current than that, you would need a switching transistor or relay in between.

    If you have an actual DB9 serial port on your computer, there are two control outputs that you can control independently. You could use these two outputs (DTR and RTS) to shift bits into a shift register by hooking one to the data in and the other to the clock. A 74HC164 would be all you need to implement this. This disadvantage of this is that the each bit you shift will go through all 8 of the outputs, so the outputs would flicker a bit when sending a new set of data.

    If you want to get a little more clever, you could use a shift register with latch like the 74HC595. This one requires 3 inputs, two for use as above and one to latch the data. You could use the TXD pin as the latch signal simply by sending a NUL character after you have shifted the data in. The rising edge after the character finishes would latch the data. This method would eliminate the "flickering" data problem above.

    Be aware that in either of the above schemes you would have to convert the data levels from RS232 to TTL levels.

    Bob
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-