18 years ago
-- What _exactly_ do you want to do?
-- What _exactly_ do you want to do?
-- From me, LOL!
-- Good plan, it worked for me!^) Probably a good place to start is by defining the size of the
I'm trying to control hundreds of LEDs from my parallel port (8 data pins - will soon be replaced with the output of a programmed PIC, also 8 pins).
I'm not an electronics guy (I'm a software developer), so trying to control x00's of LEDs from 8 pins looks a bit tricky...
There's no way to change them all at the same time, so I reckon I'll need some sort of "addressing" system. Using some of the pins to select which LED I'm controlling, and one for the data.
Trouble is, even using 7 bits as the "address", I've only got 128 channels, but I imagine I'd need a bit for "send" too, so I can set the address and the data, then have it read in one go.
What are my options? And what components would I need to achieve something like this (I imagine right down at the end, I'll need a number of registers for the LEDs. If these come in chips with 8 output legs, I guess I'll need 38 for 300 LEDs. The bit between my 8 data pins and the computer isn't my area though, so I'm stuck!
Oh, and this is just a hobby thing, so the cheaper the better. I'm sure I can already buy scrolling screens, but I don't have the money, and I want the fun of building one! :)
The below link has some info on individually controlling 320 christmas light strings via the parallel port. These could just as well be LEDs. To turn on/off an LED will probably take an NPN transistor and two resistors per LED instead of using a relay. You've actually got 12 pins on the parallel port to work with. The bottom links are some pages I've made with some simple parallel port setups. I like tinkering with the 74HCT259 chips, as they demultiplex and also latch, and cost only $.40 each. You could use the 4 control pins to select the 259 chip pin and set high/low, and the 8 data pins to control other 259 chips that would individually clock the selected 259 chips. Get a couple chips working as a test, then expand from there.
May I ask if you can take advantage of any of the status bits?
Is there any pattern to how the LEDs are turned on and off? Are there groups that can bit always be lit simultaneously or must they all be controlled independently?
Maybe some can be lit up sequentially? In this case, maybe a 555 timer connected to a counter series could reduce the number of permutations required of the parallel port.
The parallel port data bits can be made to go high and low at different frequencies. I believe it operates at 8 Mhz, but at any given moment, it should be possible to dictate which pins go high and low. By cycling back and forth, you create on/off states with frequencies you can choose by software. If you are willing/able to build a frequency detecting circuit, this could buy you a lot of additional permutations.
Consider the following set of bits I used to operate 4 stepper motors that needed to turn at different speeds (I'll show 2 of the motors). First bit indicates forward or reverse, while 2nd bit indicates step or no step.
Motor 1 (data bits 0 and 1)00 00 00 11 00 00 00 11
Motor 2 (data bits 2 and 3)01 00 01 00 01 00 01
What my software sent out for the first bits:0001 0000 0001 1100 0001 0000 0001 1100
Note that data bits 0 and 1 are cycling at twice the frequency as data bit 3. During all this cycling (8 parallel instructions to the parallel port), data bit 2 has yet to go high. Circuitry can be designed to sense and respond differently to these frequency differences. I merely offer a means by which to control a large number of LEDs from a single8 bit parallel port.
I'd like to stop here and see how you answer my questions and how you and others in here respond to my frequency and 555 timer ideas.
Of course, you could have some kind of 16 bit register 8 bits at a time. I need to head home and would have to think on this. I think there are a lot of people in here that know how to do this better than me.
I want to created an led text display (like in the doctors waiting room!). There's no real reason, I'm just toying around with things (got a PIC Programmer coming this week) to see how different things can be achieved (such as sending data to a large number of objects, without a connection to everyone), for my master plan to take over the world :)
This is entirely possible. I've never played with the parallel port before, so my first step today was to connect the 8 data pins up to LEDs, all connected back to port 25 (ground) and see if I could send data. (this worked - I have tacky dancing lights!)
I didn't touch the status ports, because I wasn't entirely sure if I could use them in the same way as the data pins, or if they're "special". Currently I'm using a horrible interop DLL (I'm writing managed .NET code in C#) and writing to the dataports is simply a call like:
Output(888, 0); // All off Output(888, 255); // All on888 being the address of pin1. If I change this number, I don't know what will happen - maybe the status ports are the same, maybe not. I'll look it up tomorrow when I'm a little more awake :)
All independant. I want a text scroller, but my point of the exercise is to see how it's possible to control lots of things from less pins. Eventually, I want to be controlling a little robot or something, which will consist of motors, steering etc.. The more things I learn before then, the easier it'll be!
This wouldn't work for scrolling text, where I'd need to control all LEDs to show a "frame", wait for a sec, then rewrite them all (possibly shifted horizontally by one) for the next frame. It might be possible to do something clever if they're all just shifted in rows, but I'd rather have the flexibility of a full animated display, not just scrolling.
By frequency, do you mean the rate at which I'm turning the data pins "on and off" (+5v / 0v)?
I'm a little confused by your example. What your software sent - is this8 x 4bit signals, or are you sending 4 signals across all 8 pins? If the first, then you're using 2 bits per motor, but I don't have the luxury of enough bits for each LED. If the second, I don't udnerstand how your motor would know which singals sent are for it, and not the other?
Was just looking at the datasheet for this - I think it'll do exactly what I want! Will need a lot of them hooked together though, and with the 3 input pins of some being attached to output pins of others, it's going to be a bit fiddly on the software side!
Can I just make sure I understand this correct...
Using the 3 input pins, I choose which output I'm modifying (a binary value of 0 to 8), and send the input on the input pin. Then I clock(?) the "latch" pin, which copies the input state to the output pin I addressed, and then holds it at that until I change again?
So to set the output bits alternating, with 1 being on, 2 off, 3 on etc., I'd do something like:1-3 = address 4 = input 1 2 3 4 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 0 1 0 0 1 etc. But with flashing the "latch" pin on and off in between each?
It'd vertainly work, but with so much addressing, isn't it going to take seconds to do each frame? :-\\
One easy way to extend the number of ports on a PIC is to use serial-in parallel-out shift registers. The 4094 is a good example. You set up a port pin to a value, then 'clock it in' to the 4094 using another port. Once you have all 8 bits clocked in, you 'strobe' the data out to the outputs. Thus, 3 port pins controls 8 outputs.
You can also 'daisy chain' these parts, since they have a serial-out pin as well. Thus, you can string together a few of them.
Doing 2d arrays of LEDs can also be done by flashing them on a line at a time. You divide the lights up into rows and columns, set up the row values for a particular column, then flash it on for a while. By doing this faster than the eye can follow (say 1/100 of a second for each column) it looks like they are all being controlled independently. However, it takes far fewer bits (40 for a 32x8 array of 256 LEDs). That's doable with 5 of the shift registers above, and a few milliSMOPS.
-- Regards, Robert Monsen
Speaking of the scrolling screens, you may want to use the same approach: use specialized LED controller ICs. Maxim makes a whole line of such devices (so do other people). Check out this page at maxim's website:
This IC runs for $10.81 at Digi-Key, but you can also request a sample from Maxim to play with it and see if it works for you.
-- Dmitri Abaimov, RCDD http://www.cabling-design.com
Hi, Danny. The 'HC595 is a serial input, parallel output IC. You output the data one bit at a time (Data In). After every bit, you toggle the clock active (CLK), then inactive to shift the data bit one further down the line. You then present the next bit of data, clock again, and so on. After all the bits are shifted in, you toggle the Latch pins active, then inactive to present all the data that has been shifted into the ICs, one bit at a time, to the output pins of the ICs.
Your hookup will go something like this (view in fixed font or M$ Notepad):
D2 o----o--------------------------o-------------------------o------- | | | D1 o--o--------------------------o-------------------------o--------- | | VCC | | VCC | | | | + | | + | | | | | | | | | | | | .--------o----------. | | .---------o---------. | | .----- | | | RST | | | | RST | | | | | '-oLatch | | '-oLatch | | '-oLatch | | | | | | | | '---oCLK HC595 | '---oCLK HC595 | '---oCLK | | | | | | | | | | D0 o------oData In SQ8o------oData In SQ8o-----oData | 1 2 3 4 5 6 7 8 | | 1 2 3 4 5 6 7 8 | | 1 '--o-o-o-o-o-6-o-o--' '--o-o-o-o-o-o-o-o--' '----o | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ created by Andy´s ASCII-Circuit v1.24.140803 Beta
No matter how many of the '595s you have chained together, you'll only need the3 printer/PIC port output pins, D0, D1, and D2 (with the caveat about buffering mentioned above).
If you're still not clear on the concept, google "serial shift register".
By the way, you need a 5V power supply that you have to connect to each IC pin16 (+) and 8 (-), like it says on the data sheet.
Another quick (possibly dumb) question...
If you go to
but I don't understand the differences between them (there's a hefty price difference!). What am I missing?
Go with the HC595N. The "D" is a SMT package. I believe the "AN" is an extended temp range IC.
A scrolling LED alphanumeric display is a tall order. Each character will require a minimum of 35 LEDs (5X7), plus you'll need a line below and a line between, which means 48 LEDs per character. And if you want scrolling and animation, serial shift registers may be too slow (although not for 6 characters).
You need to decide what you can do and what you can afford. Here's a good rule of thumb: at 300 LEDs (about 6 to 8 characters), you'll spend more than twice as much on the LEDs as the ICs, If you have more like 3000 LEDs, serial won't cut it. For that, the LEDs will be a large majority of the price. Decide what you want to do and what you can afford, and go from there (hobbyist LEDs, and5X7 LED displays, are available at hobbyist prices at jameco.com).
In the latching mode (used to control the individual LEDs), you use the A0, A1, and A2 input pins to select the chip output pin you want to set high or low. You set the D data pin on the chip at 0v for the chosen output pin to output 0v, or set the D pin to+5v for the output pin to output +5v. Then you clock the LE pin with +5v to latch the output pin in the desired state (0v or +5v). The same A0, A1, A2, and D control lines can be connected to all the 259 chips. You clock the LE input on the individual chip you want to control. The As and the D can be done using four of the output pins on the parallel port. The other parallel port pins can be used for clocking theindividual chips You can use two of the 259 chips in the demultiplex mode to clock the individual 259 chips used in the latching mode. Using the eight parallel port data pins and 17 259 chips (2 in demultiplex and 15 in latch mode), you could individually control 120 LEDs. The output page below shows the latching mode schematic, and the ppswitcher3 page shows the chips in the demultiplex mode. If you used the parallel port control and data pins, this number could be multiplied many times.
Using parallel port data pins 0, 1, and 2 to control the As, pin3 for D, and pin 4 for the LE clock on a chip, here are the byte sequences to turn Q7 on and off: 00001111 sets all As high (Q7) and the D high for +5v output 00011111 clocks the chip LE pin high 00001111 drops the LE pin low to latch Q7 at +5v output 00000111 sets all As high (Q7) and the D low for 0v output 00010111 clocks the chip LE pin high 00000111 drops the LE pin low to latch Q7 at 0v output
-- If you\'re simply scrolling text, there\'s no multiplexing needed.
Sounds easy... But - milliSMOPS? Are you having a laugh? Google doesn't know what they are either! :P
Right, I think I understand - except for what you've labelled as SQ8 on your diagram. Does this hold the "last" bit that's about to be dropped? (and does this work based on the clock pin, and not the latch?) So if I sent 16 bits (clocking active in between each), and *then* latch, would I get 16 unique outputs, which I can then redraw before the next latch?
Think this will be the easiest way, though I don't know how fast I can shift the data (300 LEDs is more than 600 outputs)!
The AN is half the price! I was just checking the "Technical Info" PDFs on rswww, and I can't find any difference (in temp, or anything else) :-\\
-- Then your thinking is flawed. The "ring tone generators" to which you refer can only generate combinations of two tones out of eight. The
I am busy at work and may need to put off most of my answers until later. If you are going with a scrolling display, then a serial to parallel type of IC is a good start, but it depends very much on how many LEDs you want to control. I could suggest considering exactly what the dimensions of the display will be and letting this dictate design requirements. I think this reflects real world engineering.
I could for instance consider using the serial to parallel IC only to control the vertical axis of the very last LEDs at the right end. You should be able to control many of these with a serial to parallel IC. Since you have a scrolling text, all of the status of the LEDs left of the very first LEDs are dictated by the status of the LEDs on the right end. All subsequent LEDs can be lit by activating a 555 timer IC whose output is connected to a counter IC. Each step of the counter activates the next LED to the left of the preceding LED. Each preceding LED turns off. This in principle can very cheaply and efficiently control many hundreds (even thousands) of LEDs.
My example showing the data bits shows only the first 4 of the 8 data pins as this is all that is actually required to drive two stepper motors, one pin dictates forward or reverse, and one pin dictates step or no step.4 pins therefore can control two motors.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.