If you've ever tried fiddling with some electronics on an amateurish level you'd probably thought at some point that it would be awesome if you could plug something into your computer and make it obey your evil commands. And then you'd laugh your evil mad laugh...
Or is it just me?
Anyway, it's a bugger to do that sort of thing with USB, especially if you're only learning which way of the solderer is the bit you hold and which is the bit you hold when you possibly want a day off and some attention of medical personnel. Right, anyway... So USB is a pain because to even turn a simple diode on or off you can't plug it into the USB socket or anything because it's a serial port, so it has a complicated protocol to follow before it spits out any actual information. So you'd probably need to interface with the socket via a FT232R integrated circuit or somerthing, but that's fiddly to hook up even in the best of times, and not as cheap as you'd like them to be.
But if you happen to find a computer which has a parallel port (you know, that pink one which you used to use for the printer) then you're all set, because that's not a serial port. No. It is a parallel port, as name implies. In fact you can plug some 8 diodes and things in just like that and they will receive a nice 5V signal (Hey! Good for TTLs!) when you program the computer to do so. And that's what I'd done and other people have done as well.
Ok now... so how do I control the damn port? Well, you can put together a C program that'll do that for you, or, these days, a Python program, which is fine and dandy for us weird no-life developer nerds, but is definitely not going to work when you make a device for your dad. Back in the day, on those ugly, gray Windows 95 machines we had someone's little window application though, written in Delphi (that awful thing) but is no good for a modern, up-to-date Linux user (also, I can't find the link anymore). And I couldn't really find anything worthwhile for the one true OS...
So something had to be done. Luckily I had some plane trips when I would be motivated (by way of having no alternative occupation except of staring blankly at the seat in front of me) to hack up a little GTK application to serve my own needs, scratch an itch, that sort of thing...
(End of lengthy intro.)
Long story short, I wrote it in Python and using Quickly. I wanted to give it a simple interface, so i figured, an enormous big red button would be the best way to go. True, you can't readily turn on only one bit of the port, but you can't have everything, and this way it won't confuse the people who might not be in the habit of sitting up late at night in the light of a computer screen and wondering if there's a 24/7 pizza place anywhere within walking distance.
Anyway, take a look at this here screenshot and tell me it's not at least amusing...
Feature number two was the ability to turn it on with a delay. So, say you have a device that you turn on, but you want it to turn on in an hour? Right-clickety on the button, set up the timer and you're good to go.
And finally, you can set it up so that it to turn on or off particular pins when you press the button, so you can for instance keep one device turned on in the on position and turn on two other ones, but turn the first one off in the off position.
It can also run with or without GUI, which you can find out about by running it as a script as:
I'm not posting the code here, because it's on the long side, but it is available at GitHub as bigredbutton/ and, as previously stated, at https://launchpad.net/~konrad-siek/+archive/ppa.
Oh, and I'm sure it's all buggy as all hell, 'cuz overtime I keep forgetting which bits I tested and fixed and which worked already. But it's on launchpad, so I'm sure I can fix them as they appear. Hell, maybe I'll even add a feature or two in the fullness of time.
How to install (on Ubuntu): You can...
- Open the Ubuntu Software Center, select Edit -> Software Sources...
- In the Software Sources dialog select the tab Other Software
- There, select add and type in the apt line for the package archive (viz. ppa:konrad-siek/ppa);
- Find the program in Get software, in a section like ppa that just appeared.
sudo apt-get update && sudo apt-get install bigredbuttonDone.