iMac Heat Sensor

http://vimeo.com/51114107

So it all started with freezes when attempting to render my motion graphics in FCPX. Very frustrating. So I thought: how can I use my Arduino to avoid this freeze ups? I noticed that when my iMac would heat up, the render times would be much slower and the possibility of freezes would increase. I found a tutorial online on using a heat sensor to trigger alerts. I programmed it to reactive in different ways to 3 different heat levels:

1 level – light turns on

2 level – buzzer buzzes

3 level – buzzer buzzes at a higher frequency

What I enjoyed most from this first Arduino project was the process. Understanding each line of code and deconstructing it to see what would happen. This was a great way to learn. Also adding the second and third heat levels was my variable on the original tutorial.

 

 

// declare variables
// derived from youtube.com/oneHand tutorial
float tempC;
int tempPin = 0; // Temp sensor plugged analog pin 0
int ledPin = 13; // led is plugged into pin 13
int buzzPin = 7; // led is plugged into pin 13
// write set up function
void setup()
{
Serial.begin(9600); // opens serial port to communicate with temp sensor
pinMode(ledPin, OUTPUT);
pinMode(buzzPin, OUTPUT);
}
// write loop that will control what we want the arduino to do with temp reaout
void loop()
{
tempC = analogRead(tempPin); //taking temp pin reading and setting it equal to tempC variable
tempC = (5.0*tempC*100.0)/1024.0; // convert analog input to a tempurature in celcius
Serial.println((byte)tempC); // will output the converted temp to PC
if (tempC >22)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
delay(1000);

if (tempC >25 && tempC 30)
{
digitalWrite(buzzPin, HIGH);
}
else
{
digitalWrite(buzzPin, LOW);
}
delay(10);

}

Comments are closed.