Ana Sayfa Gömülü Sistemler Arduino Arduino Kontrollü Yoğurt Makinesi

Arduino Kontrollü Yoğurt Makinesi

1

Her ne kadar eskiden annelerimizin yaptıkları yoğurtlar kadar olmasa da piyasada ki yoğurtların tanıda yaklaşabileceği bir proje. Arduino ile kontrol edebiliyorsunuz. Yoğurdun sıcaklığını sürekli kontrol edebileceğiniz bir proje.Piyasa da bir çok yoğurt makinesi çıkmaya başladı bu da sizin kendi başınıza yaptığınız bir yoğurt makinesi olmaya aday.

 

Malzemeler

  •  Arduino Duemilanove
  • (1) Arduino ProtoShield Kit 
  • (1) Mini Breadboard 
  • (1) Röle ko
  • ntrolcüsü PCB 
  • (1) Buzzer 
  • (3) Direnç 1k Ohm 1/4 Watt 
  • (1) Direnç 10k Ohm 1/4 Watt 
  • (1) Diode ( 1N4148) 
  • (1) NPN Transistor (örnek 2N3904)
  • (1) LED 
  • (1) 10K Thermistor 
  • (1) Soğutucu

yandaki resimden bağlantıları görebilirsiniz

Kodlar:


#include
#include

// These constants won't change:
const int sensorPin = 0; // pin that the sensor is attached to
const int relayPin = 13; //pin that turns the relay on or off
const int buzzerPin = 9; //pin that activates the piezo buzzer
const int buttonPin = 12; //pin that activates the piezo buzzer

//do a better job of getting temp
double thermistor_read(int sensorVal) {

//Vout = Vin * (R2/(R1 + R2)) = analogread
double R2 = 10000; //the other (non-thermistor) resistor in our voltage divider
double R1; //the resistance ofthe thermistor (this will be calculated from the analog-to-digital conversion taken at the sensor pin)
double temp; //temp will be calculated using the Steinhart-Hart thermistor equation
double Vin = 4.6; //reference voltage that we get from the board

double Vout = sensorVal * (Vin/1024); //convert the ADC reading from the analog pin into a voltage. We'll need this to calculate the thermistor's resistance next

R1 = ((R2 * Vin) / (Vout)) - R2; //calculate resistance from the analogread value. See this page for more info: http://en.wikipedia.org/wiki/Voltage_divider

temp = 1 / (0.0011690592 + 0.00023090243 * log(R1) + .000000074484724 * pow(log(R1), 3));
//Steinhart-Hart thermistor equation, using coefficients calculated from the manufacturere's data sheet,
//and the calculator found here: http://www.capgo.com/Resources/Temperature/Thermistor/ThermistorCalc.html
//this gives us temperature in Kelvin

temp = temp - 273.15; // Convert Kelvin to Celcius
temp = (temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit

return temp;
}

//convert millis to readable hours:mins:seconds
void timestamp(unsigned long milliseconds) {
int seconds = milliseconds / 1000;
int minutes = seconds / 60;
int hours = minutes / 60;

seconds = seconds % 60;
minutes = minutes % 60;

if (hours 0) {
Serial.print("."); // print the decimal point
unsigned long frac, mult = 1;
byte padding = precision -1;
while(precision--) mult *=10;
if(val >= 0) frac = (val - int(val)) * mult; else frac = (int(val) - val) * mult;
unsigned long frac1 = frac;
while(frac1 /= 10) padding--;
while(padding--) Serial.print("0");
Serial.print(frac,DEC) ;
}
}

//get to a specified temperature and hold
//go_to_temp(target temp in F, duration in seconds to hold target temp for, whether to beep during hold time)
boolean go_to_temp(double targetTemp, int holdFor, boolean alarm) {

//these need to be reset each time go_to_temp is called
boolean tempReached = 0; //whether the target temp has been reached
unsigned long startTime = 0; //the time in millis when the target temp is first reached
int sensorValue = 0; // the sensor value

//loop the temp checking/relay control function until the target temp is reached, then hold for the amount of time specified in holdFor
//the while statement will loop forever, until the target temperature is reached
//once that happens, millis are used to count from startTime to startTime plus the length of holdFor
while (millis() * tempReached targetTemp) { //If above target temp, turn the crock pot off
digitalWrite(relayPin, LOW);
Serial.print("tRelay is OFF");
}

if (abs(thermistor_read(sensorValue) - targetTemp) (startTime + holdFor * 1000) * tempReached)
return tempReached;
}

//make the buzzer generate a tone
void tone(int targetPin, long frequency, long length) {
long delayValue = 1000000/frequency/2;
long numCycles = frequency * length/ 1000;

for (long i=0; i

1 Yorum

gunerg için bir cevap yazın İptal

Please enter your comment!
Please enter your name here

Exit mobile version