Arduino: Time Programs & Remote Control From Android App
by maroonbells.apps in Circuits > Arduino
5827 Views, 43 Favorites, 0 Comments
Arduino: Time Programs & Remote Control From Android App
I've always wondered what happens with all those Arduino boards that people don't need after they finish their cool projects. The truth is a bit upsetting: nothing. I've observed this at my family's house, where my father tried to build his own home automation solution but since he's an electrician he couldn't get over the programming part.
In this project I'm trying to address the problems he faced:
- Programming is hard.
- It takes time to build valuable software.
- Home made apps look boring and aren't user friendly.
It took couple of months to get it right, but the project was worth it. I intend to solve my father's problem by providing an Android app which connects over bluetooth and supports time programs, scenes & manual control out of the box without any programming knowledge. Let's start!
Supplies
Hardware:
- 1x Arduino Uno
- 1x HC-05 bluetooth module
- 1x DS1302 RTC module
- 1x Breadboard
- 3x Resistor 1k ohm (can be also 220 ohm or 10k ohm)
- 1x USB 2.0 cable type A/B
- 12x Jumper wires
- Smartphone with Android 5.0+ (bluetooth available)
- Laptop/PC
Software:
- Arduino IDE
- Maya App from Play Store
Upload Bluetooth Module Configuration
First, you must configure your bluetooth adapter from your laptop/PC. Connect Arduino board to USB port of your computer. Launch Arduino IDE, open new sketch, copy & paste the code below.
Code:
void setup() { Serial.begin(38400); delay(500); Serial.println("AT+NAME=Arduino_Maya"); delay(500); Serial.println("AT+BAUD=115200,0,0"); delay(500); Serial.println("AT+POLAR=1,0"); delay(500); } void loop() { }
Make sure these options are selected in your IDE:
- Tools → Board → Arduino Uno
- Tools → Port → the port to which you connected Arduino
Compile and upload the program.
Connect Bluetooth Module
Connect your HC-05 as presented on the scheme. General instructions:
- VCC connects to Arduino 5V pin.
- GND connects to Arduino GND pin.
- TXD connects to Arduino RXD pin.
- RXD connects to Arduino TXD pin through voltage divider as the logic voltage level of the data is 3.3V. Arduino TXD (transmit pin) is 5V, therefore if you won't use voltage divider, you'll burn your module.
Setup HC-05 Module
In this step we'll apply the configuration from step 2 to the bluetooth module. Follow these instructions:
- Disconnect USB cable from your computer.
- Press and hold the KEY button on your HC-05 module for 5 seconds while connecting USB cable.
- Click RESET button on your Arduino board.
- Wait 10 seconds before the configuration is applied.
- Disconnect USB cable and connect it again.
Connect DS1302 RTC Module
Connect your DS1302 as presented on the scheme. General instructions:
- VCC connects to Arduino 5V pin.
- GND connects to Arduino GND pin.
- CLK connects to Arduino pin 8.
- DAT connects to Arduino pin 7.
- RST connects to Arduino pin 6.
Upload Arduino Program
Yeah! All the hardware is set now. Let's catch up with software. First, download the firmware for your board available under this link:
Next, disconnect the HC-05 bluetooth module. This is very important as new code cannot be uploaded while the module is connected.
Use AVRDUDE
AVRDUDE is a tool used to upload firmware to AVR microprocessors, and it is included in the Arduino IDE so you already have it.
Windows
Open console and navigate to your Arduino IDE installation directory. Usually it's located somewhere in Program Files. Once you find it, navigate to this folder: /hardware/tools/avr/bin/.
Linux / Mac OS
If you installed Arduino IDE from official sources, you should already have avrdude added to your executable path.
Windows, Linux & Mac OS
Verify avrdude installation with this command. If help is displayed then you can proceed further. If you encounter any problems don't hesitate to ask Google about it.
avrdude --help
Upload firmware to your Arduino Uno board. Note: the firmware has been built specifically for Arduino Uno and it will not work for other Arduino boards.
avrdude -v -patmega328p -carduino -b115200 -P<arduino-usb-port> -D -Uflash:w:<path-to-firmware>:i
Once the firmware is uploaded, connect back the HC-05 bluetooth module.
Install Maya App From Play Store
Your board is now ready to be used. Download Maya App from Play Store for Android 5.0 or newer with available bluetooth adapter.
With Maya you can upgrade your house to be smart without investing lots of money in expensive brands. You can reuse the electronics you already have.
Time Programs - set your daily routines in a customizable time programs. For instance you can order your board to turn on and turn off periodically lights to scare off thieves.
Scenes - be spontaneous and activate actions which end up automatically after delay that you set.
Manual Control - works as a switch. Activate or deactivate pins according to your wish. For PWM pins percentage value is supported.
Connect to Your Board From Maya
Alright, so far so good. Open the app and connect to the board.
- On the welcome screen choose I already configured a board. Let's connect to it.
- Enable bluetooth and scan for available devices. Once your board is discovered (Arduino_Maya) please click on it.
- Bluetooth pairing starts. Android OS will ask you for the pin in order to connect to the board. For HC-05 it's 1234 by default.
- In case for whatever reason you'll be disconnected, please report an issue using this link.
- You are connected. Congratulations! :D
Useful links
Help Center: https://apps.maroon-bells.com/maya/help_center.html
Facebook Page: https://www.facebook.com/Maya-App-101016548192466
Maya in Play Store: https://play.google.com/apps/testing/com.maroonbells.maja