# Sample Lab Submission

Submitted by elliot on Wed, 01/23/2013 - 11:39

## Description

This is where you will put a description of your assignment. Write a couple paragraphs describing your approach. What does it do? Why did you choose this approach over others? What problems did you run into?

Example:

To build this coffee roaster, I started with a popcorn air popper. This is a common entry level method for roasting coffee. As can be seen in the photo, I removed the plastic body as these tend to melt at the higher temperatures. The popcorn popper is heated with a simple coil and the air is blown by a simple DC motor. I separated the power going to the motor and the coil so that I would be able to control each separately. Right now, I am controlling the heat from the coil with a dimmer switch, but the next version will control it with the Arduino and a relay.

On the Arduino side, I used an Arduino Mini 3.3V. I chose a 3.3V Arduino instead of the regular 5V because I intend to connect an LCD screen as a readout and it takes 3.3V, so it is just easier to use a 3.3V Arduino than use a bunch of resistors to limit the voltage.

The Arduino probes the temperature in the roaster with a thermistor. Although it is a 10kΩ thermistor at 25 degree C, I found that at the range of 400 degree F, the resolution was not sufficient when using a 10kΩ pad resistor. Doing some calculations, I found that in order to maximize the resolution in the range of 400-480 degrees, I needed a pad resistor somewhere in the 50-100Ω range. Luckily I had a 67Ω resistor sitting around.

## Components Used

List what you used in your assignment.

Example:

1- Arduino Pro Mini 3.3V

1- Thermistor

1- 67 Ω Resistor

1- Popcorn Air Popper

1- 15000W Light dimmer

1- 19.5V DC power supply

## Code

#include <math.h>
#include <Timer.h>
#include <LiquidCrystal.h>

#define temperaturePin A0            //input pin for the orange temperature
//(RS,E,D4,D5,D6,D7)
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

int degreeC = 0;
int maxTemp = 0;
String roastLevel = "Green";
Timer t;

void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print(roastLevel);
}

void loop()
{
if(degreeC > maxTemp){
maxTemp = degreeC;
roastLevel = rLevel(maxTemp);
lcd.setCursor(0, 0);
lcd.print(roastLevel);
}
lcd.setCursor(0, 1);
lcd.print(degreeC);
lcd.setCursor(0, 8);
lcd.print(millis()/1000);

Serial.print(degreeC);
Serial.print(" degree \n");
Serial.println(roastLevel);
Serial.println();
Serial.println();
delay(1000);
}

String rLevel(int temp){
if(temp < 270) {
return "Green";
}
else if(temp < 327) {
return "Pale";
}
else if(temp < 345) {
return "Yellow";
}
else if(temp < 370) {
return "Light Brown";
}
else if(temp < 393) {
return "Brown";
}
else if(temp < 401) {
return "1st Crack?";
}
else if(temp < 415) {
return "1st Crack";
}
else if(temp < 426) {
return "CITY";
}
else if(temp < 435) {
return "CITY +";
}
else if(temp < 444) {
return "FULL CITY";
}
else if(temp < 454) {
return "FULL CITY +";
}
else if(temp < 465) {
return "VIENNA";
}
else if(temp < 474) {
return "French";
}
else if(temp < 486) {
return "Starbuck";
}
}

{
/*
Honewell 135-103LAG-J01
http://sensing.honeywell.com/index.php?ci_id=3108&la_id=1&pr_id=53805
Resistance                10,000 Ohm
Tolerance                 ±10.0%
Accuracy                  25 °C [77 °F]
Beta 25/85                3974
Operating Temperature     -60 °C to 300 °C [-76 °F to 572 °F]
Diameter              2,0 mm [0.080 in]
Lead Length               28,6 mm [1.125 in]
Time Constant in Air      4.0 s
Dissipation Constant      2,5 m/W°C
Series Name               135
*/

//  Calibration
//  120 C  264.46 R
//  140 C  176.97 R *
//  160 C  111.00 R
//  180 C   75.78 R
//  200 C   64.30 R *
//  220 C   45.57 R
//  240 C   33.25 R *
const double A = 0.0013514225374904882;
const double B = 0.00013995347172609127;
const double C = 0.000002485131588719009;

double R;
double lnr;
double tempK;
double tempC;
double tempF;

Serial.println(R);

lnr = log(R);
tempK   = 1 / (A + B * lnr + (C * lnr * lnr * lnr ));

tempC = tempK - 273.15;            // Convert Kelvin to Celcius
//  Serial.print(tempC);
//  Serial.println(" C");
tempF = tempC * 9.0/ 5.0 + 32.0; // Convert Celcius to Fahrenheit

return tempF;
}

## Video

Insert a video link when necessary.

Drupal theme by Kiwi Themes.