Introduction: Arduino + Thermocouple + Nokia 5110 LCD

This is a connection between arduino mega thermocouple and Nokia 5110 screen to display temperature which ranges till 1000*C. It can be used to measure temperature of engine.

Step 1:

//so to dp 8 sck to dp 9 cs dp 10
#define CC 10 //cs
#define CLK 9 //sck
#define DBIT 8 // so

#include
#include
#include

#include
Adafruit_PCD8544 display=Adafruit_PCD8544(7,6,5,4,3);
//Connect pins 1-5 of nokia 5110 LCD to pins 3-7 on your arduino
//So RST would be arduino pin 3,CE would go to pin 4 and so on

int v = 0;
float Ctemp, Ftemp;

void setup() {
Serial.begin(9600);
display.begin();


pinMode(CLK, OUTPUT);
pinMode(DBIT, INPUT);
pinMode(CC, OUTPUT);
digitalWrite(CC, HIGH);
digitalWrite(CLK, LOW);

}

void loop() {
v = spiRead();
if (v == -1) {
display.setCursor(20,30);
display.print(Ftemp);
}
else {
Ctemp = v * 0.25;
Ftemp = (Ctemp * 9 / 5) + 32;
display.clearDisplay();
display.setCursor(10,0);
display.println("Engine Temp");
display.setCursor(20,15);
display.print(Ctemp);
display.println(" *C");
display.setCursor(20,30);
display.print(Ftemp);
display.print(" F");
display.display();

}
delay(500);
}

int spiRead() {
int value = 0;
digitalWrite(CC,LOW);
delay(2);
digitalWrite(CC,HIGH);
delay(220);

/* Read the chip and return the raw temperature value */
/* Bring CC pin low to allow us to read the data from
the conversion process */

digitalWrite(CC,LOW);
/* Cycle the clock for dummy bit 15 */
digitalWrite(CLK,HIGH);
delay(1);
digitalWrite(CLK,LOW);

/*
Read bits 14-3 from MAX6675 for the Temp. Loop for each bit reading
the value and storing the final value in 'temp'
*/

for (int i=14; i>=0; i--) {
digitalWrite(CLK,HIGH);
value += digitalRead(DBIT) << i;
digitalWrite(CLK,LOW);
}
// check bit D2 if HIGH no sensor
if ((value & 0x04) == 0x04) return -1;

// shift right three places
return value >> 3;
}