Things used in this project

Hardware components:
Compare particleelectron
Particle Electron
×1
Adafruit Soil Temperature/Moisture Sensor - SHT10
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
×1
09590 01
LED (generic)
×1
11026 02
Jumper wires (generic)
×1
Protection plastic case
×1
Adafruit industries ada592 image 75px
USB-A to Micro-USB Cable
×1
Software apps and online services:
Ubidots
Ubidots
Particle IDE

Schematics

Diagram connections
Particle sht1x bb 43s5x4pfaz

Code

CODEC/C++
// This example is to get the last value of variable from the Ubidots API

// This example is to save multiple variables to the Ubidots API with TCP method

/****************************************
 * Include Libraries
 ****************************************/

#include "Ubidots.h"
#include <SHT1x.h>
#include <application.h>

/****************************************
 * Define Constants
 ****************************************/

#ifndef TOKEN
#define TOKEN "Put_your_Ubidots"  // Put here your Ubidots TOKEN
#endif

#ifndef DATAPIN
#define DATAPIN D0
#endif

#ifndef CLCKPIN
#define CLCKPIN D1
#endif

#ifndef LED
#define LED D7
#endif

Ubidots ubidots(TOKEN);


/****************************************
 * Auxiliar Functions
 ****************************************/

SHT1x sht10(DATAPIN, CLCKPIN);

/****************************************
 * Main Functions
 ****************************************/

void setup() {
    Serial.begin(115200);
    pinMode(LED, OUTPUT);
    //ubidots.setDebug(true);  //Uncomment this line for printing debug messages
}

void loop() {
    
    float humidity = sht10.readHumidity();
    float temperature = sht10.readTemperatureC();
    
    ubidots.add("soil-moisture", humidity); 
    ubidots.add("temperature", temperature);
    
    ubidots.setMethod(TYPE_TCP);  //Set to TCP the way to send data
    if(ubidots.sendAll()){
        // Do something if values were sent properly
        Serial.println("Values sent by the device");
        digitalWrite(LED, HIGH);
    }
    delay(5000);
    digitalWrite(LED, LOW);
}

Credits

Generic icon taoacaqyns
UbiMaker

Maker @ ubidots.com

Contact
Foto%20carnet
Maria Carlina Hernandez

Hardware Developer Engineer & Content Specialist on Ubidots - IoT

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

Lightweight Sliding Door Automator
Intermediate
  • 1,535
  • 7

Work in progress

Automate the opening and closing of a lightweight sliding door (e.g. a screen door), including remote controls on your phone.

Christmas Gift Box
Intermediate
  • 3,633
  • 595

Full instructions

Christmas Gift Box plays music and sends an email when it is opened.

Carbon Fiber Vacuum Chamber
Intermediate
  • 2,905
  • 94

Full instructions

Our project is a carbon fiber vacuum chamber that is monitored by multiple particle photons and various sensors.

ConnectTheDots with Particle Azure IoT Hub Integration
Intermediate
  • 841
  • 8

Protip

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!

What should I wear outside?
Intermediate
  • 5,044
  • 67

Full instructions

A whimsical weather clock powered by Particle and forecast.io

Garage Door Opener with Blynk
Intermediate
  • 367
  • 2

Open, close and monitor a garage door opener with a smart phone using a Particle Photon and the Blynk application.

Add projectSign up / Login