Things used in this project

Hardware components:
Wunderbar relayr 02 1024x1024
Platinchen (Arduino compatible board plus integrated BLE)
Relayr - WunderBar Bridge
Gesture Sensor APDS-9960 - for hands free operation of blender
Proximity Sensor VCNL4000 - for level / volume detection in blender
Eclipse SmartHome supported switch (e.g. Belkin WeMo Switch)


Platinchen the tiny Arduino compatible board is using following code, receiving sensor data and streaming the data via the Wunderbar Bridge to the Open Cloud

This code was created during the #HackTheHouse in Berlin
by the blended team -
Includes code libraries provided by
Code is as it is  - might be changed and comes with no warranty
Download and install latest UART firmware and Arduino Libs from 
relayr gibthub


#include <SoftwareSerial.h>
#include <WunderbarBridge.h>

#include <Wire.h>
#define VCNL4000_ADDRESS 0x13  //I2C Address of the board

#define BRIDGE_DEBUG true

// SoftwareSerial mySerial(8, 10); // RX, TX
const int DEBUG_TX = 10;
const int DEBUG_RX = 8;

/*  Config the bridge module, the 3rd parameter is the baudrate,
    which has to be the same used in the PC serial monitor application*/
Bridge bridge = Bridge(DEBUG_RX, DEBUG_TX, 115200); 

const int led = 2;
const int button = 5;

void setup() {
	pinMode(led, OUTPUT);
	pinMode(button, INPUT);
        Wire.begin();  // initialize I2C stuff
        initVCNL4000(); //initilize and setup the board

static char dataOut[18];
/* Main Loop */
void loop() {
	static bridge_payload_t rxPayload;

	if (bridge.newData == true){
	rxPayload = bridge.getData();
        // no action here

  unsigned int ambientValue = readAmbient(); //can a tiny bit slow
  unsigned int proximityValue = readProximity();

  int length = snprintf(dataOut, 18, "%d", proximityValue );
  bridge.sendData((uint8_t*) dataOut, length);

/* the serialEvent() handler is called on every received data 
from the serial port. */
void serialEvent(){

void initVCNL4000(){
  byte temp = readVCNLByte(0x81);

  if (temp != 0x11){  // Product ID Should be 0x11
    //Serial.print("initVCNL4000 failed to initialize");
    //Serial.println(temp, HEX);
    //Serial.println("VNCL4000 Online...");

  /*VNCL400 init params
   Feel free to play with any of these values, but check the datasheet first!*/
  writeVCNLByte(0x84, 0x0F);  // Configures ambient light measures - Single conversion mode, 128 averages
  writeVCNLByte(0x83, 15);  // sets IR current in steps of 10mA 0-200mA --> 200mA
  writeVCNLByte(0x89, 2);  // Proximity IR test signal freq, 0-3 - 781.25 kHz
  writeVCNLByte(0x8A, 0x81);  // proximity modulator timing - 129, recommended by Vishay 

unsigned int readProximity(){
  // readProximity() returns a 16-bit value from the VCNL4000's proximity data registers
  byte temp = readVCNLByte(0x80);
  writeVCNLByte(0x80, temp | 0x08);  // command the sensor to perform a proximity measure

  while(!(readVCNLByte(0x80)&0x20));  // Wait for the proximity data ready bit to be set
  unsigned int data = readVCNLByte(0x87) << 8;
  data |= readVCNLByte(0x88);

  return data;

unsigned int readAmbient(){
  // readAmbient() returns a 16-bit value from the VCNL4000's ambient light data registers
  byte temp = readVCNLByte(0x80);
  writeVCNLByte(0x80, temp | 0x10);  // command the sensor to perform ambient measure

  while(!(readVCNLByte(0x80)&0x40));  // wait for the proximity data ready bit to be set
  unsigned int data = readVCNLByte(0x85) << 8;
  data |= readVCNLByte(0x86);

  return data;

void writeVCNLByte(byte address, byte data){
  // writeVCNLByte(address, data) writes a single byte of data to address

byte readVCNLByte(byte address){
  // readByte(address) reads a single byte of data from address
  Wire.requestFrom(VCNL4000_ADDRESS, 1);
  byte data =;

  return data;

Project logs

Visualize sensor data
Project log #1
On Mar 2, 2015 at 4:13 PM - 0 comments

to further improve the solution we used the relayr Python APIs to stream the sensor data to for better analytics of the sensor data - works great!

Noice on the level sensor need filtering


Guido web
1 project • 146 followers
Sascha wolter 20131113
Sascha Wolter
1 project • 3 followers
Sascha is a Developer, Innovation Manager, and Keynote Speaker with Passion for IoT, Rich Applications and Mobile Apps in all flavors.


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


Add projectSign up / Login