Hey Guys,
Now to start out, I have to say that I am an absolute beginner in such "hacking" projects.
My Goal is to modify my Pizza oven and have an Arduino control the Temperature of the Oven.
This is the type of Oven just so you can imagine what I am talking about.
It has a Heating element in the top and below the Stone. I want to set a Temperature goal for both and see when my top element has reached the wanted temperature. If possible , I want to put everything in the oven (theres technically enough room in the back, but im not sure about the heat), as a Safety Precaution I want to have a 3. Temperature Sensor directly on the Breadboard to measure the temperature near the Arduino and if it reaches a certain temperature it should turn off (not sure which threshold I will set for that). Last but not least I want to replace the Light between the two knows in the Picture so it lights up if the desired Temperature is reached (this is like a nifty extra, if this wont work hardware wise im fine with that).
Therefore I think I need a 2 Channel relay to control each Heating element. In addition I need 2 Temperature Sensors (one in the top, one in the bottom). To Set the Temperature I want to use a Potentiometer, to display the Temperatures I want to use a 7 Segment 3 Digit display.
So I already went and bought some stuff (thinking it doesnt really matter, because most parts are pretty cheap but ive bought quite alot now
)
- Arduino Uno (not 100% sure which version it is)
- Potentiometer
- 7 Segment Display (4 Digits)
- 7 Segment Display (3 Digits)
- Thermistor
- Thermistor as a Security Backup
- RGB LED to display Status
- Resistor to read Temperature from Thermistor
-
Resistor to read Temperature from Thermistor
With the Resistors I wasnt sure if I needed 1/4 or 1/2 so I just bought both (20ct total so its not too bad).
Now I already know the basic Idea of what I want to do:
- Get Analog Signal from Potentiometer (what Temperature I want to Set my Oven).
- Compare this Integer Value (WishTemperature) with the inidivual Integer Values of the Temperature Sensors (top and bottom).
- If the Sensor Value is lower than the Wish Temperature the Relay should open and turn on the individual heater element.
The Display should (normally) show the current temperature of the top Sensor (its in the Oven room) so I know how warm it is. If I move the Potentiometer the Display should show the WishTemperature Integer Value for a second or two (doesnt matter, just a Delay function).
Last but not least, the RGB should show (in the best case) 3 different States, Red if both Sensors Values are lower than the WishTemperature, Yellow if one Sensor reports the correct temperature, and green if both are within the Temperature.
To sum it up, I have Issues with getting Information from the Temperature Sensors and I have Issues displaying the Integers on the Display. The rest is fine.
First, my issues with the Temperature Sensors:
As soon as I started playing around with the ones I just bought, I found out that they arent Temperature Sensors, but much rather Thermistors (so they just change their resistance with Temperature Difference). To get a reading from them you need another Reference Resistor (considering the Thermistors I have are PT100, I went for 100 Ohm Resistors).
One of the Tutorials I followed is the following: Using a Thermistor | Thermistor | Adafruit Learning System
In combination with the table from this Website and the Sensor Data I had I adapted it accordingly:
// which analog pin to connect
#define THERMISTORPIN A0
// resistance at 25 degrees C
#define THERMISTORNOMINAL 109.73
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25
// how many samples to take and average, more takes longer
// but is more 'smooth'
#define NUMSAMPLES 5
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 3850
// the value of the 'other' resistor
#define SERIESRESISTOR 100
int samples[NUMSAMPLES];
void setup(void) {
Serial.begin(9600);
analogReference(EXTERNAL);
}
void loop(void) {
uint8_t i;
float average;
// take N samples in a row, with a slight delay
for (i=0; i< NUMSAMPLES; i++) {
samples[i] = analogRead(THERMISTORPIN);
delay(10);
}
// average all the samples out
average = 0;
for (i=0; i< NUMSAMPLES; i++) {
average += samples[i];
}
average /= NUMSAMPLES;
Serial.print("Average analog reading ");
Serial.println(average);
// convert the value to resistance
average = 1023 / average - 1;
average = SERIESRESISTOR / average;
Serial.print("Thermistor resistance ");
Serial.println(average);
float steinhart;
steinhart = average / THERMISTORNOMINAL; // (R/Ro)
steinhart = log(steinhart); // ln(R/Ro)
steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro)
steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
steinhart = 1.0 / steinhart; // Invert
steinhart -= 273.15; // convert absolute temp to C
Serial.print("Temperature ");
Serial.print(steinhart);
Serial.println(" *C");
delay(1000);
}
But when I look at the Serial Port there is some issue with the reading of the Sensor:
Average analog reading 1023.00
Thermistor resistance inf
Temperature -273.15 *C
This message keeps repeating. Basically there must be some sort of issue with the Resistor. This both happens with the 1/4 and 1/2W version of the resistor.
Next my issue with the Display:
I am using the Tutorial from this Website: Arduino 4-Digit 7 Segment Display 74HC595 module - Ardumotive Arduino Greek Playground
If I adapt it accordingly (remove the 4. Digit and correct the Pins) this is the result:
#include <ShiftRegister74HC595.h>
// create shift register object (number of shift registers, data pin, clock pin, latch pin)
ShiftRegister74HC595 sr (3, 2, 3, 4);
const int pot = A0;
int value,digit1,digit2,digit3,digit4;
uint8_t numberB[] = {B11000000, //0
B11111001, //1
B10100100, //2
B10110000, //3
B10011001, //4
B10010010, //5
B10000011, //6
B11111000, //7
B10000000, //8
B10011000 //9
};
void setup() {
//blink();
Serial.begin(9600);
}
void loop() {
//Read from Analog1
value=analogRead(pot)/2.038;
//Split number to digits:
digit3=(value / 10) % 10 ;
digit2=(value / 100) % 10 ;
digit1=(value / 1000) % 10 ;
//Send them to 7 segment displays
uint8_t numberToPrint[]= {numberB[digit3],numberB[digit2],numberB[digit1]};
sr.setAll(numberToPrint);
//Reset them for next read
digit1=0;
digit2=0;
digit3=0;
Serial.print(pot);
delay(1000); // Read and print every 1 sec
}
//Blink
void blink(){
for(int i = 0; i<2; i++){
sr.setAllHigh(); // set all pins HIGH
delay(1000);
sr.setAllLow(); // set all pins LOW
delay(1000);
}
}
Now this script would directly display my Potentiometer readings (I would need more) but to start out this would work.
Now I am not sure why, but if I run the Script now the display shows random Values, if I go from 100% to 0% the values jump from 770 -> 220 -> 430 -> 0 -> 150 in a seemingly random fashion. Using the Serial Port, the only value which is displayed is 14 ?
Now I would be very glad if someone could help me out with either Issues, maybe you could point me in the right directions or tell me what I am doing wrong. Thank you guys so much
