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

Arduino Like Function on Kinetis K82 Freedom Stupid Board
Intermediate
  • 55
  • 4

Protip

1000 of K82 Freedom Boards are collecting dust because of the hobbyist unfriendly IDE, pump up the duds with easy Arduino-like functions.

Arduinomated Car Parking with Voice Assistance in Smartphone
Intermediate
  • 427
  • 10

Full instructions

Make an assistant which tells you about how much to drive backwards without any collision through your smartphone by Arduino and 1Sheeld.

Sigfox Forest Fire Detector
Intermediate
  • 2,784
  • 16

Full instructions

How to prevent forest from burning? A small Sigfox signal can prevent natural disasters. We will use an Arduino MKRFOX + a flame detector.

Traffic Monitor- Monitors traffic on the Go
Intermediate
  • 84
  • 2

Full instructions

The device uses color indication to display traffic on the road you are driving or you have selected.

Magic VR Hat
Intermediate
  • 706
  • 8

Wear the hat, get transported to different 360 VR experience.

Remote Lamp
Intermediate
  • 350
  • 4

Full instructions

How to make a lamp controlled by TV remote control.

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaFree StoreBlog