Introduction: Operating & Monitoring State of Multiple AC Load Switches Using the Mediatek LinkitONE

Hello everyone. Glad to publish my first ever instructable. A bit of introduction towards this instructable. Almost everyone of us deals with AC loads in our houses and offices. From fans to refrigerators, all those sophisticated gadgets that make our life easier operate on some kind of power; AC in most cases. And electrical/electronics hobbyists, more often than not encounter situations wherein they need to control/monitor such loads. AC or Alternating Current is however a generic term for everything that involves high frequency alternating electrical quantities. Alternating power, is infact close to correct.

Alright, so switching AC loads is fun and dangerous considering the danger associated with AC power. Here, at this point it would be imperative to point out that if in case you don't feel confident enough to handle AC yourself, consider involving a qualified electrical technician or someone who is well versed with due considerations to safety.

More often than not, in projects where AC loads need to be switched or monitored, we use the most common electromechanical relays that have an electromechanical coil inbuilt and all the physics involved is mostly based on the concepts of electromagnetics. Such relays, while being easily accessible and cheap in terms of economics, possess a few inherent drawbacks. First, the electromechanical relays suffer from something called debouncing which in brief is defined as the time lapse involved in the change of state of a switch from a perfectly open state to a perfectly closed state. The shutter or latch that connects the two terminals takes a finite time to change its state while also oscillating multiple times before the switch or relay settles to a perfectly closed state ( a binary "1" equivalent ). This affects the operation of relay and depends on the number of times the relay has been used. Although, this can also result due to manufacturing defects, but that is something we rarely come across. Another drawback associated with operation of such relays is arcing wherein sudden impulses of very short duration appear towards the terminals where the load is connected. This not only degrades the relay but also leads to electrical surges that can potentially damage the loads connected. The invincible solution to this problem lies in using Solid State Relay(s) or SSRs which, in simplest of forms, consist of an optocoupler having input and output terminals. These relays have no moving parts and as such are solid state. Modern SSRs have inbuilt snubber circuits for surge protection and EMI protection while also eliminating the debouncing that was associated with electromagnetic relays, as explained earlier. Although SSRs , indeed are very useful and handle AC loads fairly efficiently, they are costly owing to the sophisticated processes involved in their manufacture while also integrating a number of integrated circuits inside a small package. The cost considerations ask for a suitable alternative, both in terms of cost and efficiency of operation. This lies at the core of this project wherein i have tried to address these the aforementioned issues so as to come up with a very reliable alternative. In addition, i have also used the circuit to control/monitor AC loads by using a circuit driven on the input side by this awesome piece of hardware called Mediatek LinkitONE. I am a proud owner of one, myself ( thanks to the guys at instructables who sponsored the LinkitONE giveaway). The board has a multitude of connectivity options both in terms of wireless and wired ( the only exception being the absence of a dedicated ethernet jack for wired LAN but that's ok considering the relaively small board area that makes it an ideal candidate for miniature IOT projects that exploit the connectivity options to full potential)

Step 1: Constructional Details

The circuit is a simple implementation with a few easily available components put together. The images are self explanatory. Although any number of such circuits can be implemented ( which inevitably leads to using a suitable line driver or current driver for providing sufficient driving current to the input terminals because the LinkitONE GPIO pins provide a limited current, not enough for driving an array of such circuit implementations), i kept the number of individual switching circuits to 3. One more point to be noted is that the components have been chosen while keeping in mind the availability of suitable alternatives easily( in case you fail to locate the exact parts). The schematic was drawn in Proteus 8.0 and other images were produced using Fritzing. A bit of CorelDraw expertise was also put to use.The 3 individual fritzing images show the three different circuits( although same in terms of the implementation).

Step 2: The Firmware

The firmware is concise and self explanatory. The 3 individual circuits were connected to the GPIO pins 5, 6 and 7 of the LinkitONE that monitors the state of each circuit in a cycle. This process is reiterated after a fixed interval so as to know which circuit is functioning and which one has failed. This helps to transfer control to other circuits incase one or more circuit behave abnormally or fail potentially. As i pointed out earlier that a number of such circuits can be implemented, keeping in mind the necessary changes that need to be made in order to include extra components and also to make the necessary changes in the firmware. A text file with the code is listed along with the BOM images which are pretty concise considering the simplicity although efficiency that this project provides. What's more !!! It's economical too. Enjoy !!!

Step 3: