How to Connect Arduino Industrial 101 to Cayenne

How to Connect Arduino Industrial 101 to Cayenne © GPL3+

How to connect Arduino Industrial 101 to Cayenne over MQTT, and send data from BMP180 and TSL2561.

  • 3,308 views
  • 0 comments
  • 9 respects

Components and supplies

Apps and online services

About this project

1. Connecting the Arduino Industrial 101 to Cayenne:

  • Creating a Cayenne account
  • Add new: Device/Widget
  • Bring Your Own Thing

2. Setting Arduino Industrial 101:

  • Enter the Arduino IP address into your browser and login

  • Enter the host, port, MQTT username, password, and ClientID from Cayenne
  • Save the changes

3. Upload the code:

  • Open Arduino IDE
  • Copy the code
  • Insert MQTT username and ClientID to code
  • Select the board, port
  • Upload the code

4. Done

  • Click + to add a widget

Done, everything works!

Code

CodeArduino
#include <Ciao.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
#include <Adafruit_TSL2561_U.h>

Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10180);
const int address = TSL2561_ADDR_FLOAT;
Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(address, 12345);

void setup()
{
  Ciao.begin();  
  Wire.begin();
  bmp.begin();
  tsl.begin();
  
  tsl.enableAutoRange(true);
  /* Changing the integration time gives you better sensor resolution (402ms = 16-bit data) */
  tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_13MS);      /* fast but low resolution */
  // tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_101MS);  /* medium resolution and speed   */
  // tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_402MS);  /* 16-bit data but slowest conversions */                       
}

void loop()                     
{
  sensors_event_t event;
  tsl.getEvent(&event);
  float pressure;
  bmp.getPressure(&pressure);
  float temperature;
  bmp.getTemperature(&temperature);

  Ciao.write("mqtt","v1/MQTTusername/things/ClientID/data/5", String(temperature));  //Replace MQTTusername and ClientID from Cayenne
  Ciao.write("mqtt","v1/MQTTusername/things/ClientID/data/6", String(pressure));
  Ciao.write("mqtt","v1/MQTTusername/things/ClientID/data/7", String(event.light));

  delay(2000);
}

Schematics

Schematic
2017 11 18 13 14 05 zsvv6lzsoi

Comments

Similar projects you might like

Sigfox to Cayenne

Project showcase by Tadeas Dvoracek

  • 1,538 views
  • 0 comments
  • 6 respects

MKR1000 Christmas IoTree with Cayenne Project Builder

Project tutorial by Benny Estes

  • 3,292 views
  • 3 comments
  • 9 respects

Christmas Tree Water Level via Cayenne and MKR1000

Project showcase by Ian Zahn

  • 2,452 views
  • 0 comments
  • 6 respects

Cayenne and SparkFun IoT 433 Mhz Sockets

Project tutorial by Giovanni Gentile

  • 2,417 views
  • 0 comments
  • 13 respects

Arduino + Cayenne = Light Quality Monitoring

Project in progress by Giovanni Gentile

  • 3,615 views
  • 0 comments
  • 11 respects

Arduino 101 Home BLE System

Project tutorial by Alexis Santiago Allende

  • 3,462 views
  • 0 comments
  • 14 respects
Add projectSign up / Login