Temperature Monitor

A.1) My initial concept was to design a small scale piano keyboard with arduino. the purpose of the piano keyboard as the image show below

PianoDoorBell-94455

research on playing music with arduino using piezo element. http://oomlout.com/a/products/ardx/circ-06/ tutorial can play the “twinkle twinkle little star” with the frequencies show below

c         261 Hz
d         294 Hz
e         329 Hz
f         349 Hz
g         392 Hz
a         440 Hz
b         493 Hz
C         523 Hz

A.2) 

applying the frequency with the tone code [ tone(speaker, frequency); ] to the buttons allow user to play notes individually.

however, when 2 or more buttons are pressed the sound produced by the 2 tones did not overlap.


A.3) assign the tone function outside the void loop

if(button1Value == HIGH){
tone(speaker, frequency);
}

to

if(button1Value == HIGH){
c();}
void c(){ 
tone(speaker, frequency);
}

when 2 buttons are pressed the sound produced by the 2 tones play in a random order.


A.4) enhancing the “if” statement by adding:

if ((button1Value == HIGH) && (button2Value == HIGH)){

}

to play a 3rd tone other than tones produce by button 1 & button 2

the 3rd tone will only be produced occasionally when user press the 2 buttons with the right timing.


A.5) changing the “if” statementfrom

if ((button1Value == HIGH) && (button2Value == HIGH)){

}

to

if (button1Value == HIGH && button2Value == HIGH){

}

by changing the “if” statement the performance of the tone become more reliable.

doorbell layout

/* void c = 261
void d = 294 
void e = 329 
void f = 349 
void g = 392 
void a = 440 
 */
const int buttonLow = 2; 
int lowState = 0;

const int buttonMid = 3; 
int midState = 0;
const int buttonHi = 4; 
int hiState = 0;
int speakerPin = 9;
int time = 100;
int c =523.25;
int d =587.33;
int e =659.25;

void setup() {
pinMode(buttonLow,INPUT);
pinMode(buttonMid,INPUT);
pinMode(buttonHi,INPUT);
pinMode(speakerPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
lowState = digitalRead(buttonLow);
midState = digitalRead(buttonMid); 
hiState = digitalRead(buttonHi);

if(lowState == HIGH && midState == LOW &&hiState == LOW){ 
tone(speakerPin, c,time);
Serial.println("c");
}

if(lowState == HIGH && midState == HIGH &&hiState == LOW){ 
tone(speakerPin, (c+d)/2,time); //average tone
Serial.println("c+d");
}

if(lowState == LOW && midState == HIGH &&hiState == LOW){ 
tone(speakerPin, d,time);
Serial.println("d");
}

if(lowState == LOW && midState == LOW &&hiState == HIGH){ 
tone(speakerPin, e,time);
Serial.println("e");
}
}

however, it is very difficult to create the damping (decay of sound) with arduino therefore this project may not be able to develop further.


B.1) Due to the technical limitation I was unable to produce the damping for the piano.

I have converted the project into a temperature monitor

Dash_5000_Medical_monitor

using the thermistor setup and code form http://pcomp.resourcestore.net/thermistor/ as the foundation and assigning the LEDs to turn on/off at different temperature

replace the thermistor with a variable resister to vary the “temperature measured” by the arduino.


B.2) attach a Piezo element and a button to allow the arduino to “tell” the temperature it measured

temperature > 0°c : tone decrease in volume

every 10°c : low pitch

every 10°c : high pitch

ie. 25°c measured : high pitch, high pitch, low pitch

feedback from Drew: it is not a very good idea to communicate temperature with sound


B.3) based on the feedback, I have re-arranged the user interface of the temperature monitor.

remove the button and assign warning tone to certain temperature. piezo element will emit a warning signal when temperature reach too high or too low

research into skin temperature and applying the results to the temperature range on the arduino code


B.4)

nakedManikin2_erg_1_gross

resource: http://www.theseus-fe.com/validation/manikin-fiala-fe

min: 26°c

max: 37°c

when setting temperatures allow tolerance to warn user before the temperature reaching the danger level

min: 25°c

max: 35°c

temperature range in the code is required to be minimized for to following deminstration

replacing the variable resistor with the temperature sensor to measure the body temperature, and build a robust housing to protect the hardware

image2

Untitled Sketch 3

int temperaturePin = 0; 
 
int speakerPin = 9; 
 
int led1=8;
int led2=10;
int led3=11;
int led4=12;
int led5=13;

int a = 27;
int b = 29;
int c = 33;
int d = 35;

void setup(){
Serial.begin(9600);
pinMode(speakerPin, OUTPUT); 
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}

void loop() {
float temperature = getVoltage(temperaturePin);
temperature = (temperature - .5) * 100;
delay(1000); 
Serial.println(temperature); 
digitalWrite(led3, HIGH);

if(temperature <= b){ 
digitalWrite(led2, HIGH);
}

if(temperature <= a){
digitalWrite(led1, HIGH);
cold();
} 

if(temperature >= c){
digitalWrite(led4, HIGH);
}

if(temperature >= d){
digitalWrite(led5, HIGH);
hot();
}

if(temperature > a){
digitalWrite(led1, LOW);
}

if(temperature > b){
digitalWrite(led2, LOW);
}

if(temperature < c){
digitalWrite(led4, LOW);
}

if(temperature < d){
digitalWrite(led5, LOW);
}
}

float getVoltage(int pin){
return (analogRead(pin) * .004882814);
}
 
void cold(){
tone(speakerPin, 250,500);
delay(1000);
}
 
void hot(){
tone(speakerPin, 1000,500);
delay(1000);
}
Advertisements

One thought on “Temperature Monitor

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s