Close
0%
0%

Low cost Smart Switch

Control and monitor any lighting setup :
a low cost 1-Wire module.

Similar projects worth following
It has to:
* Be super cheap so you can put many modules all over your house : )
* Be Compatible with any possible lighting system (Single Switch; 3ways; 4ways; Latching)
* Be small enough to fit in existent cases
* Be transparent if the Master controller dies
* Monitor the Lamp state
* Monitor current consumption
* Easy to solder
* Open source and easy to extend to other sensors, actuators..
* Safe


There are plenty of ways to remote control a light for home automation, but most of them are rather expensive and do modify the way you use your switches. Indeed, they replace existing switches or are in series with them like smart bulbs.

A smart switch needs to be powered (often with main), but neutral is not always available in switch box, and on the lamp side, you depend on the existing switch state.

This project proposes to add a relay in your existing switch cases that act as an additional switch. Turning a single switch into 3way; and a 3way into a 4...

This solution has the advantage to be compatible with every setup I can think of, at the conditions that you have some space in your switch boxes, and that you can add small wires for communication and low DC power.

In most cases, you have some space in existing tubes to put those wires. (This point need some safety attention though)

Then those wires are meshed from all remote switches to a central master controller like a PI, an ESP8266, an arduino, an USB to OneWire converter...

An other good point is that it is transparent if communication or power fails.

Now the problems !

  • It has to be super small !
  • The module has no way to know if the lamp is ON or OFF since it depends on other real switches.
    • Solution: Measure current (it adds cool features to a smart switch)
      • Problem : The current can take tow different paths
        • Solution: put two sensors and sum the measurements
  • For that size, the relays and sensors could allow less current than your circuit-breaker does
    • Solution: put a rated fuse on the board
      • Problem: the current can take two different paths
        • Solution: put two fuses
  • Communication could be difficult if we follow main AC wires and for long distances
    • Some people report no problem with one wire bus. To be confirmed soon.

Hardware

To serve as OneWire slave, and measure current sensor, I chose ATtiny13; It may not be able to do accurate RMS computation, but that should not be a real problem..

Having a uC directly in the switch can provide cool autonomous features, like auto turn off the light after power, acting as timer switch. And we could even imagine extensions like presence detection, temperature sensing...

For the current measurement, hall sensor ACS712 will do. the 5amps version saturates at 5 but can handle more, and isolation is very good for the package size.

Last important component is the relay. It has to be a DPDT relay for the 4way system. In France we're 25OV guys so it has to tackle it! Also, the coil selection mater. I think a 12v coil is a good solution, the current from Master to Slave is not so high, and the ATtiny and sensor are made insensible to voltage drop using a 5v regulator. A too high coil voltage would mean power losses in 5v regulation.

Software

As Attiny13 is tiny ! I plan to use this arduino core https://github.com/MCUdude/MicroCore

It even allows us to code in true AVR C without arduino lib if needed...

For the OneWire slave lib, I've seen some implementation, not sure yet what to chose.

For RMS computation, I plan to store sum and sum of squares of samples as fast as possible for one electric period, and then do RMS. But maybe I over estimate the ATtiny capabilities...

Registers to implement are a work to come but some idea:

Read registers

  • current sensor
  • time from last user switch
  • lamp fault detection
  • ...

Write register

  • set lamp state
  • toogle lamp state
  • cutoff current
  • 50/60Hz
  • ...

Note

This project can be dangerous... I'm sure some of you have ideas to make it safer,

Please comment !

A GitHub repo is coming soon for both hardware and software.

sch.png

schematic

Portable Network Graphics (PNG) - 17.09 kB - 02/22/2017 at 22:05

Preview Download

uses.png

Uses of the module

Portable Network Graphics (PNG) - 8.67 kB - 02/22/2017 at 22:05

Preview Download

pcb1.png

PCB

Portable Network Graphics (PNG) - 24.70 kB - 02/22/2017 at 22:05

Preview Download

  • 1 × RTE24012 Switches and Relays / Electromechanical Relays
  • 1 × Attiny13a Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers
  • 2 × ACS712-05 Semiconductors and Integrated Circuits / Misc. Semiconductors and Integrated Circuits
  • 2 × T4A 4A 250V TE5/5TE Miniature Micro Slow Blow Fuse Fuse
  • 1 × Screw terminal connector 4 pin

View all 8 components

View all 4 project logs

Enjoy this project?

Share

Discussions

Thomas Flayols wrote 06/09/2017 at 06:11 point

@Piers Hawksley 
The pcb is rated at 250V - 5A for 1oz copper weight. For 2oz, the relay limit us to 8A.

  Are you sure? yes | no

Karl SCHUH wrote 06/07/2017 at 12:50 point

1) I love your project! Excellent idea.

2) Is your 1-wire-bus compatible with the Dallas 1-wire (besides power-supply)?

3) How do you control your switches? Is there a programme for PC, mobile phone ....?

  Are you sure? yes | no

Thomas Flayols wrote 06/07/2017 at 14:10 point

1) thanks :-)

2) Yes, the idea is to be able to mix it with cheap sensors and other one-wire home automation modules.

3) I did not choose yet, bet it could be a raspberry Pi with a web-server,  or simply a ESP8266 used as an internet to one-wire bridge. For the program itself, it could even be integrated to an opensource home automation software like OpenHAB. But  I did not use such soft yet.

  Are you sure? yes | no

Alfonso wrote 06/07/2017 at 09:01 point

Can I ask you how the board is powered with only one wire? I do not see it in the sketch.

  Are you sure? yes | no

Thomas Flayols wrote 06/07/2017 at 11:32 point

Hi, the board is powered via 12VDC, so there is actually 3 wires, GND, 12V and OneWire link. OneWire is serial bus protocol that needs 2 on 3 wires.

The connector is the 3 pins on the up left corner of the schematic.

  Are you sure? yes | no

David Soon wrote 06/08/2017 at 10:54 point

Hi Thomas, interesting project. Where are you getting your 12DC and Vcc for your Attiny from, assuming you only have a switched live connection and no neutral wires? Thanks

  Are you sure? yes | no

Matthew Carlson wrote 06/06/2017 at 18:34 point

Incredible project! This could also be extended to work on outlets if you wanted to. 

  Are you sure? yes | no

Thomas Flayols wrote 06/07/2017 at 11:35 point

Yes, it surely can! We just have to pay attention to the current limitation of the board. 

  Are you sure? yes | no

Piers Hawksley wrote 06/09/2017 at 00:07 point

What voltage / current is the PCB rated at?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates