App is now working. It controls a relay switch which is connected to the main garage door opener unit. Take a look at the video and tell me what you think.
Here is a schematic of the hardware and how its hooked up.
1) this is a Single Pole Double Throw (SPDT) relay. It is basically a switch that is controlled by a coil. When the coil gets energized (signal coming from the Arduino), it produces a small magnetic field and 'flips' the switch.
2) this is a diode used to protect the hardware from unwanted emf signals.
3) an NPN transistor used to provide enough current for the relay coil. The coil relay requires more current than the Arduino output pin can provide.
Bluetooth works just outside my home, but ideally I want to control the garage from anywhere I want. I will be modifying my App in order to communicate it with a computer through the internet. Stay tuned...
Here's a video showing my simple app establishing a connection with the Arduino device.
Since the only Bluetooth device that will be controlling the garage is the Arduino, I hardcoded the address of the Bluetooth module into my code, so I don't have to select it every time I start the app.
Here is a very crude run-through of what the app does to connect:
<Start App>
1. If Bluetooth on the phone is not enabled, then enable it.
2. Wait for Bluetooth to be enabled before continuing.
3. Prepare overhead needed for the Bluetooth connection, such as an address to the Arduino BT device, etc.
4. Start the connection to Bluetooth device.
5. Notify user if connected failed or succeeded.
<At this point, the connection is established, and I can send messages to the Arduino Bluetooth device as well as receive status updates>
I forgot to mention I had to write a simple program for the Arduino as well, to prepare the Bluetooth port for connection. All it does right now is prepare the port and wait for a connection request from the phone.
What I'll be working on next is sending a command from the phone to trigger the Arduino to send out a signal which will be used to open the garage.
Granted that this is my first time writing an Android app as well as first time writing Bluetooth code, I finally got my phone to connect to the Ardunio. I should have screenshots up by the end of the week, maybe even a video. #progress
This project will allow me to open my existing garage door with my Android phone (and if i'm up for it, I'll write an app for Iphone as well since everybody has one in this house). I will initially get this thing working using Bluetooth, but eventually, it will work via the internet. I will also add features which will tell alert me if the garage door is open or not.
I will be using an Arduino Uno which contains an Atmel ATmega328 microcontroller. This unit is the "brains" of this project and takes commands sent from the phone and will process it.
I also have a bluetooth shield which accompanies the Arduino Uno. Obviously, it will use Bluetooth as the communication protocol to send data and receive commands to the phone.
Android app in work, please subscribe and stay tuned...!
P.S. I would love your feedback, suggestions, and ideas for other projects! Subscribe me! =]