Process
Brief:
I categorized the project into three targets as a thought process.
First- Make the RGB Led work with program.
Second-Make the Piezo Sound work.
Third-Make the temperature sensor work and tweak the led and piezo sound to work according to the temperature data and enable push notifications.
Inspiration Projects:
https://particle.hackster.io/charlotte-track-team/it-s-tea-time-18ab1b?ref=channel&ref_id=286_trending__beginner_&offset=146
https://particle.hackster.io/alien-algorithm-d29464/temperature-sensors-fcca63?ref=search&ref_id=temperature&offset=3
https://particle.hackster.io/AgustinP/logging-temperature-data-using-the-spark-core-b9c60c?ref=search&ref_id=temperature&offset=7
https://particle.hackster.io/gusgonnet/pool-temperature-monitor-5331f2?ref=search&ref_id=temperature&offset=4
Project process
First - Making the RGB Led work.
Why RGB? The project could have been achieved with a green led and red led individually set up. But an RGB led would be cool and also help me learn to code the RGB and make it work.
Reference:
https://community.particle.io/t/wiring-up-the-rgb-led-from-the-maker-kit/4832/16
This blog had a program which was already tried by one of the participants and had the pictures of wiring diagram which i used to achieve the RGB output. Once i acheived the RGB output, the code was tweaked to remove the blue light and the wire was unplugged in the bread board.
int REDPin = A0; // RED pin of the LED to PWM pin **A0**
int GREENPin = D0; // GREEN pin of the LED to PWM pin **D0**
int BLUEPin = D1; // BLUE pin of the LED to PWM pin **D1**
int brightness = 255; // Full brightness for an ANODE RGB LED
void setup()
{
pinMode(REDPin, OUTPUT); // sets AO pin as output
pinMode(GREENPin, OUTPUT); // sets D0 pin as output
pinMode(BLUEPin, OUTPUT); // sets D1 pin as output
}
void loop()
{
analogWrite(REDPin, brightness);
delay(500);
analogWrite(GREENPin, brightness);
delay(500);
analogWrite(BLUEPin, brightness);
delay(500);
analogWrite(REDPin, 0);
delay(500);
analogWrite(GREENPin, 0);
delay(500);
analogWrite(BLUEPin, 0);
delay(500);
}
In this program, analogWrite was converted to digitalWrite and only Red and green pin were used.
Second - Making the Piezo work.
The Piezo wiring diagram was taken from the lab tutorials and the code executed using digitalWrite function with a simple warning tone. It produced a single long tone.
The program was tweaked to make the tone as "beep, beep beep" with delay and loop function. The tone was programmed to turn on only when the red light was on.
The RGB+Piezo program was saved as a separate file.
Third - The program set for temperature sensor was downloaded from Daragh's github account and then wiring was done according to the diagram. The temperature sensor was checked by dipping it in a cup of hot water. The cloud variables did show the change in temperature.
Fourth -
The temperature sensor program was tweaked by adding the RGB+Piezo program into it. Still the temperature and RGB+Piezo were independent entities.
Final - The If else function was added to light up the RGB to red when temperature crossed 50 degree Celsius which would otherwise be green and the piezo would make the beep beep sound. The Program was linked to IFTTT to sent an SMS once the temperature was achieved. In the program, Publish function was used to send a notification to the user to alert that, " The food is cooked; Its time to eat.
Temperature readings and output recorded :
Cold- 22.25degree Celcius/72 degree Fahrenheit; Green Light On.
Warm- 25.62 degree Celcius/78 degree Fahrenheit; Green Light On.
Hot-
55.87 degree Celcius/132.57 degree Fahrenheit; Red Light On." Beep Beep" from Piezo. Notification sent through IFTTT to mobile phone.