Home Automation With a Smartphone (TV, Arduino, Light, Security, Projector, DVD Player...)

by Imetomi in Circuits > Arduino

63321 Views, 799 Favorites, 0 Comments

Home Automation With a Smartphone (TV, Arduino, Light, Security, Projector, DVD Player...)

DSCN0166.JPG
DSCN0175.JPG
DSCN0178.JPG
DSCN0150.JPG
DSCN0181.JPG
FWE522IID0PRK6U.jpg

These days the home automation devices and the home controlling systems are very popular. Even in the community of DIY-ers. So decided to make my own home control device using Arduino. The device can be controlled with a cellphone, and here I used a very odd/wierd mode to transmit the commands from the phone. I used an INFRARED blaster to control my household items, like the TV, music amplifier, light switch, motion sensor alarm system. But this technology is also able to control almost any infrared gadgets gratitude for the ZaZa Remote app. Lot of smarphones have infrared blaster, but my one hasn't, so I needed to make one that can be attached to the audio jack. This was very simple and doesn't costs more than 0.5 bucks.

And yes, you could ask now that why am I using IR (infrared) and no Bluetooth or Wifi?

The answer is easy: -Usually the remote controlled household items can be controlled by an infrared transmitters, like music amplifiers, TVs, air conditioneers, digital photo frames, R/C toys, DVD players, switches, camera triggers and more. Now imagine that you can connect to these with your phone and control with only one device.

-It's easier to write the code on the Arduino, and it's cheaper than Bluetooth. You'll need some experience in Arduino, but I think that even a beginner can make.

What Is IR Light?

ad76f15f-94a4-4859-8e3f-933c32f2ebf0.jpg

Infrared (IR) is invisible radiant energy, electromagnetic radiation with longerwavelengths than those of visible light, extending from the nominal red edge of thevisible spectrum at 700 nanometers (frequency 430 THz) to 1 mm (300 GHz)(although people can see infrared up to at least 1050 nm in experiments. Most of the thermal radiation emitted by objects near room temperature is infrared. Thank you Wikipedia...

Build the Blaster

DSCN0076.JPG
DSCN0077.JPG
DSCN0078.JPG
DSCN0082.JPG
DSCN0079.JPG
DSCN0157.JPG
TVCnL.png

This is the easiest part of the project. You'll need 2 pieces of IR LEDs, a 3.5mm audio jack and some electrical tape. You can find these parts in the local Hobby-Shop. See the circuit diagram on the last picture and solder the LED pins to the left and right chanell. The GND isn't needed. If we solder the LEDs good we will have a very cool 38kHz infrared transmitter.

App Tutorial

Screenshot_2015-09-06-14-45-39.png
Screenshot_2015-09-06-14-48-34.png
Screenshot_2015-09-06-14-48-40.png
Screenshot_2015-09-06-14-50-50.png
Screenshot_2015-09-06-14-51-20.png
Screenshot_2015-09-06-14-49-04.png
Screenshot_2015-09-06-14-49-11.png
Screenshot_2015-09-06-14-49-34.png
Screenshot_2015-09-06-14-45-46.png
Screenshot_2015-09-06-14-46-31.png
Screenshot_2015-09-06-14-46-10.png
DSCN0182.JPG
DSCN0177.JPG

First Download the ZaZa Remote app on your phone or tablet (of course the project works even with other apps). Connect your new IR blaster, and you can see that here are a lot of possibilities, but we now will use the TV option. In the next step you will need to find the coding of your TV, this may take some minutes. After you found it you can use the phone to control the TV. I can't take a good photo about it but works. Now I'll show you how to send these commands to the Arduino.

Decoding the Signals

Arduino-TV-Remote-circuit.jpg
DSCN0110.JPG
Képkivágás1.PNG
Képkivágás3.PNG
Képkivágás2.PNG
DSCN0111.JPG

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}

void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
}

Decoding

DSCN0108.JPG
DSCN0109.JPG

Load up this code on your Arduino board and open the Serial Monitor and write every important codes. I wrote numbers, volume and chanell buttons and the power button.

Parts and Materials for the Arduino Circuit

DSCN0083.JPG
DSCN0085.JPG
DSCN0084.JPG
DSCN0087.JPG
DSCN0088.JPG
DSCN0089.JPG

First of all your CREATIVITY!

  • an Arduino Board
  • a smartphone
  • a plastic box
  • a PIR sensor
  • 2x 220 ohms resistors
  • a buzzer
  • a breadboard
  • a 38kHz IR reciever
  • an LED
  • a 5v relay
  • and some wires

I haven't time now to build a better circuit, that can control more things, because the Phone Contest closes soon, But if you use your creativity you can build anything (RC toys, drones, robots...)

Test the PIR

DSCN0118.JPG
DSCN0119.JPG
DSCN0120.JPG
DSCN0121.JPG

I tested my PIR sensor because if has problems can damage the 3rd pin on my Arduino, but worked perfect. I just used a 9 volt battery and an LED.

Build the Circuit

DSCN0091.JPG
DSCN0090.JPG
DSCN0092.JPG
DSCN0093.JPG
DSCN0094.JPG
DSCN0102.JPG
DSCN0095.JPG
DSCN0096.JPG
DSCN0098.JPG
DSCN0097.JPG
DSCN0099.JPG
DSCN0100.JPG
DSCN0101.JPG

I use an extension board because it's easier to build the curcuit with it.

  1. Connect the relay to the pin 6 and to the VCC and to the GND
  2. Connect the IR sensor to the GND, VCC and to the pin 11.
  3. Connect the PIR sensor also to the GND, VCC and to the pin 3.
  4. The LED is connected to pin 13.
  5. And lastly connect the buzzer through a 220 ohm resistor to the pin 9.

Yes, I said the Arduino part is easy. This is to inspire to make you to make something mindblowing device.

Write the Code!

DSCN0103.JPG
DSCN0104.JPG
DSCN0105.JPG
K&eacute;pkiv&aacute;g&aacute;s4.PNG

Download the Arduino file, load up and now you can try it out. If you have any question about the code feel free to ask. Replace the IR signal decoding with yours, example 0x0E0E005A.

Testing

DSCN0116.JPG
DSCN0117.JPG
DSCN0123.JPG
DSCN0114.JPG
DSCN0113.JPG
DSCN0124.JPG

I programmed the PIR on/off switch to the 1 and 2 pins. Well actually it's not a switch, only sets the pin 3 as an INPUT, and reads the signals (HIGH or LOW), and turns on the buzzer for 15 seconds. This is a very basic motion sensor alarm. The relay can be switched ON and OFF with the up and down arrows.

Drilling Holes for the Cables

DSCN0125.JPG
DSCN0126.JPG
DSCN0127.JPG
DSCN0137.JPG

Use a rotary tool or a drill, and make 2 holes for the USB cable and for light's cable.

Prepare the Cables

DSCN0129.JPG
DSCN0130.JPG
DSCN0131.JPG
DSCN0133.JPG
DSCN0134.JPG
DSCN0135.JPG
DSCN0136.JPG
DSCN0128.JPG

Clean the plastic cover then remove the cover from one of the wires. Then fix it with electrical tape. Just like on the pictures. For the power supply I'll use a a 5v 1A phone charger.

Connecting the Cables

DSCN0138.JPG
DSCN0139.JPG
DSCN0140.JPG
DSCN0141.JPG

Use a screwdriver and connect your light's cable to the relay module. Of course can connect other devices. :)

Search a Good Place for It!

DSCN0143.JPG
DSCN0142.JPG
DSCN0144.JPG
DSCN0145.JPG
DSCN0146.JPG
DSCN0147.JPG
DSCN0148.JPG
DSCN0151.JPG
DSCN0152.JPG
DSCN0153.JPG

If you found the best place for the box connect power up the device and test it agian.

The Last Test

DSCN0174.JPG
DSCN0168.JPG
DSCN0107.JPG
DSCN0154.JPG
DSCN0171.JPG
DSCN0167.JPG
DSCN0176.JPG
DSCN0172.JPG
DSCN0155.JPG
DSCN0173.JPG
Test your settings, buttons... everything... Thank you very much for watching, I hope it was helpful and useful for you. If you liked support me with a kindly vote on the phone contest. Share it, and follow me for more intresting projects! Thank you agian and #rethinkphone !