Bag - 0

Labs

view

Simple Voice Controlled Home Automation

Ever wanted to make your home automatically do what you ask it? In this guide, I make a cheap home automation system that you can control with your phone and/or your voice! This is just an extremely ba...
view

How To Make An Android App In 7 Minutes!

When it comes to being a good tinkerer, a great tool to have in your arsenal is the ability to quickly mach up a mobile app. But programming an app from scratch is very time consuming. So I’m goi...


Step 1

Setting Things Up

My goal here is to make a simple voice automation system that can turn an appliance on and off. I chose a desk lamp because that seemed like the simplest appliance to start with. The basic concept is to add an object between the lamp plug and the wall outlet that can allow us to control the flow of power to the lamp. A relay is an ideal solution because it acts like a switch that can be turned on and off by small electric pulses. From the parts list above, you can see that I have two different types of relays listed. The first relay is a cheaper option, but it requires wiring it directly into the lamps power cord, which could be hazardous depending on your electrical knowledge. To make things easier, I opted for a more expensive option which is basically a power cable with a relay built in. All I have to do is plug one side into the wall and the other side into the wall and the other side into the lamp. Now I need a way to trigger the relay automatically.


Step 2

Triggering Mechanism

To trigger the relay, I need something that can accept some type of input from me and convert it to an electrical pulse that it sends to the relay. My go-to device for this type of thing is an Arduino. Setting it up is actually pretty straightforward. On my relay, there is a +in and -in terminal that I connected two wires to. Then I connected +in wire to the 8 pin on the Arduino and the -in wire to a GND pin on the Arduino. For a basic setup, that’s all that’s all the wiring it takes. Next I need to program the Arduino to send an electric pulse to the relay when I give it a command. The code below reads the Arduino serial monitor for a “1” or a “2”. The number 1 will send a pulse to Pin 8 turning the lamp on, and number 2 will kill that pulse turning the lamp off. So I uploaded the code to my Arduino.



Step 3

Making It Wireless


At this point, I have a working solution, but it’s not wireless. To do so, I chose to add a bluetooth module to the Arduino. I chose Bluetooth because, as you’ll see, it’s easy to connect to an Arduino, and it’s easy to pair with a smartphone or tablet. To wire it up, you can use the diagram below. Keep in mind that if your bluetooth module supports 5v, you may want to wire it to the 5v Pin on the Arduino instead of 3.3v.

Bluetooth | Arduino

TX | RX

RX | TX

GND | GND

VCC | 3.3v

Now that I’ve added the bluetooth module, I need to tweak the code to allow for the Arduino to read input from the Bluetooth device. Also, keep in mind before uploading it that you will need to temporarily unplug the RX and TX wires in order for the code to upload successfully.


Step 4

Making The App

Now everything should be done from the Arduino side. The last thing to do is make a nice little interface for my mobile device to allow it to control the Arduino. The app I created was using App Inventor from MIT. If you aren’t familiar with it, you can watch my tutorial on how to make an App in 7 minutes. I created a simple interface that has buttons for connecting and disconnecting bluetooth (IMPORTANT: The bluetooth device must already be paired with the mobile device before using this app). I also had buttons for turning the light on and off. I also found that App Inventor had the functionality for integrating voice commands so that I could use my voice to tell the light to turn on and off. Below is the App Inventor layout.

app01

And below you can see the backend blocks of app inventor to see how it was programmed. You can download my app from the app store at this link.

app02