Does anyone know of any computer software that can be used to turn on and off an electronic motor or switch?
August 4, 2011 1:10 PM   Subscribe

Does anyone know of any computer software that can be used to turn on and off an electronic motor or switch?
posted by *lostatsea* to Computers & Internet (13 answers total) 3 users marked this as a favorite
 
The X10 suite of software and hardware interfaces can do this.
posted by devbrain at 1:16 PM on August 4, 2011


You might have luck looking for a computer controlled relay, and then use the relay's API to control it. Some home automation software, like the x10 stuff, might also be worth looking at.
posted by samsara at 1:17 PM on August 4, 2011


Here is an example of one that uses a computer's LPT port.
posted by samsara at 1:19 PM on August 4, 2011 [1 favorite]


Response by poster: Thank you all for your answers. The x10 suite looks interesting. Another question: is it possible to use these solutions to activate a switch over the internet?
posted by *lostatsea* at 1:22 PM on August 4, 2011


What you may want is Wiring.
posted by Fidel Cashflow at 1:25 PM on August 4, 2011


Perhaps with something like a smartlinc with a little rigging... x10 also has internet gateway capabilities. It'll be one of the simplest solutions (the linux home automation solutions aren't quite there yet unless you're into tinkering).
posted by samsara at 1:25 PM on August 4, 2011


If you're looking to do this on the cheap, I've seen hacks where somebody logs in to a linux box remotely and triggers the CD eject command. Rig up you switch or push button in such a way that the CD tray opening activates it. Viola, remotely activated push button for cheap.
posted by cosmicbandito at 1:39 PM on August 4, 2011 [1 favorite]


The Arduino is versatile, has a wide user base (to get help if needed), lots of tutorials, is multi-platform, and not very expensive.

With an ethernet module, it can also be used over a network / the internet.
posted by uncle harold at 2:30 PM on August 4, 2011


It's not really the software that's the problem, it's the interface between the computer and then the thing you want to turn on and off. It's very hardware-dependent. Based on the hardware you choose to do the job, you'll probably end up using some fairly specific pieces of software. E.g., if you go with X10, you'll need to use the X10 software.

Back when most computers had them, you could do a lot of interface work using the parallel port and just pulling individual control lines high or low, and then running it through some buffers in order to drive relays, etc. But most computers don't have those and I'm not sure if the USB parallel port adapters source/sink as much current as the old ones did, so I'd be cautious using some old schematic that you find online with one. But that was how a lot of neat custom home-automation stuff was done back 10+ years ago. The software to control that could be as basic as shell scripts. Might be worth looking into, though.
posted by Kadin2048 at 2:33 PM on August 4, 2011


Depending on your skill level, operating a relay via a serial port is a project that would be friendly to a relative beginner.
posted by rhizome at 4:46 PM on August 4, 2011


You could get a USB relay board.

You can get things like this, which allows you to control relays (essentially switches) from a computer.

If you have the money, National Instruments makes a whole slew of things just for this purpose.
posted by pknodle at 6:28 PM on August 4, 2011


This is totally Arduino, with a motor shield. You could set this up quite easily once you get used to the programming environment. However, you will probably find online a program that you can tweak to your taste
posted by ddaavviidd at 7:35 PM on August 4, 2011


I know this is pretty old, but I've done stuff similar to this. A parallel or serial port would be the simplest in terms of hardware, and IIRC, Python has some parallel and serial libraries that let you trigger a pin high or low (bit banging), which could turn on a relay or motor. But the intermediate step of an Arduino or other microcontroller seems to be the more fashionable approach, partly because it gives you a layer of abstraction between the hardware and computer, and also partly because parallel and serial ports are hardly standard these days, and the USB ones are unreliable for this kind of work (they're mainly meant for printers). PCI parallel/serial would be okay.

Anyway, you basically want to hook up your Arduino via USB (which creates a virtual serial port to communicate to the processor and also passes power to the board), and then hook up one of the arduino's IO pins to a relay wired appropriately (more on that later). Send the arduino a sketch to set the pin high if it gets one serial message (I suggest a single char, as strings are a bit much in terms of memory and totally unnecessary for machine to machine communication), and set it low for another.

As for the relay, mechanical relays tend to call for more amperage than an IO pin can deliver, and also have a nasty habit of sending back a backwards charge when they disengage. Both of these things can kill the processor. A transistor (to push up the voltage) and a diode (to stop the backwards charge) can fix this, (see this schematic) but there's an alternative that's a bit more expensive, but has some advantages.

A solid state relay (SSR) can be controlled directly from a microcontroller's pin, and has no backwards charge. It also is silent and can be switched on and off more before breaking down. You can even do some PWM with it to do things like dim a lightbulb. They generally handle less amps, though, and often require a heatsink for higher amperage, so for higher wattages, you will need a bigger SSR (plus heatsink) than a mechanical relay. Also note that SSRs generally pass a tiny amount of current when off, although I believe there are ones that protect for this, and they can sometimes be messed up by an inductive load like a motor, so if you're planning on controlling a large motor, you might want a mechanical relay after all.

For the network stuff, you can definitely use an arduino's ethernet shield, or you can even do some creative stuff with other hardware you may have lying around. For example, I've heard of people soldering pin headers to the serial port inside a Linksys WRT54G router flashed with DD-WRT or OpenWRT, and then wiring those pins to the Arduino's serial pins (although I think you might need to bridge the voltage from 3.3 to 5 v between the two, see this guide or this product). Then it can be controlled either by a script in the router (that could even serve up a web page for control via a browser, IIRC), or you could SSH in and send serial commands via the console. You could even reprogram the arduino remotely. I've been curious to try this approach, because the ethernet shields are a bit pricier than I'd like (ebay knockoffs are unreliable and not worth the cash because they rely on software control beyond what the arduino can do easily, so you want one based off the reference design from Arduino which has some hardware to simplify ethernet). And the Linksys itself is a computer that's programmable in more languages and has more memory, so you can further enhance what the Arduino does.

But I digress. The simplest solution is probably what I said towards the beginning. I recommend the arduino as the programming is simple, and there are many examples of how to do anything for it, complete with handy libraries to simplify the programming. A serial command from a local computer is probably easier than the ethernet solution (I haven't played with that), but ethernet with the Arduino shield should be pretty easy, too.
posted by mccarty.tim at 10:02 AM on May 4, 2012


« Older Too safe to go, too poor to stay - to open a...   |   Glass reassembly help needed Newer »
This thread is closed to new comments.