So [RobB] wanted to take out all the light switches in his house. His plan was to replace them with a system that could be operated from his smart phone. But his wife insisted that there still must be some way to control the lighting directly — we have to agree with her on that one. The solution was to develop a system that switches the lights via a touch sensor or by Bluetooth.
The touch part of the project is pretty easy. He coated the back of a blank outlet plate with tin foil and hooked it to a microcontroller with a couple of resistors. He’s using an ATtiny85, which can be programmed using Arduino sketches, so the software side is made easy by the CapSense Library. The chip also uses the software serial library to communicate with a Bluetooth module. You can see the result of both in the demo video after the break.
Of course you need to throw a relay in there to switch mains, and find a way to power the uC and Bluetooth module. [RobB] went with a tiny plug-in USB power converter and managed to fit everything in a single-gang switch.
But how do you power the touch panels when the power’s out!
For a true geek, the power never goes out.
2 and a half years later, and this just sounds beautifully profound.
If the power is out, why do you need the touch panel?
Because if the power is out then it will be dark and you might want to be able to see.
Obviously.
Derp if the power is out you wont have to worry about a regular switch, a touch panel, or LIGHTS FOR THAT MATTER HERP!
so you can set one light to light up and tell you when the power is back on. turning off everything else you can to help avoid that reconnected power brownout that always happens, and sacrificing one incandescent bulb.
@Quin
It would be a simple fix. Add an “emergency light(s)” option in the UI. In other words, the selected lights would be on by default. Set a bit in EEPROM somewhere.
… Anyway, I can’t imagine the lights are on by default, and it’s bad style to not initialize variables.
Auto bypass the the fusion reactor…. Duh.
This has always bothered me – when you have a switch that says either ‘on’ or ‘off’ does it mean you are going to change the state to whatever is written on the label, or is it it’s current state? I always think it should be the latter, but I see projects with both. What is everyone else’s thoughts?
Btw, love the project. Just bought myself a house, might have to look into it a bit more :)
same here!
I dont recall what it was, but I was super frustrated, I didnt know if something was off, or if I was going to turn it off.
Hi!
Why don’t use a toggle button? ;)
http://www.lucadentella.it/2012/06/26/btswitch/
Hahaha, I’ve had those thoughts too. Don’t really have that problem with standard (Australian, at least) power switches, but I have wondered it with others at times.
I agree. I settled for making the background represent the current state (white for on and black for off) and the word represent what clicking the button will do. I will probably replace with a “Toggle” and a little circle that represents if the light is currently on or off.
Ah, welcome to the field of usability (human computer interaction).
to me, it makes sense that buttons have labels for actions. So if you have an on button and an off button, the on button turns the light on, and the off button turns the light off.
If you have a toggle switch, it makes sense to have it labelled for the current state / position.
This project is a bastardization of both, and is rather confusing. Come on man, you’ve got a customizable touch screen, you can do better than that.
I’ve always thought the line/circle was rather confusing. “So, do you mean the line is solid for a connection or does the closed circle mimic a closed circuit?” Here I am 2 decades later and I still always pause for a second lol.
That goes back to binary code, that how I remember. 1 is yes and 0 is no, so if it’s at the one, yes, there is power, if at the zero, no, there isnt.
I have a feeling that a building inspector will complain about this setup as being a violation since there is no physical switch. Before going along and doing this idea I would first contact a building inspector and find out if it passes code before I get stuck having to revert all my hard work.
This looks like a nice drop-in replacement for the switch. So why tell the inspector? And just swap it out if he’ll be making a visit. This is HACK a day, not “build something you could legally sell to the public” a day.
only if you manage to burn the house down by doing it wrong it will create a slight insurance issue.
Ah, but it is also something that is illegal to install in almost all jurisdictions in the US. It wouldnt be hard to do this right, and compliant. Most hackers who want to play with 120V power should really look into the NEC. The code is written with your long term safety in mind.
Separation is required between mains and low voltage control per the NEC, which applies to all installations, not just commercial products.
Also, that box is obviously overfilled.
If there’s an incident, you can bet your insurance wont be paying for anything until you prove the work was done in accordance with the relevant codes.
Actually the NEC was begun, written and sponsored still, by a conglomerate of….you guessed it, INSURANCE COMPANIES. Now for the INSANITY of the current NEC. They added Arc fault detection to literally EVERY circuit in the home. Arc fault was originally designed to protect tenants and unsuspecting owners from loose receptacle connections where bed covers and other cloth or flammable material was allowed to bridge a loose plug from hot to ground or neutral and cause a fire. Part of the cause of this problem is that today all receptacles are installed UPSIDE DOWN, the ground pin belongs on TOP as a safety measure but the code says nothing.
Then the NEC (read insurance companies) decided that arc fault should protect everything. In fact the engineers and others that tout it state that it protects the entire circuit, however the code reads that the protection must be installed at or before the first device. This means that those touting protection of the circuit are lying if the protection does not begin at the breakers (average $60 per circuit times an average of 20 circuits receptacle arc fault is about $35 and arc/gfc about 40-45.).
Meanwhile the firmware that runs the devices still can not tell between a hair dryer, a vacuum cleaner and an arc because of fault. (I had a new AFCI install a month ago, a bathroom and living room not on afci circuit blowing dedicated servers on dedicated afci circuits because vacuum cleaner and hair dryers.)
At least Canada said NO to insanity. Their codes specifically state that DEDICATED circuits (meaning any circuit that is not designate for a user to utilize (think Dishwasher, disposal, refrigerator, dedicated server circuit etc) is not required to have afc.
I believe that is not good enough, modern lighting circuits can not be plugged into and do not need afci, especially with 100% led lighting, neither do bathrooms, kitchens, nor any place that WILL have motor plugged into it, say a garage utility circuit etc. One could argue “what if a neutral gets hot and sparks?”. I say that generally that circuit will blow when that happens and the “spark” is contained in a non-flammable box by code. No issue, just hope that the electrician left the minimum wire required by code.
Three to six years ago the entire house was controlled by 400-450 worth of breakers and panels plus one GFCI at $25 per required circuit (bathrooms and kitchen). Today that same system costs an additional 1200 minimum. I have yet to talk to any one in a new house whose insurance was lower than my same size house regardless of code upgrade.
As to illegal to install, if it is not UL or other lab approved it can not be placed in a home circuitry, period. Another story entirely.
I plan to take my switches with me when I move :)
The only reason you would have to worry about what an inspector thinks is if you are planning to sell your home, or maybe getting a second mortgage. It is your home. You can do whatever you want to it. At least here in the states.
An inspector doesn’t even have any business being in your home unless you invited him.
^^That is not true. Here in my city every building needs to be inspected every year regardless of it being an owner occupied residence, a business, or an apartment complex. And around here they are rather strict about the electrical and if someone doesn’t fix a violation then they get heavily fined.
I bet the thing about this that would make them complain is if you walked into your residence at night during the winter and you still have your gloves on then you won’t be able to turn on the lights and thus making this become a fall hazard.
Like I said, here they are very strict about things like this because all fires and injuries cost the state more money.
Granted, I do think this is a cool idea, but I think it could be better designed using a 3 way switch so you can still use a real switch or your bluetooth phone.
I thought that was blood sucking, soulless vampires although having met a few building inspectors I can see why you might be confused.
Deadlyfoez, not sure where you live, but I would move if it were me. There is absolutely no reason to put up with that crap. Mandating that an inspector be allowed INTO your property to search your property just happens to be unconstitutional.
So deadlyfoez, tell us more about life in north korea, we so seldomly meet someone who lives there.
@justice099, I would assume it is probably because this city has a lot of slum lords with victims of fire, electrocution, lead poisoning, asbestos, etc.. with a huge amount of immigrants that don’t understand these things or how to report them. It really doesn’t seem that unordinary because I’ve had to deal with it every year for 13 years. Luckily the inspections have saved our family from becoming homeless due to dangerous electrical wiring.
Around here though, the inspectors give you a month notice before they come. If they find a violation then they give you a month to fix it. If it is not fixed at that point then they give out the hefty fines and sometimes even condemn the building depending upon the severity.
Generally, they only look for the obvious things like that the smoke detectors work and nothing obstructing any entry ways. They tend to only dig deeper if someone has voice a concern about something else that could be considered a safety hazard.
Well, it certainly wasn’t my intention to vere off-topic here, but it sounds like one of those cases where the government agency only has power because the people allow them to. The minute a sheep wakes up before getting to the shredder, this little program will be done. If you don’t believe me, try refusing to allow them in your home next time. There is absolutely nothing that they can do.
Municipalities have a lot of leeway in the form of regulations, etc… but as I said, this particular activity just happens to be unconstituional on a federal level, which means the municipality is not legally authorized to have this power. Assuming you are talking about a U.S. State here, of course.
However, there are many laws (crimes) the governments get away with simply because we allow them to.
My experience has been that you have to get a permit and inspection if you live in a city. This is especially true in cities on the east coast where the houses are attached. You won’t just burn your house down – you will burn down the adjacent houses as well.
Hi Matt,
why don’t use a toggle button? ;)
http://www.lucadentella.it/2012/06/26/btswitch/
Very cool, I like it. I use X10 to control all my lighting at home but with momentary (door bell like) switches to control the lights with LW12\’s (some of them anyway, other rooms like passageways have no switches, but rooms like the lounge where you don\’t want a PIR turning the lights on during a film say do have), these can then be overridden by the x10 server (http://dave.harris.net/my-x10-setup/)
Nice. I’d really like to do something similar but have never found a good way to do so. My requirements:
– Not having to rip up floorboards / ceilings to add additional wiring.
– Being able to remove it if I move house (or it breaks).
– Being able to read as well as set the light’s status.
Maybe it’s a UK thing but the lack of a neutral in the switch is my stumbling block. There’s no power available to the device when the light is on, and you’d have to sneakily leak current through the light to power your circuit when the light is off.
I’ve done something in my garage where I could easily do some rewiring, but can’t easily take it further.
X10 is very easy to retro fit, check it out
X10 is a creaky old relic from the 90s and it needs a neutral connection. I’ve no desire to add those nasty bricks between an outlet and a lamp.
au contraire fred, x10 is still going strong and the majority of x10 light modules, i.e. the LW12 micromodules (http://www.letsautomate.com/11608.cfm) do not require a neutral connection, hence the easy retro fit. You may wish to research more.
Oxfred,
X10 is much older than that… it predates 1978, and it was only after they got clever about marketing that it became a household name.
It’s always sorta worked. However, their infatuation with spam and the pop-under/over revenge of the “website of no return” didn’t help the company much.
The original circuits were 567 PLL detector driven audio, and kinda fragile. I eventually overcame my fear of line voltage and used surplus 15/20A contactor relays to power A/C circuits, driven by awful overkill heatsinked NPN transistors switched by 7400 TTL, and thence to awful overkill heatsinked SCRs driven by… it was a long time ago, I believe 8254 timers.
Then one day I realized…that regular light switches and motion detectors were enough. Now I’m searching for an ancient toaster that doesn’t use electronics, because we really don’t need sophistication like that.
Showers, however – well, everyone needs a little tech.
I have a large X10 system. Which works very nicely after I replaced a string of fallible CM11A controllers (which are weak, lock up, and sometimes burn out) with a third-party XTB-232.
As mentioned, some X10 modules sneak current through the attached load. Works fine with incandescent lights, transformers, and other inductive or motor-driven appliances.
It does *not* work with CFLs, though. Or anything else that can requires a fairly high threshold voltage before it starts to turn on and pass current. You need the neutral connection then.
X10 is indeed ancient. Both that, and an apparent surplus of new/used modules in the past, made it very inexpensive to build my large system. The surplus seems to be drying up though, and prices increasing; I just paid double what I typically have in the past to get some additional modules. So if I were to rebuild my system from scratch, I’d consider other options as well.
I don’t know how UK power differs from the US, but the power supply is just in parallel with the light. The relay is in series with the light. Does this not work in the UK?
Theoretically, if you tap both sides of the switch, you should be able to get enough current flowing past the filament to power an MCU and a Bluetooth transceiver. When you switch the light on, you could either have had a battery charging off the leakage current or switch over to inductive power.
@RobB — nothing UK specific about it; he’s referring to something called a “switch leg.” The power feed goes to the light fixture, and then a two-conductor cable is run from the fixture to the switch. Since the switch is in series with the light fixture, there’s no source of power available in the switch box when the light is turned off.
task killers are the worst thing to use on your phone. they kill batteries.
To be clear, only one light switch has been replaced so far. More hardware is on the way though :)
there is a growing concensus here in the US to make neutral available to switch circuits… I doubt it will make the NEC anytime soon, but 0xfred isn’t the only one lamenting the lack of it, apparently.
NEC 2011 404.2c requires neutrals in switch locations