Introduction: Power Keurig From Bed Over WiFi

About: I'm a retired high school teacher enjoying not having to get up at 6 every morning and grade papers every night. Now I have time to bowl and play with the Arduino Yun. Life is good.

I recently retired and I'll admit I'm quite a noob at electronics. It's something that's always interested me but never had the time to experiment. Here's my first Instructable. If I made a mistake with the electronics, please be kind, but correct me.

Now that I'm retired I find that I get out of bed at different times. On some mornings I need for my Keurig coffee maker to come on before 6 a.m. and other mornings later. I wanted my Keurig to turn on automatically when I'm ready to get out of bed and I wanted it to run just long enough to make 2 cups. I know I could set it to come on at 5:30 a.m. and go off at 9 a.m. or so, but I don't want it to heat/re-heat water when I'm not using it, plus I needed a project to keep me busy.

I had done one other experiment with the Arduino Yun so I was not hesitant. I chose the Yun because it works over WiFi; I did not want to run Cat 5 cable from my router to my coffee maker. I wrote a short web page which I can run on my smart phone, which charges beside my bed. I 'borrowed' a sketch used to allow a web page to control the pins on the Yun and I shortened it for my one-command sketch.

So this is how it works... I go to this web page on my smart phone, click a graphic of my coffee maker, which is actually an HTML link to a page on the Yun which activates Pin 13, which closes the coil circuit on a reed relay for 4 tenths of a second, which activates the switch on my Keurig. The switch on my Keurig is a momentary switch that, when pushed, turns the coffee maker on when it is off or off when it is on. I still have to load a K cup and press the brew button, but having the maker heat the water while I get out of bed and get dressed puts coffee in my mouth faster.


Phillips screwdriver

solder and a soldering gun

wire stripper

wire cutter


1 Keurig brewer with a momentary (on or off) switch

1 Arduino Yun

1 AC adapter to 5VDC micro USB (Just Wireless AC Charger for Samsung cell phones)

4 standoffs (1 pk at Radio Shack)

1 piece of panel board, 3" x 3" or similar

3" of Velcro

1 5VDC / 120V 0.5A reed relay

1 black, 1 red 10" hookup wires

2 heat shrinks or electrical tape


Step 1: Set up the Arduino Yun and load the sketch

Step 2: Set up port forwarding on the router (optional, for Internet access)

Step 3: Make the hardware connections

Step 4: Write the web page and upload it to a server (optional, but aesthetically pleasing)

Step 5: Make a cup of coffee and turn off the brewer

Step 1: Set Up the Arduino Yun and Load the Sketch

The Arduino Yun has a micro USB connector and runs on 5V DC. I chose the Just Wireless AC Charger for Samsung cell phones. I did not use a voltage regulator; you experts may advise otherwise. Connect the AC charger to the Yun and plug it in to any wall outlet.

The Yun, when it powers up, runs its own WiFi network. Use your WiFi laptop/smart phone/tablet to change your WiFi network to "Arduino-XXXXX" where X is replaced by a series of digits. Then, using your browser, go to arduino.local and the config page should come up. Click Configure and change the wireless network to your home WiFi network and set a password. Change the hostname if you like; I changed mine to 'yun2' as I already use 'yun1' to control a living room light. Note the Yun's MAC address; if there is a problem later you can identify it from your router. Restart, and remember to change the WiFi network on the device you are using to program the Yun. When the Yun restarts, you should still be able to connect to it at arduino.local. Though it is not a necessity, I advise changing the dynamic ip address to a static one. My router hands out 254 addresses in the range, so I made the static ip address. I doubt I will ever have 200 devices for which my router hands out dynamic addresses. Restart after making these changes and verify that you can reach the config page of the Yun at its new ip address.

If you have not already done so, download the Arduino IDE for your particular computer from Start the software, and from the Tools menu, choose Board -> Yun, then from the Ports menu, choose the connection named for the ip address of the Yun. **If you don't see it (not an uncommon problem) you can do a web search for this problem and get several easy fixes. I simply shut down the software and restart it and wait a minute and often the ip address appears in the Tools --> Ports menu.** Copy the sketch in this step and verify and upload it to the Yun.

You may verify that the sketch works by going to http://yun_ip_address/arduino/digital/13/1 After entering 'root' as the username and the password you set earlier, click OK and watch the red LED on the Yun, verifying that it lights up for about a half second. If so, you are ready for Step 2.

Step 2: Set Up Port Forwarding on the Router

This step is optional. If you do not wish to be able to turn your Keurig off or on from outside your WiFi network, you will not need to set up port forwarding. However, if you want the ability to switch your Keurig over the Internet, you need a public ip address. You can use a service like Yaler for this, but you'll have to pay them a yearly fee. My Time Warner Cable modem/router, as most newer routers, can do port forwarding. If you have a cable modem that is separate from your router, use the public ip address of the cable modem as the WAN address when setting up port forwarding, otherwise, use the public ip address of the router.

In a browser, enter the ip address of your router, such as Log in to the router. You may have to look through the menus to find port forwarding, but it is often in the 'Advanced' area. The local address will be the ip address of the Yun, the beginning and ending ports will both be 80, the external ip address can be left as (unless your router is separate from your cable modem, in which case use the ip address of the cable modem), and the external port can be any number not already used. I avoid 80, 443, 21, 23, and 25. For this project I will use 81. Enter 81 for both the beginning and ending ports, and select both TCP and UDP. Enable the forward (aka 'save' it), and before you exit your router's configuration program, find and write down its public IP address or write down the ip address of the cable modem. In your browser, enter this ip address followed by a colon, then the port you selected as the WAN port when you configured port forwarding. For example, , where the x's represent the public ip address of the cable modem or router, should make the LED light up for about a half-second.

Step 3: Make the Hardware Connections

Now that you can blink an LED by entering a web address, all you need to do is connect the Keurig coffee maker to the Arduino Yun. There is more than one way to accomplish this, but I suggest you use a reed relay and solder your connections.

Unplug your Arduino and Keurig from the wall.

Use jumper wires to connect the Arduino (specifically Pin 13 and GND) to the two coil contacts on a 5VDC / 120 VAC 1amp reed relay. Solder the connections at the reed relay. Next, you will connect a red and a black wire to the inside of the Keurig coffee maker. Make sure you unplug your coffee maker from the wall and remove the water tank. Place the coffee maker on its back. Some water may leak out; dry it up immediately.

You will have to remove about five screws from the bottom plate of the coffee maker, then carefully swing the bottom plate aside. There is no need to cut the green ground wires. With the coffee maker on its back, locate and pull out the red and black wires on each side of the power switch. Cut them so that both ends are long enough to strip about ½ inch. Cut a 10 inch section of red hookup wire and another black wire the same length. Strip ½ inch from one end and about ¼ from the other. Take the red wire and twist and solder the ½ inch end to the two red wires inside the coffee maker; do the same for the black wires. Insulate the two soldered trios separately with a heat shrink or electrical tape. Feed the two 10 inch wires out the opening for the power cable and replace the bottom plate. (See photo.) Sit the Keurig upright and replace the water tank.

Attach the ¼ inch stripped ends to the COM and N.O. (doesn't matter which) contacts of the reed relay and solder them. This is optional, but I attached the Yun to a 3x3 inch panel board using standoffs, then attached velcro to the back of the panel board and the back of the Keurig. Plug in the Yun and the Keurig and watch that the green and white LEDs light up on the Yun. It may take a couple of minutes for the white LED (WiFi) to light up.

If your Keurig turns on when you plug it and the Yun in, you should be able to turn it off by going to http://your_arduino_ip:81/arduino/digital/13/1 where the 81 is the port you chose when configuring the forwarding. If you did not choose port forwarding, omit the ":81" portion. By the way, this same address turns the Keurig on.

Step 4: Write the Web Page and Upload It to a Server

This step is also optional, but if you have a place to store a web page, you can make an attractive page to control this and any other future Arduino Yun connections.

If you choose to omit this step, you simply have to save the http://your_arduino_ip:81/arduino/digital/13/1 page to your smart phone/tablet and refresh it when you want to power up or down your Keurig. Omit the :81 if you did not do port forwarding. But if you have a site to store public web pages, the html code above will allow you to create a page which shows a graphic you can click to power the Keurig up and down, and you could add other graphics to control other Yuns in the future. If you choose to make the page, don't forget to upload a graphic called keurig.jpg saved in the same folder as the web page. You can also change the web page title accordingly; mine was first created to control my living room lights. After you click the graphic, you get the message that the coffee maker was powered on or off. I immediately use the back button so the page is ready for the next power up or down.

Avoid powering the coffee maker up and down in succession; this could damage the unit.

Step 5: Make a Cup of Coffee and Turn Off the Brewer

Go to another room (or outside your home if you configured a public Internet address with port forwarding) and power on your Keurig coffee maker using your mobile device. After allowing enough time to power up and heat the water, go to the coffee maker, put in a K cup of your favorite brew and make yourself a cup. Power down with the mobile device and enjoy the coffee.

Your comments are welcome but remember this is my first Instructable and I've only been working with electronics and Arduinos for about a month. If you have any questions I will attempt to answer them or politely ask an expert to answer.