Control 8 Electrical Devices With Your Parallel Port
Michael Williamson writes "A PC parallel port can provide 0 or 5v on 8 pins, individually controllable. This can be used to directly drive LED lights, or with the addition of an external power supply, some switching transistors, and some relays, control 8 higher-powered devices.
I've written a handful of example programs that drive a homemade 8-LED display in amusing ways."
I got a relay kit from Carl's Electronics which switches 8 relays and works brilliantly. Great fun!
value = pin[0]*1 + pin[1]*2 + pin[2]*4 + pin[3]*8 + pin[4]*16 + pin[5]*32 + pin[6]*64 + pin[7]*128;
And they say Perl looks like line noise.
I have been pwned because my
With a few extra chips (decoders), it would be awfully easy to control 2^8=256 devices. Note that I said "control", and not "drive". You will definitely need some external power to drive this....
10b||~10b -- aah, what a question!
Take a diagram like this and add another line of FF on the outputs to mask the output while shifting... (say, DTR will shut them keep/thru, RTS to strobe... use CTS on a dead FF or buffer to sync for propagation delays) Heh, can you buy FF sticks anymore? it would be fun to play with...
Mi domando chi à il mandante di tutte le cazzate che faccio - Altan
This is the kind of electronics project I was doing when I was about 12 years old. Why is this worthy of Slashdot? Pretty soon I'm just gonna stop reading this drek.
I can't belive people are still using the parallel port. I just finished my first project using USB for my interface, and it was pretty easy overall. I guess not as easy as using the parallel port, but then again I can control 127 USB devices, and each one could be controlling an arbitrary number of other devices. I would like to see some decent USB experimentation products and drivers out there. Maybe I'll hear my own calling.
-73, de n1ywb
www.n1ywb.com
There has been a HOWTO for controlling an automatic drip coffee machine for years using your legacy paraport. See Coffee HOWTO.
I guess it just suprises people when they use an I/O port to do I/O
I have mod points and I am not afraid to use them
There are other neat computer chips out there that will light up LEDs or perform logical functions, or whatever you want. Start here.
You can control the lights at a party with a setup like this (yes, I've done it with relays) with this cool Open Source XMMS plugin: Palace. I'm working on a circuit that uses a 1-in-16 demux and 16 74ls373's on the 4 control pins to run 128 LED's (though I haven't had much time to spend on it).
Disclaimer: I wrote Palace. It used to be based on XPLSISNJASP (can't reach its project page anymore), but most or all of that old code has been ripped out and/or rewritten.
A solution to the problem with music today
How about some schematics? Or maybe a pointer to a website on how to build some hardware?
If tits were wings it'd be flying around.
With a few extra chips (decoders), it would be awfully easy to control 2^8=256 devices.
Wouldn't it be 128? You do need a line to control the chosen device, ie on/off.
I used Microchip's USB PICs. They'll send you free samples, although you'll need to be able to program them somehow. I won't go into the details of getting started in PIC programming, you can google for that and find 1000 pages. They supply USB firmware, which is pretty easy to use. Just define your descriptors (this will require reading parts of the USB spec), and then put copy your data into a buffer and put the number of bytes in W and call their library routine. Data sent.
If you look at the data sheet for the PIC 16c745 and 16c765, you'll find schematics. It's damn simple, you add a cap and a resistor and a USB connector and the thing powers itself off the bus.
-73, de n1ywb
www.n1ywb.com
I dont know much about electronics or physics or anything :( :(
I once tried wiring a led to an AA battery but it didnt do squat, lol.
I wouldnt even know where to get electronics material. There is no radio shack in Portugal
If anyone knows of a fool-proof tutorial on led-play for the utterly clueless dummies like me, I would kill to be able to make a battery-powered led constellation to hang on the wall.
You could also boost the amount of devices using only transistors. You have 8 basic imputs, add a few transitors to make AND/OR gates and the rest is common sense from there. The best use of this (other than the want for more devices ofcourse) is so you can use a thinner cable. UTP Cat5 cable is cheap, but it only has 4 pairs, so eight wires, one has to be the ground. So now we have 7 data wires and 1 ground. 1 - 7 1 AND 2 - 1 AND 7 2 AND 2 - 2 AND 7 3 AND 3 - 3 AND 7 4 AND 4 - 4 AND 7 5 AND 5 - 5 AND 7 6 AND 6 - 6 AND 7 7 AND 7 ... same goes for OR, if you really need connections you can go even deeper (2 AND 4) OR (5 OR 6)
Carpe meam simiam!
My dear friend and cousin Jerry wrote a nice little Perl Parallel Programming HOWTO for controlling your parallel port with perl.
He has used this to write an interface app for a Bar Monkey type program. Pictures here.
-- Morgan Collins [Ax0n] http://www.morcant.net/
How about 13 with no extra hardware at all? Standard parallel port (and by "standard" I mean the all the way down to ye olde 8086 machines) have 8 data, 5 control and 4 status (input) pins.
:)
The only hitch is that four of the 5 control lines are inverted (output a 1 and it becomes a ground, 0 and it goes +5v high). But god forbid you should do any logic or anything
You really can't do much with +5v anyway... so you're likely to drive a set of power transistors / relays to switch lights or motors anyway... which requires extra power.
=Smidge=
Question for you before I go off and start surfing on it: Would you say that is a good way to make a device that I could hook up to Linux?
For example, a little robot with a USB connection, a PIC processor to load memory and maybe the same processor to run the robot or perhaps a different one. Plug robot into my Linux box with USB cable. (Appropriate software on Linux box and in robot firmware). Download new robot program through USB, flip a switch and let it run.
Never built any really complicated electronics before, but a little microcontroller robot is on my list of things to do or make before I die.
If tits were wings it'd be flying around.
You can, but I don't believe there is much documentation on it. I am a Windows programmer, but am starting to learn Gtk programming now. The article at http://usb.cs.tum.edu/usbdoc/ may be helpful to learn about USB on Linux.
Done it. Here's the one I worked on back in the early days of college: The Button It's 8 LEDs and a button connected to a paralel port (The button is attached to the select line... We got 9 uses out ouf ours!). When the button is pressed some scripts are run on the host that update this website, turn on the LEDs and other things. What the LEDs do is controlled by this web form.
This story is so 1996.
I have tinkered a lot with 555 ic's for a while, and for the life of me, cannot find an understandable way to use transistors to replace the relays I am using with the 555's. Can anyone point me to a decent web page describing how to use transistors in my 555 application or in the paralell port device control project that this article is about?
Welcome to 1990? Seriously I was doing this shit in high school and before that. I even wrote a program and uploaded it to a frickin' BBS! With a frickin' MODEM!
Let's hear about what people have done with, say, streaming video and firewire... that's a little more interesting.
I agree on this. Switching 8 channels isn't hard. We did this on a cbm64. It should also be possible in an usb device.
:)
Many usb devices are way more powerful than the commodore, so it shouldn't be too hard at all to make something like it
Maybe there are DIY packages for it already.
It would be nice if I could use all of the expansion port devices I made for the 64 with a modern PC
the pun is mightier than the sword
Where i is your input line and o is your output line. The input line is sort of like a ``flow control'' for the power that goes from +5 to o. If you use resistors above and below the transistor, you can fix it so that when i is 0V, o will be 0V and when i is 5V o is 5V, but the current is coming from the +5 instead of i. You have electrically isolated your expensive computer from whatever it is you're trying to power. This is a MOSFET. BJTs are different, but similar. Using the resistors (the rs) to adjust the transistor levels is called ``biasing.'' The transistor isn't a linear animal. You should really find a book on this, but essentially, the transistor operates linearly when the voltages are in a certain range. You want the transistor to always be in that linear range. Hope this helps.
This is so 1987.
Long time ago, when I was little, I hooked some 5.25" drive stepper motors through a multiplexer to the parallel port and controlled it through a program in slackware. But this was a long time ago.
Now I wonder whats with this news over here? Next week: guess what! A serial port can be connected to another to transfer data!!!
Please keep my slashdot interesting.
"Give orange me give eat orange me eat orange give me eat orange give me you." -Nim Chimpsky
mmmm.....well, I would use the standard 8 data pins to select the device, then the 5 control pins to send actions to the selected device.
Although, it may make more sense to use the 5 control lines as select (limiting you to 32 devices), the 4 low data lines for "instructions", the 4 high data lines for output data, and the 4 input lines for input data.
Of course, then again, I am definitely spending way to many brain cycles on this.......
10b||~10b -- aah, what a question!
Yep, but you will need latches for each otherwise you'll be limited to one-at-a-time control of each of 256 devices.
I recently wrote a Python C extension for doing just this. It's nice to be able to twiddle bits back and forth realtime from inside the Python interpreter when you're debugging hardware.
Download it here: PyPortIO
Use it like this:
There's also a good list of links for reading up on more projects there.
As per the recent survey on fun ways to reboot one's PC, and the mention of reading "sleep" buttons on 'nix...
How about some more basic instructions on how to configure 'input' devices on the parallel port, and then maybe some programming tips (windows and 'nix both) on how to work with them.
Personally, I've been wondering if I could make my own input-device. Maybe a DDR floor panel or something? Or just I/O, with panels that light up as well as sending back info. How about it?
Would you say that is a good way to make a device that I could hook up to Linux?
It certainly is. If you use the USB scanner driver (which actualy isn't necissarily just for scanners at all) you can write all your control software without having to change kernel code. Your favorite distro almost certainly has the scanner module built already. Personally I find writing a kernel based driver easier (probably because it's what I do for a living and I'm used to it), and you can do that too.
If you want to access your device from the kernel, the Programming Guide for Linux USB Device Drivers is where you should start. If you don't want to mess with the kernel, read the scanner.txt file that comes with the kernel documentation. There's an example program at the bottom that uses the scanner driver to talk to an HP scanner, but the device at the other end of the cable can be any non-scanner device too.
back in '88 or so, I built a parallel-port D/A converter and wrote some DOS drivers for it (in *assembler*, baby). It produced pretty good sound quality, after downloading some 12-bit samples from a borrowed MIDI sampler - beat the hell out of trying to modulate the PC speaker by switching it on or off at about 100kHz.
Karma: Nonnegative
I just have one word
Yawn.
There is this wonderful connection between the 1's and 0's of software actually appearing as electrical signals with one or the other voltage on them.
I have preferred connecting something to the serial port myself, since that was easier to get working under the Windows NT family of operating systems. However, with Linux, the parallel port is just as straightforward as the serial port, and offers a lot more signals.
SIGBUS @ NO-07.308
If you're playing DDR on a playstation, you just grab a $5 knockoff playstation controller and wire to the button connectors on the circuit board. I did this, using heavy modifications on the design found here. If you're playing on the PC, I think you can then just get an adapter to convert the playstation controller to USB.
This is really easy, and cheap to do. LEDs shouldn't need any extra components - most bright ones you should be able to drive directly without causing any problems.
For control, you need a few extra components, but not many. A TIP122 or similar power switching resistor (a cheaper 2N2222 might work, dunno) and a 12V power supply can be used to control dirt-cheap automotive relays. The only (minor) gotcha is you need to hook up a diode in reverse across the coil to stop the back EMF. A 1N4002 connected with the negative cathode (the pin with the line on it) to the port on the solenoid you connected to +12 is it. The coffee FAQ has a good starting schematic. Once you can control a relay, you can control the world!
All you need to connect this up is a small value resistor from the parallel port to the base pin of the transistor, connect the relay solenoid between +12 and the collector pin, then tie the emitter to ground. Done!
Another neat trick is using that TIP122 to control the extra fans on your PC. You should wire up a reverse diode across the base and collector of the transistor to protect it from the fan as a safety measure, though.
If anyone is interested in this, though, I highly recommend you look at AVR microcontroller programming. You can use GCC, there's free linux and windows development tools, in C, and more examples than you can shake a stick at. The ability to communicate over serial lets you do all sorts of tricks with your PC.
..don't panic
On my computer, the fans are controlled by something like this. I just used 4 2n2222's and used two parallel port lines, one with a 10k and the other with a 5k resistor, on each so the speed was variable. I'm thinking of adding some 74HC595 shift registers to get more outputs - these can be chained to get virtually as many outputs as you want. I also added some buttons to override the computer control, if necessary. The hardware's a mess but it works well with the software I wrote (the fan speed increases when the case temp rises or cpu usage increases.)