Smart Button
Intro: 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
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)
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...
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.
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. :)
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).
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.
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.
Thanks Jéssica.
I will post a better video tomorrow.
Enjoy your Coffee.
http://www.youtube.com/watch?v=VBFOwR3DupU ( no way to embbede this thing, save doesn't work)
Thanks Jéssica.
19 Comments
owagner 12 years ago
ಠ_ಠ
stackerjack 13 years ago
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 13 years ago
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 13 years ago
arthurb 13 years ago
Handy_Andy 13 years ago
powderskier 13 years ago
sjoobbani 13 years ago
and look under emergency stop or Estop
They are EXTREMELY EXPENSIVE
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 13 years ago
Here is one that I have purchased (for its intended use, on a CNC machine): http://www.automationdirect.com/adc/Shopping/Catalog/Pushbuttons_-z-_Switches_-z-_Indicators/22mm_Plastic/Emergency_Stop_Pushbuttons_Illuminated_-a-_Non-Illuminated/GCX3131
arthurb 13 years ago
arthurb 13 years ago
Lenny24 13 years ago
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 13 years ago
janw 13 years ago
iceng 13 years ago
slithien 13 years ago
rick6213 13 years ago
kelseymh 13 years ago
Topcat2021 13 years ago
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
Dan.
P.S. this was picked up by Hack A Day Good luck to you.