Things used in this project


Photon+WeatherShield Assembled


ParticleWeatherShield codeC/C++
// This #include statement was automatically added by the Particle IDE.

#include "SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.h"

char Disp[] = "DISPLAY_NAME";
char Locn[] = "LOCATION";

//Create Instance of HTU21D or SI7021 temp and humidity sensor and MPL3115A2 barrometric sensor
Weather sensor;

void setup()



 //Initialize the I2C sensors and ping them

 /*You can only receive acurate barrometric readings or acurate altitiude
 readings at a given time, not both at the same time. The following two lines
 tell the sensor what mode to use. You could easily write a function that
 takes a reading in one made and then switches to the other mode to grab that
 reading, resulting in data that contains both acurate altitude and barrometric
 readings. For this example, we will only be using the barometer mode. Be sure
 to only uncomment one line at a time. */

 sensor.setModeBarometer();//Set to Barometer Mode

 //baro.setModeAltimeter();//Set to altimeter Mode
 //These are additional MPL3115A2 functions the MUST be called for the sensor to work.
 sensor.setOversampleRate(7); // Set Oversample rate
 //Call with a rate from 0 to 7. See page 33 for table of ratios.
 //Sets the over sample rate. Datasheet calls for 128 but you can set it
 //from 1 to 128 samples. The higher the oversample rate the greater
 //the time between data samples.

void loop()

 // Measure Relative Humidity from the HTU21D or Si7021
 float h = sensor.getRH();

 // Measure Temperature from the HTU21D or Si7021
 float f = sensor.getTempF();
 // Temperature is measured every time RH is requested.
 // It is faster, therefore, to read it from previous RH
 // measurement with getTemp() instead with readTemp()

 char payload[255]; 

 snprintf(payload, sizeof(payload), "{ \"s\":\"wthr\", \"u\":\"F\",\"l\":\"%s\",\"m\":\"Temperature\",\"o\":\"%s\",\"v\": %f,\"d\":\"%s\" }", Locn, Org, f, Disp);
 Spark.publish("ConnectTheDots", payload);


 snprintf(payload, sizeof(payload), "{ \"s\":\"wthr\", \"u\":\"%%\",\"l\":\"%s\",\"m\":\"Humidity\",\"o\":\"%s\",\"v\": %f,\"d\":\"%s\" }", Locn, Org, h, Disp);
 Spark.publish("ConnectTheDots", payload);

 "event": "ConnectTheDots", 
 "url": "", 
 "requestType": "POST", 
 "json": { 
 "subject": "{{s}}", 
 "unitofmeasure": "{{u}}", 
 "measurename": "{{m}}", 
 "value": "{{v}}", 
 "organization": "{{o}}", 
 "displayname": "{{d}}", 
 "location": "{{l}}", 
 "timecreated": "{{SPARK_PUBLISHED_AT}}", 
 "guid": "{{SPARK_CORE_ID}}"


 "azure_sas_token": { 
 "key_name": "D1", 
 "key": "mBLQGWxSkRHg7f2eRCLonHUpNS+DY0iPHclxjf7Cmvk=" 
 "mydevices": true 


Paul DeCarlo

Technology Evangelist with an appetite for hardware hacking.



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


Similar projects you might like

PHPoc Blue to Control Door Knob by MQTT Protocol and Cortana
  • 111
  • 7

Programming a PHPoc Blue board to control a servo motor to rotate the knob of a door using MQTT Protocol through voice command.

Cat Door with Pet Recognition
  • 4,732
  • 22

Full instructions

Use object detection to let your cat in and out of the house with a motion-activated pet door.

Adding RC Transmitter/Receiver to Control Mecanum Bot
  • 583
  • 6

Full instructions

We previously showed our Mecanum Bot being controlled by a wireless Xbox controller, now we added RC transmitter/receiver.

ConnectTheDots with Particle Azure IoT Hub Integration
  • 582
  • 7


This project will allow you to connect your Particle device into an Azure IoT Hub for viewing data in real-time through an ASP.NET web app!

Other Clocks
  • 189
  • 3

Work in progress

A combination of 3 different clocks in one frame.

Lego Mindstorms  Elevator
  • 157
  • 2

A 3-story elevator with a mechanical door made from Lego Mindstorms and programmed on RoboCore. It moves up and down and reacts to buttons.

Lego Mindstorms Elevator

Team ElevatorRoboCore

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login