Introduction: LinkitONE Temperature Sensor

About: I build products which solve real world problems.

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

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

Let's begin...

Step 1: What Do You Need?

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)

Step 2: Assembling the Parts

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!

Step 3: Writing Some Code

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

We're just taking a analog reading from sensor about temperature 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(" %\t");

Serial.print("Temperature: ");

Serial.print(t);

Serial.println(" *C"); } }

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

Okay, so now burn this code to your board.

Step 4: Testing It Out!

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.

Step 5: Final Touches

Congrats! You've built your own temperature sensor!

Now make a temperature detection box!