Grove - Temperature Sensor

From Wiki
Jump to: navigation, search

Introduction

The Grove - Temperature Sensor uses a Thermistor to detect the ambient temperature. The resistance of a thermistor will increase when the ambient temperature decreases. It's this characteristic that we use to calculate the ambient temperature. The detectable range of this sensor is -40 - 125ºC, and the accuracy is ±1.5ºC


400px-Temperature1.jpg

Specifications

Voltage: 3.3 ~ 5V Max power rating at 25℃: 300mW Zero power resistance: 10 KΩ Operating temperature range: -40 ~ +125 ℃ Demonstration

With Arduino Here is an example to show you how to read temperature information from the sensor.

1. Connect the module to the Analog port 0 of Grove - Basic Shield using the 4-pin grove cable.

2. Plug the Grove - Basic Shield into Arduino. 3. Connect Arduino to PC by using a USB cable.

Tempreture Sensor Connector.jpg

4. Upload Code below. Please click here if you do not know how to upload.

/* /* Grove - Temperature Sensor demo v1.0

  • This sensor detects the environment temperature,
  • Connect the signal of this sensor to A0, use the
  • Serial monitor to get the result.
  • By: http://www.simgin-chip.com
  • /
  1. include <math.h>

int a; float temperature; int B=3975; //B value of the thermistor float resistance;

void setup() {

 Serial.begin(9600);  

}

void loop() {

 a=analogRead(0);
 resistance=(float)(1023-a)*10000/a; //get the resistance of the sensor;
 temperature=1/(log(resistance/10000)/B+1/298.15)-273.15;//convert to temperature via datasheet ;
 delay(1000);
 Serial.print("Current temperature is ");
 Serial.println(temperature);
}

5. You can check the readings via the Serial Monitor. The default unit is Celsius degree.


Temperature Sensor Score.jpg

As a reference, the following is the resistance curve of TTC3A103*39H, the thermistor we used on this sensor. The higher the temperature goes, the smaller the resistance becomes.

Twig-Temperature-Sensor-value.jpg

With Raspberry Pi 1.You should have got a raspberry pi and a grovepi or grovepi+.

2.You should have completed configuring the development enviroment, otherwise follow here.


3.Connection

Plug the sensor to grovepi socket D3 by using a grove cable. 4.Navigate to the demos' directory:

  cd yourpath/GrovePi/Software/Python/

To see the code

  nano grove_temperature_sensor.py   # "Ctrl+x" to exit #

import time import grovepi

  1. Connect the Grove Temperature Sensor to analog port A0
  2. SIG,NC,VCC,GND

sensor = 0

while True:

   try:
       temp = grovepi.temp(sensor,'1.1')
       print "temp =", temp
       time.sleep(.5)
   except KeyboardInterrupt:
       break
   except IOError:
       print "Error"

5.Run the demo.

  sudo python grove_temperature_sensor.py


QQ截图20150605160913.jpg

File:NCP18WF104F03RC.pdf