LinkitONE Room Humidity Sensor

by ssarthak598 in Circuits > Arduino

610 Views, 2 Favorites, 0 Comments

LinkitONE Room Humidity Sensor

IMG_0867.JPG

Ever wanted to build something cool with electronics? Want to make your room environment sensor to check humidity of your room? Got a LinkitONE board? Then you are at the right place!

Here i'll show you how to make a humidity sensor using LinkitONE, (DHT11) which sends a message to your computer via serial about the humidity in the surrounding.

Let's begin...

What Do You Need?

IMG_0863.JPG

1) LinkitONE Board

2) DHT11 Sensor

3) micro-USB cable (for programming board)

4) Battery pack

5) Some jumpers

6) A breadboard (you can do this project without it)

Assembling the Parts

IMG_0868.JPG
IMG_0870.JPG

Here i'll show you how to assemble your sensors with the board.

First, take your sensor, you'll see 3 pins in it-

1) GND

2) DATA

3) VCC

Connect your sensor to a breadboard and then connect the GND pin to GND pin of your linkit, VCC to 5V, and DATA pin to A0 pin.

Finally connect everything and lets move on to the next step!

Writing Some Code

Capture.PNG

The code is really simple here! There's nothing much!

We're just taking a analog reading from sensor about humidity in the environment. We are first analyzing reading for 30 seconds and then giving back the readings.

CODE:

------------

#include "DHT.h"

#define DHTPIN A0

//#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup() {

Serial.begin(9600);

Serial.println("DHTxx test!");

dht.begin();

}

void loop() {

float h = dht.readHumidity();

float t = dht.readTemperature();

if (isnan(t) || isnan(h)) {

Serial.println("Failed to read from DHT");

}

else {

Serial.print(" %\h");

Serial.print("Temperature: ");

Serial.print(h);

} }

------------

Okay, so now burn this code to your board.

Testing It Out!

IMG_0866.JPG
Capture.PNG

Now test your device!

Just burn the code on your board from the previous step and then start! Open the serial monitor on the modem port of your Linkit. Carefully observe your readings. They update every 1/4 seconds. You can even plot a graph using opensource tools available online such as plotty or ubidots.

Final Touches

Congrats! You've built your own humidity sensor!

Now make a humidity detection box!

You'll have a lot of fun with it sensing humidity.