Introduction: Arduino Temperature Sensor Kit

This kit is designed to have the 4x7 segment display which displays the temperature mounted directly on the Arduino board. The
3-pin wire leads connect a thermistor to an analog pin on the Arduino. Once the Arduino is programmed, a 9-volt battery can supply
the power. The thermistor can be replaced with other types of sensors and the Arduino can be reprogrammed to display those sensor value readings.

kit can be ordered from Jameco http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&productId=2184579&catalogId=10001&CID=CLO

Step 1: Parts List

parts list can be ordered as a kit.

Step 2: Arduino Mini

Look at the Arduino and familiarize yourself with the orientation vocabulary used in these steps.  This project uses the Arduino Mini Pro.  Other arduino boards will be able to perform in this project but the mini allows for a compact design.

Step 3: Power and Data Connections

The supply power, sensor power and data wire leads are connected in these pins from the back side of the arduino.  The ground leads for the sensor and the power supply can be connected together and soldered into the GND pin.  The power supply positive lead is soldered into the RAW pin.  The sensor voltage lead is soldered into the VCC pin.  The data lead is soldered into the A3 pin.  Soldering them in through the back of the arduino will keep them from hindering the placement of the 7-segment display. 

Step 4: Sensor

Wrap one end of resistor to one leg of the thermistor, solder and trim leads.
the thermistor/resistor module does not need to be soldered into the 3-pin clip. When inserted into the clip end of the 3-pin clip, the
bare thermistor leg should connect to the BLACK wire, the resistor leg should connect to the RED wire and the thermistor leg that has the resistor soldered should connect to the DATA wire (the DATA wire could be YELLOW, WHITE or even BLUE)

Step 5: Arduino Header Pins

Attach the header pins to the arduino on the front right side of the arduino.  These pins will be used with the FTDI cable to program the arduino.

Step 6: 7-Segment Pins

Bend pins out flat then straight again so the footprint is wide enough to fit in the Arduino holes. you will also need to bend the #9 pin
so it fits in the GND hole on the TOP FRONT of the Arduino.

Step 7: 7-Segment Ground Pin

Align the 7 segment display so the pins fit the Arduino holes and confirm that the #9 pin on the 7 segment display fits in the GND hole
on the FRONT TOP of the Arduino.

Step 8: Program Arduino

Connect your computer to the Arduino with your FTDI connection and upload the thermistor program (source program included here made up of parts taken from samples online)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Ai5 = A5;
int Value5;
boolean hb = HIGH;
int hbCNT = 0;
int digit1 = 10; // 11; //PWM Display pin 1
int digit2 = 11; // 10; //PWM Display pin 2
int segD = 12; // A1; // 5; //Display pin 3
//not used 13; // pin 4
int segE = A0; // A0; //Display pin 5
int digit3 = A1; // 12; // 9; //PWM Display pin 6
int dp3 = A2; // 9; // 12;
Step 11 - 7 segment BOTTOM
Confirm the pins on the 7 segment display fit in the holes on the BOTTOM FRONT of the Arduino.
int digit4 = A3; // 13; // 6; //PWM Display pin 8
int segB = 9; // 3; //Display pin 16
int segG = 8; //Display pin 15
int segA = 7; //5; // A1; //Display pin 14
int segC = 6; // 4; //Display pin 13
//not used 5; // pin 12
int segF = 4; // 7; // 7; //Display pin 11
int dphb = 3; // A3; pin 10
// GND // pin 9
void setup() {
pinMode(segA, OUTPUT);
pinMode(segB, OUTPUT);
pinMode(segC, OUTPUT);
pinMode(segD, OUTPUT);
pinMode(segE, OUTPUT);
pinMode(segF, OUTPUT);
pinMode(segG, OUTPUT);
pinMode(digit1, OUTPUT);
pinMode(digit2, OUTPUT);
pinMode(digit3, OUTPUT);
pinMode(digit4, OUTPUT);
pinMode(dp3, OUTPUT);
pinMode(Ai5,INPUT);
Serial.begin(9600);
Serial.println();
}
void loop()
{
//show temp
displayNumber(Value5);
//show heartbeat
if (!(hbCNT % 100)) hb=!hb;
//query temp
if (hbCNT++ > 300)
{
hbCNT = 1;
//store thermistor resistance value
Value5 = analogRead(Ai5); //Read the value of AI1 (pin2) and write it to Value1
Serial.print(Value5);
Serial.print(" [] ");
Serial.print( 1000/(float(1023 / float(Value5)) -1));
float steinhart, average;
average = 1023 / float(Value5) - 1;
average = 10000 / average;
steinhart = average / 1000; // (R/Ro)
steinhart = log(steinhart); // ln(R/Ro)
steinhart /= 3636; // 1/B * ln(R/Ro)
steinhart += 1.0 / (25 + 273.15); // + (1/To)
steinhart = 1.0 / steinhart; // Invert
Serial.print(" [] ");
Serial.print(average);
Serial.print(" [k] ");
Serial.print(steinhart);//kelvin
Serial.print(" [c] ");//celcius
steinhart -= 273.15;
Serial.print(steinhart);
Serial.print(" [f] ");//fahrn
steinhart = steinhart * 9 / 5 + 32;
Serial.print(steinhart);
Serial.print(" ||| ");
Value5 = steinhart*10;
Serial.println(Value5);
}
}
void displayNumber(int toDisplay) {
#define DISPLAY_BRIGHTNESS 500
#define DIGIT_ON HIGH
#define DIGIT_OFF LOW
long beginTime = millis();
for(int digit = 4 ; digit > 0 ; digit--) {
digitalWrite(dp3, HIGH);
//Turn on a digit for a short amount of time
switch(digit) {
case 1:
digitalWrite(digit1, DIGIT_ON);
break;
case 2:
digitalWrite(digit2, DIGIT_ON);
break;
case 3:
digitalWrite(digit3, DIGIT_ON);
digitalWrite(dp3, !hb);
break;
case 4:
digitalWrite(digit4, DIGIT_ON);
break;
}
digitalWrite(dphb, !hb);
//Turn on the right segments for this digit
lightNumber(toDisplay % 10);
toDisplay /= 10;
delayMicroseconds(DISPLAY_BRIGHTNESS); //Display this digit for a fraction of a second (between 1us and 5000us, 500 is pretty
good)
//Turn off all segments
lightNumber(10);
//Turn off all digits
digitalWrite(digit1, DIGIT_OFF);
digitalWrite(digit2, DIGIT_OFF);
digitalWrite(digit3, DIGIT_OFF);
digitalWrite(digit4, DIGIT_OFF);
}
while( (millis() - beginTime) < 10) ; //Wait for 20ms to pass before we paint the display again
}
//Given a number, turns on those segments
//If number == 10, then turn off number
void lightNumber(int numberToDisplay) {
#define SEGMENT_ON LOW
#define SEGMENT_OFF HIGH
switch (numberToDisplay){
case 0:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_OFF);
break;
case 1:
digitalWrite(segA, SEGMENT_OFF);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_OFF);
break;
case 2:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_OFF);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_ON);
break;
case 3:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_ON);
break;
case 4:
digitalWrite(segA, SEGMENT_OFF);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 5:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_OFF);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 6:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_OFF);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 7:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_OFF);
break;
case 8:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 9:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 10:
digitalWrite(segA, SEGMENT_OFF);
digitalWrite(segB, SEGMENT_OFF);
digitalWrite(segC, SEGMENT_OFF);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_OFF);
break;
}
}

Comments

author
alleson123 made it! (author)2016-01-25

how long does the battery can be still alive? please answer it A.S.A.P. :)

author
PauloC21 made it! (author)2015-10-03

There's no need of resistors on 4 digit display?? Your arduino mini pro is 5V?

author
stp715a made it! (author)2014-03-24

Very nice! Will this work with the more common 12 pin common anode 4 digit 7 segment displays? Thanks.

author
stp715a made it! (author)stp715a2014-04-04

I figured out how to map this to a 12 pin 4 digit display and change the code to support the new pin out. If anyone is interested message me. Also, the sketch will not compile unless the "include" in the first line, #include. is removed. The include statement queries arduino to look for a file to include. "include must be removed before it compiles.