Bluetooth Communication Challenge (Arduino Uno & Android App)

Manners & Respect To Everyone Reading This Thread.

I Am Having A “SMALL” Issue Right At The Last Stage Of My Setup. What I Am Trying To Accomplish Is As Follows… Hopefully Someone Will Be Able To Point Me In The Right Direction. prays silently

I have an Arduino Uno + Bluetooth HC06 Module + 2 Channel Relay + Android Device

I Am About To Install One Of The First Gaming Kiosks In A Rural Area Of Jamaica & How I Intend To Utilize The Arduino & Components Listed Above is as follows:

On The Android App:
- (Button 1 & Button 2) When Clicked, Sends Bluetooth Text Command To Switch The Corresponding Relay On The Arduino To (ON) And Starts A 10 Minute Countdown Timer.

- (Button 1 & Button 2) When Long Clicked, Sends Bluetooth Text Command To Switch The Corresponding Relay On The Arduino To (ON) And Starts A 20 Minute Countdown Timer.

- (Button 3 & Button 4) Adds An Additional 10 Minutes to the Remaining Time For Each ‘button’ or ‘timer’

  • When Corresponding Timer For A Button Reaches 0 (ZERO), A Bluetooth Text Command Is Sent To Switch The Corresponding Relay On the Arduino To (OFF)

EVERYTHING WORKED PERFECTLY FINE UNTIL I STARTED TESTING THE SYSTEM IN A REAL LIFE SCENARIO.

What I Realized Is That The Arduino RELIES On The Android App To Tell It When To Switch The Relays Off, Which Poses A Problem When The Relays Are Turned On And The App Is Closed Or Battery Dies Or The Android Goes Out Of Range Etc. The Relays Would Stay On Forever Resulting In Unregulated Use Of The Kiosk. ← What I Really Mean Is Uncollected Funds.

I have a sketch loaded to the Arduino which reads text input from bluetooth
-When I send the command “1”, RELAY #1 switches LOW (ON)
-When I send the command “2”, RELAY #1 switches HIGH (OFF)
-When I send the command “3”, RELAY #2 switches LOW (ON)
-When I send the command “4”, RELAY #2 switches HIGH (OFF)

I Did Some Research On The Matter And Kept Ending Up At The “Blink Without Delay” Sketch As A Potential Resource To Assist Me In Achieving My Goal. I Was Also Looking At The “Call And Response” Sketch But I’m Baffled.

IS IT POSSIBLE TO HAVE EACH RELAY TURN OFF AUTOMATICALLY AFTER A SET INTERVAL IF THE HC-06 IS NO LONGER CONNECTED?

I have attached the .ino file for the sketch I’m using and a picture/screenshot of the android app.

THANKS FOR TAKING THE TIME TO READ THIS THREAD AND I’LL APPRECIATE ANY ADVICE, COMMENTS/SUGGESTIONS YOU MAY FEEL LED TO OFFER.

kiosk_relay_sketch.ino (1.46 KB)