Introduction: Smart Button

This is a button a little bit smarter. (Microcontrollers and coffee, who doesn't like)

I i'm using it to fill my Coffeemaker  with water. This way its a little bit more fun and i always get the same amount of water.

Its a simple project, and it's a good excuse to play with a PIC10F, one really small micro-controller. Code is written in C, a nice way to start with it.

It interfaces with the user blinking one led. so you can chose how much time the valve will open ( giving a good control on the amount of water). On the current firmware settings ( and with my valve) are for 1-2-3-4 cups of coffee ( i have a big cup, 300ml).

Just keep in mind that this button can be used for other uses.

The design (and problems that where solved) are on the next page, but if you just want to build this thing   go to the building instructions page and download the project files.

Arthur Benemann 2011 Brazil

Step 1: In the Beginning...

This started as a weekend project, me and my girlfriend where making a coffee after lunch. Then a i had an idea, what about making a timed water valve so i can always make the same tasteful coffee, simple , a little useful, and easy to build.

As always a good pile of junk it's great for this, a big yellow button and a water valve from a washing machine ( both in the pictures below).

Things need to be as simple as possible so a small micro-controller would be perfect. Luckily i had some spare PIC10F206 on my parts box. A 100mA transformer and a 78L05 would do the power supply, and a relay to control the valve ( mains power).

All parts are set up, now the board.... ( next page)

Step 2: Schematic V1

I  think i would get this one at the first try, i was so simple... ( jump this if you are not interested in failures)

Ok, it was just a question of putting building blocks together.

Power supply - ->  Line - Trafo - Brige - Big Cap (100uF would do the job)- 78L05 - and done

Relay               -->    Resistor ( 1k will saturate the BC548)  - 5v relay - protection diode (1n4004)

PIC                  -->    Internal pull up for button - a simple LED  - connection to the relay block

OK that was easy.I should work nothing wrong until where. ( schematic below).

Draw the board, tone transfer, soldering  ( forwarding so we don't blow the surprise)

Now just add some codding ( explained on the next pages), and programing with temporary wiring.

Turn it up !!!  And it doest work properly :(...

Next page for the solution...

Step 3: Board V1

It  fail "sometimes"...

Man i hate when someones work is left like this. So lets investigate...

There is a picture below of the original prototype v1, it's full of wiring  and solder  because of the testing...

I tried a lot of things, powering it up from a external source, changing the relay supply to before the 78l05 regulator, putting huge caps on some points of the circuit....

The i worked, i had put a direct wiring for the Microcontroller supply. Currents running to the relay was messing up with the PIC power ( one oscilloscope would be great by now ).

The picture has some highlights on this.

Problem solved, let go to v2.0.

Step 4:

So what can be improved:

Filtering caps.
Star Grounding.
Relay power does't need to be regulated.
MCU position could be more away from mains voltage ( relay).
Don't use MRCL pin, just to be sure.

Just a question of redesigning the board ans schematic. Final result is below:

This solved the problems. :)

Step 5: Coding

I wrote a program to control the button, but it was not very friendly to the user ( i prefer not to comment it). Here i have to thak Jéssica for her idea for the program.

Button press is used to change between modes of operation,

n° press    |  Dose    |  LED
0 press      -  0 off     -  off
1 press      - 1 cup    -  slow blink
2 presses - 2 cups  -  blink
3 presses - 3 cups  -  fast blink
4 presses - 4 cups  - on
5 presses --> return to off position

There is a timeout in "cups mode"  if there isn't a press for 2-3s it go to filling mode. And stays there until the filling timeout, that deepens on the mode.

I implemented this with a state machine, and a debouncing routine.

The on time of each mode is defined in the top of "main.c" file, this control how much water goes to the coffeemaker. Experimenting with the valve in place give me this results ( and they don't seem to change too much because pressure is constant).

You must change this values to agree with your installation.

This is my first low end microcontroller project programed in C, i used to think that C would't be as easy to code as assembler, and the code would be so big. I was wrong C is great,fast development and relative small code.Code was compiled with hi-tech C compiler lite (free).

Step 6: Building It

The project was already tested, so if you want to build this is the way:

There are no special parts on this project, only the valve needs some attention. I use a washing machine valve to control the water.

Parts List:
Qty Part   Value
1    Cap     100uf 25v
2    Cap     100nf 0805 
1    Diode  1N4004
1    Res.    1k 0805
1    Res.    330R 0805 
1    Transistor    BC548 
1   Relay   12v
1   LED      RED 5mm
1   IC 78L05
1   IC          MB6S 
1   IC          PIC10F204OT 
1  Transformer      220v/6v+6v 100mA

Schematics and Board layout are on the projects files.

I use tonner transfer method. Source was compiled with MPLAB and Hi-tech litle.

Have fun.

Step 7: Wiring

Just follow the picture to do  the wiring...

Step 8: The Ending

Just to finish a little movie of it working. ( sorry about the darkness, one of the kitchen lights broke just now).

I will post a better video tomorrow.

Enjoy your Coffee. ( no way to embbede this thing, save doesn't work)

Thanks Jéssica.


owagner made it!(author)2011-07-14

"Luckily i had some PIC10F206 on my box. A 100mA transformer and a 78L05"

stackerjack made it!(author)2011-02-04

I think this project is probably OK if you are an electronics expert.
There are far too many abbreviations for it to be of any use to the average guy. There is also no description of how to program the chip.
If you already ARE an electronics whizz-kid, you don't need it, you can make one yourself.
I certainly wouldn't vote for it.

arthurb made it!(author)2011-02-04

Hi if you want to program it easy, buy an PICKIT2 and solder 5 temporary wires.

I din't include the programing because i forgot to take pictures at that time. But there are so many places with a programing tutorial that i didn't think i was worth the trouble.

Munchys made it!(author)2011-02-16

Wouldnt picaxe be easier?

arthurb made it!(author)2011-02-18

I think it would cost more than $0.58

Handy_Andy made it!(author)2011-02-03

Very nice! Anyone else wondering where large, red emergency stop buttons can be purchased? The Staples "Easy" buttons are starting to look tempting, but the button you used is epic...

powderskier made it!(author)2011-02-03

all ski lifts use them there available on line

sjoobbani made it!(author)2011-02-03

Go on DIGIKEY's website
and look under emergency stop or Estop
Omron is the best though
I have one of those set up for my alarm system.
Panic Button, key reset,
safety cover
128DB alarm
105 CD Strobe light

OMg :D

guido666 made it!(author)2011-02-03

He's using an industrial "emergency stop" button. Typically they lock down when pushed, and must be twisted to release (as indicated by the arrows on the button's face). You can purchase them online for about $10-20.

Here is one that I have purchased (for its intended use, on a CNC machine):

arthurb made it!(author)2011-02-03

Exactly, i just cut the things that hold it down when pressed

arthurb made it!(author)2011-02-03

I was bought for a big industrial machine, but it was has not been used. Luck for me :)

Lenny24 made it!(author)2011-02-03

Hey! Cool 'ible.
On these Circuits, a 'star Grounding' isnt really necessary. On Audio circuits it makes sense, but the Components on the board arent that sensitive.

arthurb made it!(author)2011-02-03

I thought the same thing, it's a shame that i don't have an oscilloscope at hand. But it was reseting the PIC on the first version, after i wired them directly to the regulator it work.

janw made it!(author)2011-02-03

Great project!!! You have my vote.

iceng made it!(author)2011-02-03

Very nice distinctive contrast the red panic button against a yellow enclosure top.

slithien made it!(author)2011-02-03

Realised it looks like an atari controller (that realy old gaming system).

rick6213 made it!(author)2011-02-03

yea, Philips coffee machine!

kelseymh made it!(author)2011-02-02

What a great little microcontroller project! And who doesn't need a giant red eject button first thing in the morning? :-D

Topcat2021 made it!(author)2011-02-02

Good Work;
I like this and for quite a while I have been thinking about a way to automate the water filling of a bunn coffee maker, just flip a switch and coffee in 90 seconds.
Keep up the good work

P.S. this was picked up by Hack A Day Good luck to you.