Wi-AC Control

An arduino compatible, wireless AC control platform for DIY home automation.

Similar projects worth following
Home automation projects are becoming ever more popular as the IoT expands. A lot of the time these projects involve interfacing with mains potential circuitry which can cause potential danger for the designers. This project aims to give both experienced and inexperienced DIY users a relatively safe and flexible platform to interface with mains level potentials up to 240V.

Originally the project started as a way to switch my Kettle on and off remotely whilst providing temperature control functionality. I had the idea of turning the design into a more flexible platform halfway through and started emabarking on this project.

Ideally I want to build something which can be of use to the OSHW community and expanded upon to make a reliable and safe platform for hobbyists and DIYers in the future.

This design is an Arduino compatible ATMega 328 design which has a switchable 15A rated mains pass through with some emphasis on safety and protection. IPC2221 clearances and creepage has been used where possible to reduce the potential for a fault to hurt the user. The mains inputs have MOVs to protect against any potential spikes coming through as well as a high quality EMI filter which provides high frequency filtering of the mains input via a common mode choke, Y class capacitors and a Bleeder resistor to discharge any residual charge in the device when unplugged. The design is also fused on the high side with a PPTC which will stop any temporary faults, a future revision may incorporate a replaceable fuse too (In the UK plugs come with fuses built in).

The design takes advantage of a cheap AC to DC converter which has been tested by the community to be bother reliable and safe. It gives an isolated DC output which has been bonded strongly to earth for safety as the user has access to the Arduino connectors. An isolated DCDC has been used to power the relay to protect the user and the circuit in case of a relay failure.

On the low voltage side an ATMega328 acts as the main microprocessor. The wireless side of the device is supplied by the NRF24L01+ modules which can be bought cheaply from China and easily formed into a star or mesh topology network which is desirable for home automation. One idea if desirable would be to change this to a Wi-Fi design instead.

Overall the idea of the project is to provide an easy to use mains passthrough with integrated wireless functionality for users to tinker with. Ideally it should just be plug and play and look like a standard Arduino from the outside whilst providing isolation and protection from the high voltages present in the mains during runtime.

  • Boards have arrived!

    Connel Hepburn12/29/2016 at 12:23 0 comments

    I sent the gerbers off to China as the UK board fabs were really expensive for a 10x10cm board (about £35-50 per unit!) and only could do 7 day turnaround at a sensible cost. I went with a fab called Smarter-Prototyping (NOA Labs) and they turned out quite nicely! I was able to get 10 boards with ENIG finish and blue solder mask on a 4 day turnaround for <£50 delivered with customs. The best part was, I sent the design out on the 15th December and had the boards in hand on the 23rd December before Christmas. Impressive turnaround overall. Some shots of one fo the boards are below.

    Whilst reviewing these boards I noticed a reasonably critical mistake in the isolation section. In my rush to get these boards out before Christmas it seems I got a bit excited and forgot to remove the planes around the relay pin area and the optoislolator , effectively only obeying clearance on the isolated DCDC output nets but none of the other nets. In the second revision I'll probably force every net on the isolated side to have a specific type of netclass and then ensure the clearance and trim the planes further back..

    The worse part seems to be the 5V which runs right next to the relay coil pin, therefore if there was a failure there would be a coupling mechanism to 5V through this pathway here. Still a lot to learn with isolated designs it seems :(. Therefore there is a potential safety issue of the relay coil does fail catastrophically.

  • Formalising the Design - Layout Done

    Connel Hepburn12/29/2016 at 12:02 0 comments

    Doing the layout took a while as I had to make all the footprint libraries for this project and KiCAD had a bit of a learning curve with some of it's odd quirks! The layout was a bit tricky due to the clearances required and the low Z space I had inside my enclosure. I plan to fit everything inside of this enclosure:

    It is a tad expensive at £3.66 but should do the job nicely for a prototype. EMI filtering and connectivity was taken care by with:

    The rest of the connectors are standard 0.1" header type ones. Layout is shown below:

    With this design it's very important that the live and neutral pins are mapped as shown in the layout to respect all the relevant clearances. Therefore this design is only suitable for keyed plug designs currently like we have in the UK. A reversable plug may not play nice with this revision.

    I also had this error come up as well, in case anyone else gets it, make sure to make sure there are no stray edge cut line objects hiding on top of another one. They won't be visible in the viewer but will give this error, so just find the culprit and delete it out.

  • Formalising the Design - Schematic Done!

    Connel Hepburn12/29/2016 at 11:29 0 comments

    The design has finally been captured in KiCAD. The design is effectively identical to the prototypes but I added in some extra features. There is a snubber for the relay output if the MOV has issues, I also added the ability to power the ATMega from 5V or 3.3V in order to avoid the need for level shifters in various projects.

    I added a buffer to the NRF24L01+ in order to deal with the potential "shifting" which can now happen. This also increases longevity by not using the 5V tolerant inputs. A side effect of this is increased power rail range, so you can drive the module off of 3.3V too!

    An isolated DCDC is used to drive the relay in case of relay failure coupling back to the MCU power rails which are accessable by the users.

  • Initial Prototype

    Connel Hepburn12/28/2016 at 18:24 0 comments

    To start off with I made a basic HW prototype. It was split into two parts, a transmitter and receiver although they are almost identical in terms of hardware. In order to improve the design of the iTead board I decided it would be good to use the mains to power the whole device. If you are doing a mains passthrough and have "unlimited" power, why not used that instead of having to have a micro USB or DC jack!

    To do this I used the HLK-PM01 modules by hi-link. Although these modules are cheap chinese modules - they seem to have a small following for projects like these and are very cheap. A great review can be found [here]( Mains to 5V 0.6A Hi-Link HLK-PM01 UK.html) (not my review):

    During my basic test I was able to achieve basic functionality with the modules, however I had a lot of dropped packets.I believe this was due to the modules I bought off of ebay being "fakes". There are alternate ASICs which are "NRF24L01+" compatible but with inferior performance coming from China. They require a very stable power supply, I had to solder 10uF tantalums directly to the module to alleviate the packet dropping issue.

    This is the main module to control the mains, I used the aforementioned HLK-PM01 and a cheap relay board from China to test out the initial functionality.

    I made a similar board without the relay and ACDC module on it to act as a controller which can be used with my PC.

  • Original Design Intent

    Connel Hepburn12/28/2016 at 17:58 0 comments

    In order to make a flexible platform for users we need to think about the criteria needed for this project.

    • Popular programmable microcontroller to be of use to a large community.
    • Safety of user from high voltage nets running in the device.
    • Small footprint so it can be integrated into more projects easily
    • Easy to operate and program for beginners, no easy way to pose a danger to one’s self.
    • Integrated wireless functionality of some sort for home automation use.

    Looking at these criteria it seems that Arduino would be the best microcontroller of choice. There are plenty of libraries and shields out there for expanding functionality of the device and a high number of users who could benefit from such a project.

    With respect to wireless there are many standards on the market currently. At one end there are the 433MHz modules and at the other Wi-Fi. The cost of adding a Wi-FI or Bluetooth module might be too great for some users and only Wi-Fi lends itself to the automation side due to everything usually being connected to a router.

    Therefore a small footprint Arduino compatible box of some kind along with an integrated NRF24L01+ module which can support star and mesh topology networks which is ideal for larger numbers of home automation devices. Perhaps a universal interface could be used to have many versions of wireless standards integrated in? Ideally a user could just use a shield if they were not happy with the NRF24L01+.

    Quite like this but better overall hopefully.

View all 5 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

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