Control a fan with smartphone gesture (Arduino Home Hacks #2)

Welcome to our home automation hacks series #2, today I am going to show you how to hack your home outlets with Arduino and a phone gesture 😉 .This time I used Accelerometer sensor shield from 1Sheeld application. And with a simple gesture it will open\close the outlet to trigger the fan on or off according to it’s last state. So let’s start with

1- Components

These are the components we need, so we will test the system first before hacking our real home plug.
1- Arduino Uno
2- 1Sheeld
3- Relay board
4- Wired outlet
5- Female to Male jumpers
6- USB cable
7- Smartphone
8- Screw driver

2- Connections


1- So we got the wired outlet to simulate and test the process of controlling devices (which is a fan in our case). It comes with two wire lines, at first we gonna cut one of these wires and strip the ends to wire them to our relay board on ports (Common and Normally open).
2- Then connect the relay board to the 1Sheeld&Arduino on Vcc, GND & pin13 for the signal line.

3- Code

Here’s the full working code. The code uses the Accelerometer sensor library provided with the 1Sheeld library to control pin13 (which already connected to the relay signal pin) and with a simple gesture by shaking off the phone it will trigger the fan on/off.

4- Testing


1- Now plug your arduino to your PC/Laptop and upload the code (make sure first to put your 1Sheeld to uploading mode preventing errors).
2- Open 1Sheeld application and connect to 1Sheeld board.
3- Now switch back the 1Sheeld to “Operating mode”.
4- Choose Accelerometer sensor shield, and check the Linear acceleration option from the check box.
5- Now shake the phone to turn on/off the fan.

5- Designs


The same as before in #1 hack, I have an already designed 3D case to hold my electronic parts together, you can check it out and download the files from Here, and as usual feel free to design your own 3D cases for your extra electronic parts 🙂 .

6- Deployment


1- After testing we gonna wire thing on a real home outlet, but before touching or unscrewing anything, cut the power off the outlet (as stated before) and do the job.
2- Now unscrew the outlet face cover and reach in to one of the wire lines, cut&strip it the same way we did in testing.
3- Connect the two stripped ends to the relay board.
4- Power up the system with a 12V DC adapter or with a 9V battery.
5- Return the power back to the outlet, then open the application, connect and open the accelerometer sensor shield.
6- Now Plug in the fan and make sure it’s opened and shake the phone to enjoy the hack.

Second hack done..! stay tuned for more hacks 😉 .




Related Blogs

Control home lights with your voice (Arduino Home Hacks #1)

It’s now the age were the word “Hack” is a relevant word we see and hear everywhere, and i don’t mean the software cyber hacks,I am talking about DIY hacks 😀 . We made this Home Automation Hacks series to help you add fun features to your home stuff by doing it yourself 😉 . …

Display traffic status on an IKEA clock with Arduino and 1Sheeld

Whenever it’s time to get off the office, I always check the traffic status to choose the best time to go home. But I couldn’t find a way to do that autonomously. So then …. I was up to make a system that shows me the current traffic status with the help of a simple tool that is used …

Log noise level on cloud using Arduino & 1Sheeld

Nowadays people started integrating stuff with the internet for their daily uses, and fortunately, it’s not hard to do so..! as there are a lot of hardware/software tools that ease the development of such applications. One of these tools is the 1Sheeld’s Internet shield, which allows your arduino board to connect to a mobile application …

Arduino’s SoftwareSerial vs AltSoftSerial: Which library to use with 1Sheeld+ ?

The newer version of 1Sheeld (1Sheeld+) built to support both iOS and Android devices,but not just that …! There’s another secret feature supported to solve the problem of using extra shield/board over 1Sheeld+, and this shield/board have the same way of communication used by 1Sheeld+ (The hardware UART serial pins pin0&pin1) with your Arduino. Exactly …

NFC Module for Arduino

Top 3 NFC modules for Arduino

We can see how much RFID applications are being used in our daily life like in the elevators, many facilities entrances or even in some supermarkets but have you ever thought of how it works? RFID stands for “Radio Frequency ID” so it’s uniquely identifying items through radio frequency and it composed out of three main …

Top 5 Data logger Modules for Arduino

Top 5 Data Logger Modules for Arduino

Want to store your Arduino project’s data, measurement’s or sensor readings for future analysis?  Then you are in the right place, cause today I’m gonna list here the best 5 Arduino Data logger Modules. Data logger gives you the ability to track your system statistically and check how it worked over certain intervals . You can also …