Maker Pro
Maker Pro

Controlling LEDs using the serial port

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?
 
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
 
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
 
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
 
Top