Internet of things project: Connect Arduino to Ubidots and Android – Part 1 & 2

by Francesco Azzola



Overview

This IoT project explores how to connect Arduino to Ubidots and Android. One important aspect in Arduino Internet of things programmin is how to connect arduino to internet and store date to IoT cloud platforms using arduino ethernet shield. This aspect is important because it is possible to store data in the cloud and then analyze it. Once the data, like sensor values, is on the cloud is possible to access it using smart phones and control remotely the Arduino board.

As soon as the temperature and humidity sensor starts reading values, it sends them through Arduino board to the cloud platform. The project uses Ubidots to store data in the cloud. This platform is easy to use and can be easily integrated with Arduino. Moreover, it has a built-in dashboard features, so that it is possible to creates interesting dashboard to show, using charts, the values sent from the board.

Components

  • W5500 Ethernet Shield
  • Arduino-Uno
  • DHT11
  • Ubidots

How to Build

  1. Connect the DHT11 to Arduino-Uno

  2. Import DHT11 Libary to Arduino IDE
    In this sketch, DHT11 sensor is connected to Arduino board, that, in turn, uses the Arduino Ethernet shield to connect to the network to send data. As first step, we check if everything is connected correctly trying to read the value of the temperature and the humidity. The snippet below shows the Arduino sketch to test the sensor:

    #include "DHT.h"
    #include <spi.h>
    #define DHTPIN 2
    #define DHTTYPE DHT11
    
    DHT dht(DHTPIN, DHTTYPE);
    
    void setup() {
     Serial.begin(9600);
     dht.begin();
    }
    
    void loop() {
     delay(50000);
    
     float h = dht.readHumidity();
     // Read temperature as Celsius (the default)
     float t = dht.readTemperature();
    
     Serial.print("Humidity: ");
     Serial.print(h);
     Serial.print(" %t");
     Serial.print("Temperature: ");
     Serial.print(t);
     Serial.println(" *C ");
    }
    
  3. Register the arduino to Ubidots & Import Ubidots Library to Arduino IDE

    http://things.ubidots.com/api/v1.6/collections/values
    

    Refer to Ubidots Dco

  4. Implements WebClient for Arduino
    Ubidots provides an example that can be useful. In Arduino, we have to develop an ArduinoHTTP client that calls a JSON service passing the data we want to store in the cloud.

    JSON Format :
    [{"variable": "varId", "value":val, "timestamp":timestamp},{"variable": "vardId1", "value":val1, "timestamp":timestamp1}]

Learn More

Goto Original
Get Free Arduino Things Free Source

블로그 이미지

MidnightCow

위즈네트 칩(W5300, W5200, W7100, W7500) 개발자

,