loading

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:

MATERIALS:
---------------------------------------------------------------------------------
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)

OTHER EQUIPMENT:
---------------------------------------------------------------------------------------
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.

The process:
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!

<p>i cant connect my new gmail for my raspberry pi to fetchail</p><p>and how can i program commands to specific words i send?? </p>
<p>sh: 1: /home/pi/myfetchmailparser.sh: Permission denied</p><p>fetchmail: MDA error while fetching from EnterEmaiHere@imap.gmail.com</p><p>what should i do??</p>
i keep on gettin this pls help
Hey Richard,<br><br>My guess is that the email account you're using for fetchmail is either not setup to allow insecure devices (gmail), or something else with your configuration is messed up. The &quot;warning: don't run as root&quot; warning is self explanatory, what I did is run the main program with default permissions and used sub process to run only the necessary modules as root.
thank you is all up n running now i had to make my gmail to allow less secure apps and also i was running as sudo which that was the root problem too
<p>http://piwifio.com/MakingCharlottePi.mp4|<br>I want to hear from ya!</p><p>My &quot;concept&quot; is full duplex- not just 1 way!</p><p>AND, (2) of the inputs monitor the condition of the 2 relays! ;)</p>
<p>Thanks, Have planned doing the same but instead of using sms/mail I used a Apache Webserver on my Pi and an PHP interface for connecting the Pi. With this Idea I dont have to use port forwarding on my home network to allow acces over the internet.</p><p>Sweet!</p>
<p>Could you use a transistor instead of a relay here? I'm not sure what the power is on those buttons but I would be surprised if it were so high that it required a relay. Great project. I might try to do this soon.</p>
I'm certain you could use a transistor to connect the circuit, and I considered doing that at the beginning of the project but I didn't have any and wasn't sure which one to get. I'll update the Instructable once I get one!
<p>I bought <a href="http://www.amazon.com/Sunkee-BIPOLAR-TRANSISTOR-Arduino-Raspberry/dp/B00Y9TCRCW/ref=sr_1_1?ie=UTF8&qid=1457638754&sr=8-1&keywords=100pcs+2N2222+NPN+BIPOLAR+TRANSISTOR">these</a> and I think they would work for this.</p>
<p>I love it man! I can think of a lot of things to hack with this. Internet of things here we come... great job!</p>
<p>What a great idea!</p>
Thanks! I plan to expand it to a smartphone app soon using Bluetooth.

About This Instructable

5,435views

146favorites

License:

More by explodr:Text your coffee maker! 
Add instructable to: