Things used in this project

Schematics

Arduino_101_BLE_Relayer Presentation
Workshop Slides and Presentation
Arduino101 BLE Workshop Presentation
Presenters Slides and Notes

Code

Arduino_101_BLE_RelayerC/C++
Uses the Arduino 101 Bluetooth wireless interface to control four output pins, connected to four (4) mechanical relay units capable of switching over an amp of current each.
/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Social networks:            http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  Note: This requires CurieBLE library
    from http://librarymanager/all#CurieBLE

  Warning: Bluetooth support is in BETA!
 *************************************************************/
/* This sketch uses four (4) Blynk virtaul pins to 
   control four (4) mechanical relay units.
*/
//#define BLYNK_USE_DIRECT_CONNECT

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <BlynkSimpleCurieBLE.h>
#include <CurieBLE.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

BLEPeripheral  blePeripheral;

int relay1_pin = 6;
int relay2_pin = 10;
int relay3_pin = 5;
int relay4_pin = 9;

BLYNK_WRITE(V1) {
  int pinData = param.asInt();
  digitalWrite(relay1_pin, pinData);
}

BLYNK_WRITE(V2) {
  int pinData = param.asInt();
  digitalWrite(relay2_pin, pinData);
}

BLYNK_WRITE(V3) {
  int pinData = param.asInt();
  digitalWrite(relay3_pin, pinData);
}

BLYNK_WRITE(V4) {
  int pinData = param.asInt();
  digitalWrite(relay4_pin, pinData);
}

void setup()
{
  // Debug console
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB
  }

  pinMode(relay1_pin, OUTPUT);
  pinMode(relay2_pin, OUTPUT);
  pinMode(relay3_pin, OUTPUT);
  pinMode(relay4_pin, OUTPUT);
  digitalWrite(relay1_pin, 0);
  digitalWrite(relay2_pin, 0);
  digitalWrite(relay3_pin, 0);
  digitalWrite(relay4_pin, 0);
  
  blePeripheral.setLocalName("hack01");
  blePeripheral.setDeviceName("hack01");
  blePeripheral.setAppearance(384);

  Blynk.begin(blePeripheral, auth);

  blePeripheral.begin();

  Serial.println("Waiting for BTLE connection...");
  
}

void loop()
{
  Blynk.run();
  blePeripheral.poll();
}

Credits

Twm 2006a
Tom Moxon

Chip Designer, Embedded Hardware and Software Design

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Direction Indicators for Bikes
Intermediate
  • 177
  • 5

Full instructions

Riding bike is a little dangerous. With the Direction Indicators for a bike, car's know if you want to turn right or left. Make biking safe!

Starry Night Prom
Intermediate
  • 1,593
  • 12

How did I stand out at prom? In a light up dress of course!

The Trump Button
Intermediate
  • 844
  • 7

Full instructions

The famous connected button to order your favorite drink using Sigfox network.

Third Eye for The Blind
Intermediate
  • 748
  • 11

Full instructions

An innovative wearable technology for visually impaired peoples.

ArduRadio AlarmClock
Intermediate
  • 1,708
  • 2

Full instructions

Build an FM radio with alarm clock.

Arduino: Switching ON/OFF Appliances Using IR Remote
Intermediate
  • 94
  • 2

Press 'Power' to switch everything ON/OFF. Press '1' for the fan and '2' for the lights.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login