This is a short tutorial to see how we can control an AC voltage application (an AC Lamp in our case) that depends on a motion sensor. The biggest problem we face in controlling any AC voltage application is:
- Safety
- Easy and reliable method for everyone
The relay is a common way to control AC voltage with many disadvantages:
- Unprotected pins may cause an electrical shock hazard.
- Needs someone with full understand of how to connect the wires and where, any mistake is unforgivable, so it's not for everyone to do.
- Cut many wires, prepare AC plug in and AC socket to connect everything together which make the connection more complicated and dangerous.
Instead of a relay, we will use a unique device called (Sugar). This device is designed to control an AC voltage application using any development platform (Arduino, Raspberry Pi, IOT boards, etc.) and no naked wire required to connect the AC load or even the data cable.
Sugar is revolutionary device and if you like the idea of it and support it, you can today become a backer for Sugar device team at Indiegogo, all information you can find it in the campaign and also in Sugar website and see Sugar features and more tutorials.
Returning to our tutorial, all that we need is a just a few components:
- Arduino Board (Uno, Mega, mini, etc).
- PIR Motion sensor.
- Sugar device.
- RJ12 Cable.
- RJ12 breakout.
- AC Lamp+AC lamp socket
- AC C14 Power cord.
- Breadboard
- Jumpers (Male-Male).
As a step-by-step procedure, this is a schematic connection for Arduino and motion sensor. The RJ12 breakout comes with the Sugar device, and it's an easy way to connect RJ Cable between Sugar and Arduino "No need to cut wires and check schematics many times so no need to worry about a short circuit".
We connect Arduino D9 pin to RJ12 breakout, to control Sugar you need to send PWM signal, this is an advantage to allow all development platforms to control sugar easily and useful for more advance application (Sugar also can control AC output voltage for applications like AC dimmer lamp, AC induction motor speed control).
Some pictures to show you the connections:
If we want to turn on AC lamp connected to Sugar we write:
Brightness=64;
analogWrite(Sugarpin,Brightness);
If we want to turn off AC lamp connected to Sugar we write:
Brightness=12;
analogWrite(Sugarpin,Brightness);
And this video shows hows the circuit works:
Finally, if you like Sugar device, please support us on Indiegogo now.
Thanks!
Comments