Category Archives: coffee

Standalone Coffee Timer – Programming Standalone Arduino by Example

This is a follow-up post on Programming Arduino with Arduino. I’ll show an example of the process based on the Coffee Machine timer. Just to recap the original setup, when connected to Arduino it looked something like:

Coffee machine timer based on Arduino

The Circuit

Here is an updated circuit for the standalone setup:

Coffee timer standalone based on ATMega8

The .sch file can be found here.

You may notice that the new circuit is almost identical to the original. The only significant changes are I/O pin assignments for easier wiring. The IC that drives the circuit is an ATMega8. I chose it since I had a few lying around but it can be replaced with ATMega168 or similar. Note that the footprint here uses Arduino pin annotations. This simplifies identification for software usage. You can get the part from here.
Note: Although not explicitly shown, the 74HC165N shift register should have pin 8 connected to GND and pin 16 to VCC.

The circuit diagram doesn’t include a power supply unit. You can use a basic circuit like this or connect to any regulated 5V power brick (I use a USB wall charger like this or this).

Here’s a picture of the assembled circuit on a breadboard:

Standalone circuit. Things get a little crowded on a single breadboard.

The Code

The CoffeMan.pde sketch was updated to the latest version of Arduino which makes the LiquidCrystal patch redundant. I/O pins are reassigned to match the circuit above.

The Method

First, setup a programming station as described here and place the standalone ATMega chip in the programmer. Alternatively, you can connect your Arduino directly to the standalone by following the ISP pin assignments. If you’re using a new chip, upload the bootloader as explained in step #3. Next, follow steps #4-#7 to set up Arduio IDE to upload sketches via the programmer. Open the CoffeeMan.pde sketch and hit the upload button:

Uploading the sketch with Arduino IDE via a programmer

Once programming completed successfully insert the chip in the target circuit. Connect it to a power source and test it.

Adding Serial Access

Troubleshooting standalone setups can be a pain. Although debugging with LED’s may work, I suggest connecting a serial console via an FTDI breakout or an FTDI cable. The connection is simple enough:

FTDI USB-RS232 connected to Arduino as basic serial console

The FTDI USB-RS232 header is cross connected to the Arduino chip. This means the FTDI TXO (pin 4) is connected to Aruino RX (pin 2). The FTDI RXI (pin 5) is connected to Arduino TX pin (pin 3).
Note: The FTDI Pin 3 can be used as a 5v supply pin. Do not connect it to input voltage.

When connecting the FTDI cable/breakout to a USB port, a new serial port will be registered. You can start it from sketches with standard Serial.begin(…) command and communicate normally as you would with Arduino.

An added bonus is the ability to upload sketches to the chip via the bootloader directly from the Arduino IDE. To accomplish that you’ll need to follow some steps:

  1. Burn bootloader via programmer as shown above
  2. Revert the Arduino IDE preferences file to use bootloader as an upload method
  3. Connect a push button switch between GND and Arduino reset pin (pin #1 on the ATMega)
  4. Open the Arduino IDE and find the FTDI serial port under Tools Serial Port
  5. Load your sketch
  6. Hold the reset button and hit Upload.
  7. Release the reset button
  8. Hope for the best…

The manual reset procedure can be quite annoying. From Sparkfun’s product page on the FTDI breakout, the DTR pin (pin 6) on the FTDI breakout can be used to auto-reset the chip for sketch upload. I didn’t get it quite working, but I’ll post an update if I’m successful.


This post meant to show some handy methods to convert an Arduino based projects to a standalone setup, while maintaining Arduino compatibility for programming and debugging. The method can be used as a step in the life-cycle of a project from concept to production.

Leave a comment

Filed under coffee, production

Making Coffee


Arduino’s making coffee, not bad. I built a small prototype circuit that keeps time and has an alarm mechanism. When the alarm goes off, the relay is kicked for 2 seconds. The user can set the time and alarm, as well as toggle the alarm on/off.

The prototype is built on a breadboard. Here’s a picture with button legend:



I Connected the relay to the coffee machine (pins NO and Comm). Also, the relay coil pins are connected to the breadboard, where the legend mark Relay pins. See the circuit schematic below for more details.

After boot, the clock needs to be set. To do so, click the set button. Use plus and minus to change the time. To move from setting minutes to hours, click set again.

Setting the clock

Setting the clock

To set the alarm, click the display button. Then set the time similar to the way done with the clock.

Setting the alarm

Setting the alarm

To toggle the alarm on, click the alarm button.

Alarm on

Alarm on

The Board


The 16×2 LCD is connected directly to Arduino in 4-bit mode. The code uses the stock LCD library that comes with Arduino IDE (with some changes, see below in the code section).
The operation buttons are connected via an 8-bit shift register. The original purpose  was to use the shift register to have more outputs available. In the final design only 5 buttons are used, so it can be omitted easily (the code needs to be updated though).
Below is the schematic in image format. For eagle .sch file see here.

Eagle schematics for the coffe timer project

Eagle schematics for the coffee timer project

The schematics was done some time after the circuit was running. The picture of the breadboard may be more accurate.

The parts list is quite short:

  • 1 HD44780 compatible LCD (I used a 2×16)
  • 1 Shift register 74HC165N
  • 5 Momentary touch switches
  • 5 10K ohm resistors
  • 1 1.8K ohm resistor (for the relay)
  • 1 NPN 5v transistor
  • 1 Diode (normal glass ones)
  • 1 5VDC 10A relay (I used a super cheap SSR, 6VDC is also fine). 10A is a real overkill for most uses, a good calculation can be found here

The Code

Download the sources (zip archive) here.

The source code contains two libraries besides the applet itself. First of all, I added two functions to the LiquidCrystal library:

  • setCursorMode – Allows to blink a character. Used when setting the hour/minutes.
  • setCustomChar – The HD44780 controller allows setting up to 8 custom characters. These are used in the alarm symbol and for the coffee mug characters

In the zip there’s are replacement files for LiquidCrystal.h and LiquidCrystal.cpp. To use it, locate the LCD library in Arduino IDE (typically arduino-0015/hardware/libraries/LiquidCrystal/) . Replace the files with the supplied ones, or use a patch.

Another library is supplied in the zip. This library drives the 64HC165N shift register. It should probably work with any 165 style 8-bit shift register. To use, just dump the files in the library path of Arduino IDE (typically arduino-0015/hardware/libraries/).

Finally, the source code that runs on the controller is called CoffeeMan.pde. Open it with the Arduino IDE and download it to your controller.

The code is quite commented. I hope it’s readable. If any more details are required, leave a comment.

What’s Next

This was a nice learning project, but it takes some extra work to refine it for real usage.

First, there are a couple of problems with the design so far. The display used here is too large for practical use. A 2×12 would be suffice. While it doesn’t seem to be a mainstream product, it’s available from several vendors (here, here or in large quantities). Even an 2×8 is enough to show time and some graphics, but it might be a bit too compact.

Another issue is a connector. It seems logical that the relay will reside in the machine, with a cable connected to the controller. One possible option is to use 3.5mm mono jack (like the ones used in microphones).

Last, the board needs to be redesigned as a standalone, this has been done before. A minimal approach is too restrictive in this case, since the circuit will need an external crystal (if the clock is to be anywhere near accurate).
Using an ATMega8 instead of Arduino’s 168 seems very logical, since the codespace used is quite minimal (4K instructions).

Feel free to comment and ask questions.


Filed under coffee, prototype


Before I go about connecting LCD and buttons, I’d like to see how a relay operates the coffee machine.

Here’s a picture of the coffee machine with the bottom plate removed (held by 3 T screws):


The heating element  (the pipe in mid-screen) doubles as the carafe warmer. Water are pumped from the tank, heats under the plate and flow back up to drip on the coffee.
Top right there’s a control circuit. When the button (top left) is pressed (and released), a timer chip kicks in and operates the heating element and pump for about 1 minute. The heating element remains on for two hours to keep the coffee warm.

The electrical rating of the entire machine is 800W. Since I’m about to operate the switch for just a second or two, a standard 5VDC relay will do fine.

To keep things simple, I’d like to connect a relay directly to the switch, instead of changing the circuit. Here’s a test-connection:


The relay is a cheap 5V SSR (solid state relay). It cost less than 2$ and

To test the relay, I pulled +5Vand GND from the Arduino supply. Works like a charm. When the relay kicks in, the button closes the circuit and triggers the coffee making process.

Since the digital output pin of Arduino is very low voltage (~1.5V), I’ll connect the relay via a transistor. There are some good resources on the web:

Leave a comment

Filed under anatomy, coffee, relay

New Beginnings and Coffee Machines

Last month I received my Arduino Duemilanove board. After doing some basic tutorials I decided to start my first simple project. Why not automate my faithful coffee maker? It would be nice to wake up to a fresh cup.

Some coffee machines can be programmed to brew at desired time. My model is a simple one with an on/off switch. This means I will need a relay to ‘press’ the button, and some timekeeping logic to set the alarm on time.

A sketch of the idea:


For and LCD I’m planning to use an HD44780 compatible LCD, since there’s I can leverage the existing Arduino library.

There will be 5 control buttons:

  • Alarm on/off
  • Set mode (HH/MM)
  • Plus
  • Minus
  • Set alarm/ set time

A 5v relay will be used to trigger the coffee machine and a water level sensor will alert if the water tank is empty.

Leave a comment

Filed under coffee, concept