About
ToastMeOn is a hardware hack that our team made for UOfTHacks. It is a basically a 'smart' Toaster that can communicate with you in real-time with SMS.
Using SMS, you can
- Turn it on for a specific amount of time (Hours/Minutes/Seconds)<
> - Schedule for a specific time and duration to turn on (Ex: Turn on 5min at 4PM)<
> - Check the status of its state (Active/Inactive)<
> - Turn it off immediately (Good if your household forgot to turn it off)
Have your food in your oven in the morning before you go to work, and when you get back your food will already be heated; Come back with a warm dinner while you watch your favourite TV Show!
Video
Background
I've recently heard about Spark Cores all over hardware blogs and forums and wanted to get my hands on one. Since I was going to UOfTHacks and saw that their hardware list consisted of the Spark Core, I knew that that was the perfect place to use one. At that moment I was also really into home automation so I decided hey why not? Instead of making something that was controlled by WiFi like all home automated stuff, I wanted to make something even cooler and more convenient; thus I decided to make something controlled with SMS. Unlike most home automation things controlled with WiFi, you can control your appliances literally anywhere as long as you can text.
What You Need
- Spark Core
-
Twilio to receive/send SMS (A trial account is sufficient)
-
Relay Board (I made my own instead, you can learn how below)
- Any extension cord
- Toaster Oven (Although really any household appliance works too)
- A web server (There are plenty of free web servers available like Apache or Heroku)
The overall cost shouldn't be a worry since if you already have a Spark Core the overall cost could be less than $5
Circuit
The circuit consists of 4 simple components:
- NPN Transistor - 2N2222
- 5V SPDT Relay
-
Zener or Rectifier Diode
- 220-1K Resistor
If you are using 120V please do not use a breadboard for this.. Use a perfboard and use proper connections.
WARNING!!! IF YOU ARE MAKING YOUR OWN RELAY BOARD MAKE SURE YOU CONNECT THE 120V SAFELY AND SECURE! (USE SCREW TERMINALS TO INSERT YOUR 120V WIRE). YOU ARE DEALING WITH HIGH VOLTAGE
Circuit Operation
Because the Spark Core gives a 3.3V, it isn't enough to power the 5V Relay so a transistor is needed to amplify it. Since I didn't have a 5V power supply, I used a 9V battery and used a voltage regulator to power the relay. Even though the Relay can have maximum switching voltage of 12V, I didn't want to wear out the relay thus stuck with using the regulator.
In addition to powering the relay, I used the same 5v that came form the regulator to power the Spark Core. At first when I tried it, I thought it would drain the battery pretty fast, but it actually lasted a while so it worked out.
Setting up SMS
In order to have SMS on your project, make sure you registered an account for Twilio. Having a trial account is fine for this!
Now what I did to set up receiving/sending SMS was that I followed their guide. It taught my team and I how to send/reply to SMS using php on a server.
I don't want to go to in depth here because most of the documentation is on their website. However setting up your PHP to turn on your sparkcore is trickier but I will talk about that in the next section.
Setting up Spark Core
If you don't want any other functions other than turning on a pin high or low, then uploading code to your Spark Core via Spark Cloud is unnecessary. You can control your Spark Core purely on your web server using cURL commands.
Heres a fun thing to try once your Spark Core is connected to the internet : On terminal enter
Using PHP to control Twilio & Spark Core
Now that you got controlled your Spark Core using your terminal, you can now experience the fun in controlling it with PHP! The following code below is to set the pin D0 pin to high, and thus activating the relay. Insert this code into your PHP code when you want to turn your relay on and thus turning on your toaster oven.
D0 was the pin I used to control my relay. Change your params accordingly.
Conclusion
If you set it up all correctly, your project should be working now! You can now control your toaster oven with a SMS.
I had a TON of fun making this, and I hope you do too. If you want to take a look at the other projects I have done visit www.haydentsui.ca
If you have any questions feel free to email me at : me@haydentsui.ca , or comment down below. I'd be happy to help.
Comments