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

Arduino: Switching ON/OFF Appliances Using IR Remote
Intermediate
  • 10
  • 1

Press 'Power' to switch everything ON/OFF. Press '1' for the fan and '2' for the lights.

ConnectTheDots with Particle Azure IoT Hub Integration
Intermediate
  • 467
  • 6

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!

Other Clocks
Intermediate
  • 170
  • 3

Work in progress

A combination of 3 different clocks in one frame.

Cat Door with Pet Recognition
Intermediate
  • 4,322
  • 21

Full instructions

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

ArduRadio AlarmClock
Intermediate
  • 88
  • 1

Full instructions

Build an FM radio with alarm clock.

Web-Based Voice-Controlled Robot!
Intermediate
  • 49
  • 1

Full instructions

Add voice control to your Arduino robot!

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login