Now the only problem I had was trying not to make a mess when filling it with water before each use. It's located in a tight spot so having to pull it out each time and push it back was getting old. I thought about connecting a water line and a small valve that I could just turn on and off to fill the reservoir, but that would require me watching the thing fill, and that wastes time. I needed to use technology to do this for me.
But how?
My first thought was to get a 555 timer chip and just make a timer circuit that would let water in for X amount of time. But that wasn't good enough, current water pressure (is my wife taking a shower while the washer is running?) could affect that. I needed better.- I needed something that could be able to see if there was already water in the reservoir.
- I needed to insure it was filled to the proper level each time.
- I needed a way to indicate the status of the water level in the coffee maker.
Solution? Arduino!
I had just gotten into the whole Arduino thing and hadn't quite figured out what to really do with one.I knew what they could do, I just didn't know what I wanted to do that would actually be a permanent use for one of these handy micro-controllers. This was my perfect first project. It had a purpose that was measurable and I could actually create something usable. And I would be able to prove to my wife that these little circuit boards I had been spending money on did something!
I hooked up a 24v water valve (similar the kind used for in-ground sprinkler systems) to to the water line running to the sink in my bar and use it to control the water flow. I would suggest using an Ice Maker line and while you are at it insert an inline water filter.
I am controlling the valve with a relay shield mounted on the Arduino. I used a simple two wire moisture sensor method to determine when the reservoir was filled. I went with a 10kΩ resistor since I was measuring water not dirt.
Currently I'm using the Seeed Studio Relay Shield for Arduino which is serious overkill. It has 4 relays capable of 120 volts of which I am only using one (at 24 volts). Soon I will swap it out for a SainSmart 2 channel Signal Relay or something similar.
I added an LED to signal if the reservoir is empty, filled or being filled (solid lit when filled, blinking while filling, off if empty)
The best part was that none of this required any modification of the coffee maker. The one I own has a small hole in the back just above the Max Fill line (guess what for) that was already the right size to allow the water supply line and moisture sensor wires to fit right in. But you could make this work with just about any coffee maker.
After everything was tested and working, I mounted the Arduino and relay shield up under the bar where it was safe from being splashed and mounted the button and LED into a panel behind the bar.
Now I just walk up and press the button. By the time I have coffee in the filter cup and put it back in the maker, it's full and ready to brew!
PICS ARE COMING.....
// Code to fill the water reservoir on my Coffee machine.
// Will upon pressing of button, engage relay to allow power to water control valve.
// Water will flow until moisture sensor reads reservoir is filled.
// LED will blink during fill cycle and blink rapidly when reservoir is full.
// Relay will not engage if reservoir is already full.
const int relayPin = 6; // assign pin for relay
const int LEDpin = 13; // LED on Pin 13
const int buttonPin = 2; // the number of the pushbutton pin
int moistureSensor = 0; // pin 0
int moisture_val; // 0 = empty !0 = full
int buttonState = 0; // for reading the pushbutton status
boolean filled = false; // Presume empty on startup
void setup() {
// define modes for pins
pinMode(relayPin,OUTPUT);
pinMode(LEDpin,OUTPUT);
pinMode(buttonPin, INPUT);
digitalWrite(LEDpin,LOW); // Start off with LED off
}
void loop() {
moisture_val=analogRead(moistureSensor); // check to see if reservoir is already filled
if (moisture_val > 0) {
digitalWrite(LEDpin, HIGH); // if it is, turn on the LED
filled = true; // and set the flag
} else {
filled = false; // if not reset the filled status
digitalWrite(LEDpin, LOW); // and make sure the LED is off
}
buttonState = digitalRead(buttonPin); // did someone push the button?
if (buttonState == HIGH) { //button is pushed
moisture_val=analogRead(moistureSensor); // check if full
if (moisture_val > 0) { // has water reached the sensor?
filled = true; // if so, set the flag
} else {
filled = false; // otherwise, ensure flag is cleared
}
if (!filled) { // if it's not already filled
digitalWrite(relayPin,HIGH); // power on relay to power on valve
digitalWrite(LEDpin,HIGH); // turn on LED
while (!filled){ // still not filled?
digitalWrite(LEDpin,LOW); // turn off LED
delay(500); // wait a tick
moisture_val=analogRead(moistureSensor); // check water level
if (moisture_val > 0) { // Are we full yet?
filled = true; // if so, set flag
digitalWrite(relayPin, LOW); // turn off relay, close valve
} // endif moisture_val
digitalWrite(LEDpin, HIGH); // Turn LED on (blink)
// Will repeat until Filled is true and fall out of loop
// leaving LED on.
delay(500);
} // endwhile !filled
} //endif !filled
} //endif buttonstate
} // endloop
pretty cool idea, one day I'll get something like this going, fill from reverse osmosis.
ReplyDeleteI would love to do something similar for my Cuisinart coffee maker. Might you happen to have a schematic of the circuit you created?
ReplyDelete