Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
dspenas
Published

Smartwatch - Arduino LED Control

This project shows the first prototype of a connection between a smartwatch and Arduino for controlling eight LEDs.

IntermediateWork in progress15,054
Smartwatch - Arduino LED Control

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
LEDs
×1
SparkFun Bluetooth Modem - BlueSMiRF Silver
SparkFun Bluetooth Modem - BlueSMiRF Silver
The bluetooth module used was "HC-05"
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Resistor 221 ohm
Resistor 221 ohm
×1
Pebble Watch
Pebble Watch
The smartwatch used was "Smartwatch QW09"
×1

Software apps and online services

Arduino IDE
Arduino IDE
MIT App Inventor
MIT App Inventor

Story

Read more

Schematics

Arduino-HC 05-Leds-Connection

Smartwatch QW09

APP programming 1

APP programming 2

Code

Arduino - bluetooth code

Arduino
# include <SoftwareSerial.h>
SoftwareSerial bt_serial(2, 3);
String peticion = "";
char c = ' ';

void setup() {
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);
  bt_serial.begin(38400);
  bt_serial.setTimeout(5);
  Serial.begin(9600);
}

void loop() {
  if (bt_serial.available() > 0) {
    while (bt_serial.available() > 0) {
      c = bt_serial.read();
      peticion += c;
    }
    Serial.println(peticion);
    if (peticion == "act1on") {
      digitalWrite(4, HIGH);
      Serial.println("Uno on");
    }
    if (peticion == "act1off") digitalWrite(4, LOW);
    if (peticion == "act2on") digitalWrite(5, HIGH);
    if (peticion == "act2off") digitalWrite(5, LOW);
    if (peticion == "act3on") digitalWrite(6, HIGH);
    if (peticion == "act3off") digitalWrite(6, LOW);
    if (peticion == "act4on") digitalWrite(7, HIGH);
    if (peticion == "act4off") digitalWrite(7, LOW);
    if (peticion == "act5on") digitalWrite(8, HIGH);
    if (peticion == "act5off") digitalWrite(8, LOW);
    if (peticion == "act6on") digitalWrite(9, HIGH);
    if (peticion == "act6off") digitalWrite(9, LOW);
    if (peticion == "act7on") digitalWrite(10, HIGH);
    if (peticion == "act7off") digitalWrite(10, LOW);
    if (peticion == "act8on") digitalWrite(11, HIGH);
    if (peticion == "act8off") digitalWrite(11, LOW);
  }
    peticion = "";
    c = ' ';
}

Credits

dspenas
1 project • 9 followers

Comments