Arduino: Time Programs & Remote Control From Android App

4,433

40

9

Introduction: 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:

Step 1: 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:

  1. Tools → Board → Arduino Uno
  2. Tools → Port → the port to which you connected Arduino

Compile and upload the program.

Step 2: 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.

Step 3: Setup HC-05 Module

In this step we'll apply the configuration from step 2 to the bluetooth module. Follow these instructions:

  1. Disconnect USB cable from your computer.
  2. Press and hold the KEY button on your HC-05 module for 5 seconds while connecting USB cable.
  3. Click RESET button on your Arduino board.
  4. Wait 10 seconds before the configuration is applied.
  5. Disconnect USB cable and connect it again.

Step 4: 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.

Step 5: 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.

Step 6: 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.

Step 7: Connect to Your Board From Maya

Alright, so far so good. Open the app and connect to the board.

  1. On the welcome screen choose I already configured a board. Let's connect to it.
  2. Enable bluetooth and scan for available devices. Once your board is discovered (Arduino_Maya) please click on it.
  3. 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.
  4. In case for whatever reason you'll be disconnected, please report an issue using this link.
  5. 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

Be the First to Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Metal Contest

      Metal Contest
    • Maps Challenge

      Maps Challenge

    9 Comments

    0
    Deyvis17
    Deyvis17

    1 year ago

    Hola, está interesante pero en la app debe estar la opción de poner todo en español.

    0
    maroonbells.apps
    maroonbells.apps

    Reply 1 year ago

    Hi, I think for now I can provide machine translations for Spanish and later on I might decide for professional ones. Thanks for sharing - please install a new update (version 0.3.5).

    0
    Deyvis17
    Deyvis17

    Reply 1 year ago

    Gracias por responder, me acabo de fijar y si tengo esa versión.
    Pero no me sale la opción en español.

    0
    Deyvis17
    Deyvis17

    Reply 1 year ago

    Gracias, ahora sí está en español c: .
    Más bien podrías hacer un tutorial sobre el uso de la app :)

    0
    videoenquirer
    videoenquirer

    1 year ago

    Instead of having a hex file I always prefer an Arduino sketch to compile it later. That allows me to do any changes, for example in the use of pins or change the RTC and I think that in this way it´s more educative as well. If you could upload the sketch it could be better. If not, in anyway thanks, the hex could be useful for another reader.

    0
    maroonbells.apps
    maroonbells.apps

    Reply 1 year ago

    Hi there, good point. I had plans to upload it sometime but didn't have yet time to prepare it properly. The project was built using platformIO, therefore it might be not obvious that Arduino IDE won't work. However if you find it useful, you can check it here: https://bitbucket.org/vaaadus/maja-arduino.

    0
    Penolopy Bulnick
    Penolopy Bulnick

    1 year ago

    Nice job on your first Instructable :)