Grove Starter Kit For Arduino --- Temperature Sensor

Grove Starter Kit For Arduino --- Temperature Sensor © LGPL

Teaches you how to use the temperature sensor in the Arduino Grove Starter Kit.

  • 1,812 views
  • 0 comments
  • 5 respects

Components and supplies

Apps and online services

About this project

Note: I do not talk about the LCD screen in this project, If you haven't yet installed the library for it or need help with it please go here.

Setup:

As far as hardware, all you need to do is connect the temperature sensor to A0:

Code:

First you must find the initial value of the thermistor:

a = analogRead(0); 

Then, since the resistance is what tells us the temperature, we must convert the reading to the resistance:

resistance = (float)(1023 - a) * 10000 / a; 

And finally we convert the resistance to Celsius:

c = 1 / (log(resistance / 10000) / b + 1 / 298.15) - 273.15; 

Code

temp.inoArduino
#include <math.h>
#include <Wire.h>
#include "rgb_lcd.h"
int a; //thermistor value
float c;
int b = 3985;      //b value of the thermistor
float resistance;

const int colorR = 0;
const int colorG = 0;
const int colorB = 255;

rgb_lcd lcd;

void setup(){
  lcd.begin(16, 2);
  lcd.setRGB(colorR, colorG, colorB);
}

void loop(){
  a = analogRead(0); //find the original reading of the thermistor
  resistance = (float)(1023 - a) * 10000 / a; //get the resistance of the sensor;
  c = 1 / (log(resistance / 10000) / b + 1 / 298.15) - 273.15; //convert to Celsius via datasheet&nbsp;;
  int f = (c*(9/5)+32);//convert to F (delete if you want C)
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("temperature is:");
  lcd.setCursor(0,1);
  lcd.print(f);//print the F temp on the lcd screen (change to: lcd.print(c); if you want C)
  lcd.print("f");//change to lcd.print("c"); if you want C
  delay(1000);//wait 1 second
}

Schematics

temperature setup
Grove temperature sensor ex kgzkqirqer

Comments

Similar projects you might like

Grove Starter Kit for Arduino: Touch sensor

by Grant

  • 717 views
  • 1 comment
  • 2 respects

Grove Starter Kit For Arduino --- RGB LCD

by Grant

  • 5,454 views
  • 2 comments
  • 7 respects

How To Use DS18B20 Water Proof Temperature Sensor

Project showcase by Team IoTBoys

  • 35,433 views
  • 11 comments
  • 15 respects

Arduino Temperature Control

Project tutorial by Team pandhoit

  • 18,234 views
  • 10 comments
  • 28 respects
Add projectSign up / Login