Introduction: Arduino-Powered Binary Thermometer

Picture of Arduino-Powered Binary Thermometer

I recently acquired an Arduino Uno and was looking for a cool "getting started" project. I decided to make a thermometer, as the kit I have had all the necessary parts (thermistor, wires, resistors, LEDs). Through a couple iterations, I finally arrived at this project: building an Arduino-Powered Binary Thermometer that displays the temperature (in C) in binary on six LEDs. Here is what you'll need to build this:

Arduino x1
Breadboard x1
1000 ohm resistor x1
Thermistor x1
330 ohm resistor x 6
LED x 6
Assorted Wires x? (depends on you circuitry)

Step 1: Calibrate the Thermistor

Picture of Calibrate the Thermistor

Thermistors are a type of variable resistor that change resistance with changes in temperature. In order to get an accurate reading from your thermistor, you first have to calibrate it. You can make use of the Steinhart-Hart Equation to make sense of voltage input data from your thermistor. Using this equation, temperature = 1/(A+B*ln(R)+C*(ln(R))^3), where A, B, and C are coefficients you must solve for and R is resistance. The easiest way to get the coefficient values for your particular thermistor is to look up its datasheet. On the datasheet, there should be Resistance-Temperature Curve plots. You can pick points from these plots and plog them into a calculator (like this one) to get the coefficient values for A, B, and C. The points I used are marked by the red circles on the plot. Ideally, you want to pick values at the top, middle, and bottom of the range you expect to use the thermistor in to get the most accurate curve. Once you have these values, you can plug them into the "Thermistor" function in the code.

Step 2: Set Up Circuit

Picture of Set Up Circuit

This part is pretty self explanatory. You will want to set up the 6 LEDs individually to separate pins and you want the input wire from the thermistor to be in between the the thermistor and the resistor. This is easier to see in the circuit diagram.

Step 3: Code

This part is also pretty self explanatory. Much of the thermistor code came from here. I have commented the code to try to make it easier to understand. The bolded line indicates where to enter your values of A, B, and C for the thermistor:







#include <math.h>

int led1 = 7;   // Set the input pin numbers
int led2 = 8;
int led3 = 9;
int led4 = 10;
int led5 = 11;
int led6 = 12;

double Thermistor(int RawADC) {
double Temp;
Temp = log(((10240000/RawADC) - 10000));
Temp = 1 / (0.000760464581576 + (0.000231192417594 + (0.000000072965780 * Temp * Temp ))* Temp ); // This will output the temperature in Kelvin
Temp = Temp - 273.15; // Convert Kelvin to Celcius
return Temp;
} // Function to convert thermistor voltage data to temperatures in Celcius using
  // the Steinhart-Hart Equation
 
void setup() {
Serial.begin(115200);
pinMode(led1, OUTPUT); // Specify pins as outputs
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
}

void loop() {
int Temp = Thermistor(analogRead(0)); // Set variable Temp equal to the reading from analog pin 0
int tempdata[6]; // Create blank array
for (int i = 0; i < 6; i++) {
  tempdata[i] = (Temp >> i) & 1;
} // Cycle through the binary number, saving each place as an entry in an array
Serial.println(int(Temp));  // Display temperature in serial monitor
if (tempdata[0] == 1) {
   digitalWrite(led1, HIGH);
} // If/Else statements go through the array with the binary digits and light the LED if the entry = 1 and dim the LED if the entry = 0
else {
  digitalWrite(led1, LOW);

if (tempdata[1] == 1) {
   digitalWrite(led2, HIGH);
}
else {
  digitalWrite(led2, LOW);

if (tempdata[2] == 1) {
   digitalWrite(led3, HIGH);
}
else {
  digitalWrite(led3, LOW);

if (tempdata[3] == 1) {
   digitalWrite(led4, HIGH);
}
else {
  digitalWrite(led4, LOW);

if (tempdata[4] == 1) {
   digitalWrite(led5, HIGH);
}
else {
  digitalWrite(led5, LOW);

if (tempdata[5] == 1) {
   digitalWrite(led6, HIGH);
}
else {
  digitalWrite(led6, LOW);

delay(100); // Wait 100 milliseconds
}

Step 4: Start Measuring the Temperature

Now you can start measuring temperature! That is of course if you can read binary...



Comments

NickM135 (author)2016-09-21

could you give instructions on how to read this

mischka (author)2012-11-28

A good project to start with Arduino

amandaghassaei (author)2012-11-19

cool, what kind of accuracy does this have?

I'm not 100% sure because I didn't have a thermometer to test it against. If I had to guess, I'd say it's probably accurate to within 2 degrees C. That could be adjusted if the temp-resistance reference points were gathered using real world data (i.e. using an accurate thermometer and a multimeter.)

About This Instructable

2,722views

2favorites

License:

More by TShimko126:Arduino-Powered Binary Thermometer
Add instructable to: