Introduction: How to Make an Auto-brewing Coffee Maker
For those mornings where you just need that coffee to be ready when you wake up, your Arduino Coffee maker will come to the rescue! This can be done with most coffee makers, but the one I used was a Keurig B-40, but the steps should be essentially the same for different brewers.
-A coffee maker (preferably a cheap one)
-Arduino (I used an Uno)
-2 Relays (Or 1, if you only need to turn on the coffee maker for it to brew)
-Clock module (DS1302 works fine)
-5v power supply (I used an old phone charger)
-Hot glue gun (or other strong adhesive)
Step 1: Set Up Connections
The first step is to dissemble your brewer. MAKE SURE IT IS UNPLUGGED!!! Your goal is to find the board or switch(es) that allow you to brew the coffee. For my Keurig, this was the panel on top. I used this (http://youtu.be/cR9Vy2UiBiA) video to help me dissemble it. Sure enough wasn't easy. In general it should only involve a few screws. When you have the board or switch, you do not have to remove any components. Simply solder wires to either side of the button or switch you'd be using. I only needed two, for the power and 8oz brew buttons. Once these connections are soldered, you are ready to start putting things together.
Step 2: Connecting Everything
After connecting the wires to the buttons/switches you'll need, the rest of the process should be simpler. Of course, you want to power your arduino. For this, you do not want to give it the full AC current, but instead the gentle 5v from your power supply. For mine, I took a hammer and busted open an old phone charger I wasn't using. From there, I cut the power cable of my brewer, and stripped the wires. I soldered the original cables back together, but the wires on the power supply that connected to the wall, I soldered to the cables of the brewer. This means if I plug in the coffee maker, I get power to the brewer like normal, but I also get the 5v as if the supply was connected to the wall. The cables leading away from this can be connected to any GND connection and the Vin pins of the arduino. You now have power. Before actually connecting to Arduino, I recommend setting the clock with the steps below.
To set the clock, you'll need to download an additional library for Arduino available here: https://virtuabotix-virtuabotixllc.netdna-ssl.com/...
Import that into your Arduino libraries, then upload this code onto the device:
// Creation of the Real Time Clock Object
//SCLK -> 6, I/O -> 7, CE -> 8
virtuabotixRTC myRTC(6, 7, 8);
myRTC.setDS1302Time(00, [minutes], [Hour in 24h], [Day of week (Sunday is 1)], [Month], [Day], [Year]);
Almost done! Now all you have to do is upload the attached code, and connect it all. Be sure to edit the brew times in the code, seen before the void setup(). If set to zero, the brewer will not brew on this day.
As for the connections, for my arduino and brewer I had of course the Vcc on the clock, and the Vcc on both relays connected to 5V, the GND on the clock and the relays connected to arduino GND, the positive and negative terminals of the power adapter connected to Vin and GND respectively. As for outputs:
(Specific to Keurig B40! Other brewers will be different)
One relay should have the positive sides of pwr and 8oz brew connected to the middle, and the negative sides of both connected to either side. Power I had connected to the "Always on" side. The IN pin should be connected to pin 4 on the arduino if using the provided sketch.
The other relay should have the switch connected to the middle and always on side, orientation is not overly important, as the relay is a mechanical device and doesn't conduct any of the voltage.The IN pin should be connected to pin 2 on the arduino if using the provided sketch.
The clock is simple, it should be connected to pins 6,7, and 8, as explained in the comments of the sketch.
Step 3: Makin' Coffeh! :D
At this point, if all has been set up correctly, a test run is in order. Plugging in the brewer should also power the arduino board, which should cause the lights on the relays (provided they have them) to turn on, and you should definitely see the green light on the arduino light up. If all goes well, feel free to hot glue the relays, the clock, the arduino, and the power supply to the coffee maker, where you see fit. You now have a self-brewing coffee maker, assuming you have coffee in the brewer at all times, and there is water in it.