Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
So I'm interested in home automation and specifically in the x10 protocol, primarily as a means to reduce electricity use. While x10 is interesting, it gets a lot more powerful if it's combined with a linux machine (to send stuff over the web, react to alarms, etc). However, if you have a linux machine, even a laptop, switched on all the time, this kinda defeats the goal of saving electricity.
It is possible to use a sensor to switch on power to a linux machine. However, the question is how to get the linux machine to respond to the availability of current by switching on? One possibility I've looked at is WOL (wake on LAN), but I don't see how the x10 gear could send an ethernet packet. Ideally, I just want the linux machine to notice - hey, I've got access to electricity, and switch on. Is that possible?
Many motherboards have the option to turn on automatically after power is restored after a power failure. That isn't in any way specific to Linux or Windows etc. It is a motherboard feature.
The simplest use of X10 would be to kill and then restore external power to the entire computer box resulting in the computer turning on and Linux starting.
Check your BIOS menu to see whether your motherboard has that feature (which would be enabled by changing a setting in the BIOS menu).
I don't know how X10 works, but if you can remotely operate a relay switch with it you can wire it instead of the computer's power button. Turning the relay on for about a second will start the computer.
Note that the relay has to be turned on and back off, not stay on all the time. That would be like holding down the power button on the computer all the time.
Note that the relay has to be turned on and back off, not stay on all the time. That would be like holding down the power button on the computer all the time.
Good point!! You could probably make it work by putting a capacitor in series with the relay contacts and the switch---but you still need to eventually release the relay. There are also various kind of special-purpose relays--eg time delay.
If X10 can be programmed to close a relay, it presumably can be programmed to open it---but what is the time granularity available?
There are X10 relay modules that have a momentary mode but you would have to wire it up in parallel with the existing power switch. An appliance module or a wall socket as already stated would be the easiest since it does not require any modifications to the computer itself assuming your computer has the power on BIOS feature. Make sure you get an appliance plug module and not a lamp module because you do not want any dimming functions. Also the electrical noise from the computers power supply may cause some X10 transmission reliability problems. I had to move the X10 transceiver to another socket on the other side of the room away from the computer before it would work.
FYI X10 is a very old protocol and there is better stuff out there like Insteon. CFLs can produce lots of noise which can cause X10 transmission reliability problems but depends on the lamps manufacture. Lots of info can be found by googling...
There are X10 relay modules that have a momentary mode but you would have to wire it up in parallel with the existing power switch. An appliance module or a wall socket as already stated would be the easiest since it does not require any modifications to the computer itself assuming your computer has the power on BIOS feature. Make sure you get an appliance plug module and not a lamp module because you do not want any dimming functions. Also the electrical noise from the computers power supply may cause some X10 transmission reliability problems. I had to move the X10 transceiver to another socket on the other side of the room away from the computer before it would work.
FYI X10 is a very old protocol and there is better stuff out there like Insteon. CFLs can produce lots of noise which can cause X10 transmission reliability problems but depends on the lamps manufacture. Lots of info can be found by googling...
How will just plugging in a computer turn it on?
Also, shutting down a Linux box by unplugging it (as opposed to a proper shutdown) is a VERY BAD IDEA that could cause data loss.
Many motherboards have an option you can enable in the BIOS that makes them turn on when you plug in power.
If the OS then tells the BIOS to turn the computer off, it will remain off until either you press the power button or external power is removed and then restored.
For all that to work smoothly, you would want your control system to know whether the Linux box was already on. You don't want to turn it on by remove/restore power when it might have already been on.
Many computers have a BIOS option to wake up after power loss. I do not have a computer that is capable so no real actual experience. In addition some BIOS include a wake up clock timer option and all you have to do is set the on time.
A cron job can be used to power the computer down and agree that you do not want to just remove power. There are other missing details as to if the OP wants to use some type of X10 timer to turn on the computer etc.
However, if you have a linux machine, even a laptop, switched on all the time, this kinda defeats the goal of saving electricity.
Well, it needn't be. Something like a linuxtop is fairly low power, a laptop could be put into a low power mode, there are mobile phone linux products that are very low power (although how to use them in your application could be, err, interesting), but there are distros for things like routers, and given the freedom that running Linux on a box like a router inherently offers and the fact that these things come with network ports, that might be an option for you. And there are things like embedded ARM boards that are low power, too (but to avoid hassle, you'd want a board that comes with a Linux Board Support Package).
So, just because its Linux doesn't mean that the power is elevated, unless you mean by Linux an ordinary desktop PC or a server.
Quote:
It is possible to use a sensor to switch on power to a linux machine.
Yes, but, as has been pointed out, off could be where you have to worry. But you say 'sensor'; what would this sense and how would that switch on the current? And bear in mind that you really want the linux box to do its stuff and then switch to the low power state, so you wouldn't want the sensor mechanism to prevent that from happening.
wow, lots of good info and thoughts here. Okay, let me give some more background.
I'm trying to build a security system for a house, while minimising electricity usage. To achieve this, my thought was as follows. You've got an X10 motion sensor that notices someone inside the house. This triggers a transceiver, which switches on power to the linux box (and yes, I was thinking of a normal laptop rather than a router). My thought was to see if this would be sufficient to switch on the linux-box. As several people have pointed out, however, while it might switch it on, that would only work once - since the linux-box would then switch off (or go into low-power mode). I'll investigate the router option - do they have much lower wattage? Many thanks for all the electronics advice; I have no expertise in this area but it looks interesting.
again, many thanks.
by the way, I'm in the UK, so unfortunately Insteon doesn't seem to be an option.
I'll investigate the router option - do they have much lower wattage?
In general, the typical boxes that you see in PC Warehouses -as opposed to the professional equipment - are in the 5 - 15 watt range, depending on spec, and how modern the equipment is (older using more power, for a given feature set and level of performance, but modern also tends to have a better feature set), so you'd have to be careful in making your choice.
By PC standards, they don't tend to have much memory in the box, and that might force you into memory-efficient programming, which you might look at as interesting challenge or you might look at as something that you are happy to throw money at, in order to avoid, I don't know.
re the routers, do you have any particular recommendations as to model? Also, do you have any experience with the plug computers? (eg. SheevaPlug by Marvell) They're cheap (£100), but they're sold as development kits, so I'm not sure just how user-friendly they are for someone's who's linux-capable but hardly guru-level.
re the routers, do you have any particular recommendations as to model?
Start from the supported lists from the specialist router distros (tomato, dd-wrt, etc...see, for example here)
Quote:
Also, do you have any experience with the plug computers? (eg. SheevaPlug by Marvell)
Sorry, no actual experience. But they seem like an attractive idea.
Quote:
They're cheap (£100), but they're sold as development kits, so I'm not sure just how user-friendly they are for someone's who's linux-capable but hardly guru-level.
Check that whatever you intend to use can be programmed in a language that you are happy writing in, and check the quality of support materials.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.