Things used in this project

Hardware components:
Xymc2ipmxxehlxiidqiv
Arduino Industrial 101
×1
BMP180
×1
TSL2561
×1
12002 04
Breadboard (generic)
×1
11026 02
Jumper wires (generic)
×1
Software apps and online services:
Ide web
Arduino IDE
Cayenne logo hi
myDevices Cayenne

Schematics

Schematic
2017 11 18 13 14 05 zsvv6lzsoi

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);
}

Credits

45 ofoeb6gw1h
Tadeas Dvoracek
5 projects • 15 followers
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

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog