Introduction: Text Your Coffee Maker!
I started this project because I wanted to get into IoT stuff. I thought one day "hey, it would be cool if I could tell my coffee maker to start making coffee so I don't have to walk downstairs and wait for it to finish." I used some different libraries and software in an attempt to best configure the program I made, and settled on the ones I did because of how easy they are to set up. Also, all of the software used in this tutorial is free for anyone to use.
This project uses email or text messaging to start a coffee maker, but this same hardware and programming can be applied to anything with an 'on' button; if you wanted, you could set up a bunch of cheap PiZs and control your entire house without the need for an expensive IoT hub or service. Also, since it uses an email account, you can activate the device(s) from anywhere in the world.
This was literally my first time using Python, GPIO pins, a boost converter, and fetchmail. This project was a great learning experience for me and I hope it is for you as well! This instructable should also be relatively easy for beginners; I'm not an engineer or a professional software engineer, and I only do projects like these as a hobby.
This is my first Instructable, so I'll be updating it continuously for a while.
Step 1: Materials
I made this project using only parts I already had around my apartment. The most expensive are the coffee maker and Raspberry Pi (I have a Raspberry Pi 2, but this project requires very little computing power and no graphical interface, so you could also use a Pi Zero). I'll assume for this list that you do not have anything:
1.) Raspberry Pi ($37.33, http://tinyurl.com/zk463xq)
2.) 5W microUSB power supply; most phones chargers will work ($1.55, http://tinyurl.com/hrubqs2)
3.) USB WiFi adapter ($9.99, http://tinyurl.com/zwg7rx9 <--Ethernet cable will also work)
4.) Female-female wires ($1.86, http://tinyurl.com/zcne6t7)
5.) Male-male wires ($2.74, http://tinyurl.com/gvbysly)
6.) 5V relay module ($2.39, http://tinyurl.com/hx7gjxz)
7.) 3V-5V boost converter ($1.51, http://tinyurl.com/zttdxum)
8.) Coffee maker (any coffee maker will work, but it is easier if it has an 'on' button)
1.) A way to setup the RPi (KVM with display cable, or SSH from another computer)
2.) Soldering gun and rosen-core solder
3.) Extra USB cables & mini HDMI if using Pi Zero
Step 2: Setting Up an Email Account
You'll need an email account for this project, and I'd recommend making a new one to avoid getting messages all the time. I used a gmail account because it's free and has a nice interface. There's also a huge amount of support available for gmail accounts because of how many people have them.
An advantage of email accounts in general is that the emails can be sent over the Internet, and email accounts can be "texted;" iPhones, as well as all other cell phones made somewhat recently are able to send SMS messages to email addresses by putting the address in the number box.
NOTE: if you're getting errors about not being able to access or reach the inbox of your gmail account, you probably need to go into the settings and allow non-secure devices to access the account (https://support.google.com/accounts/answer/6010255?hl=en)
Step 3: Installing Fetchmail
I used fetchmail to grab mail from my gmail account. Fetchmail is relatively easy to setup on the RPi and works exactly for our needs.
I used this tutorial to install fetchmail --> http://www.raspberry-projects.com/pi/software_util...
My program files are all included so you can look at those too. You should install all of the program files in the "/home/pi" folder (the default location; one level above the desktop.
Step 4: Hacking the Coffee Maker
This is probably going to be the trickiest step if you've never soldered before. If using a soldering gun is too intimidating, you can alternatively use soldering glue (http://www.amazon.com/Sciplus-Electrically-Conduct...).
However, using real solder will be more reliable and is a great skill to have! If you want to get started, look here:
I began by opening my coffee maker to get at the board; if your coffee maker has a clock or display, it's most likely connected directly to the board, which is where you'll need to solder the wires.
My coffee maker, similar to most, was not designed to be opened, so I actually used pliers and a hammer and chisel to pry away the metal frame and break apart the interior plastic.
Make sure you don't touch any part of the machine that makes coffee while doing this! The board/display cannot get wet and is most likely sensitive to heat, so it will probably not be near the heater or steam tubes.
Once you get the board out, you'll need to identify where the 'on' button is connected; as you can see in the close-up above, mine was just two contacts soldered to the opposite side. I accidentally soldered the wires to the "change minute hand" button contacts, so I had to redo it (that's why I have a curly wire not connected to anything).
After you solder your wires to the correct contacts, you can test by plugging in the coffee maker and manually touching the newly-soldered wires together, which should start the coffee maker.
IMPORTANT: MAKE SURE YOU DON'T SOLDER ANYTHING NEAR THE POWER CABLES, LEST YOU GET ELECTROCUTED!
When you verify the correct contacts have been connected to the wires, you can put the board back into the coffee maker (if you're able to; I used a lot of tape).
Step 5: Configuring the Hardware
The circuit used in this project is extremely basic; all it does is activate the relay to join the wires soldered to the coffee maker's 'on' button contacts.
1.) RPi sends signal from GPIO pin 7
2.) Boost converter receives 3.3V signal and amplifies it to 5V
3.) Relay receives signal from boost converter and activates, joining the two wires.
Step 6: Writing the Program
This was literally my first time using Python, which might indicate how simplistic it is.
The program is divided into three separate files:
1.) coffeeBot.py (the main program that checks for messages and runs the other files)
2.) doGPIO.py (runs the GPIO process of activating the pins that turn on the coffee maker)
3.) startGPIO.py (initialized the GPIO pins, since my coffee maker's on button is double-barreled)
The program files follow this process when coffeeBot.py is run:
1.) Initialize the GPIO pins
2.) Check for mail
2a.) If no new mail, do nothing
2b.) If new mail found, send signal
3.) Sleep for three seconds
4.) Repeat steps 2-4
More details can be found in the attached program files, which I have commented. Keep in mind that all files should be installed into the "/home/pi" directory.
Step 7: Conclusion
Some future improvements I might implement:
1.) Use a Pi Zero or CHIP to reduce cost
2.) Figure out how to phase out relay and boost converter, if possible
3.) Use another service to set the coffee maker to text the user at a certain time to ask if they want coffee
I am also considering using a Lightblue Bean to control the coffee maker in the same process, but using an iPhone app to wake the user up and ask if they want coffee.
Thank you for reading this instructable!
PiWiFio made it!