|
|
(34 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| In my WG, my flatmates and I take turns buying the coffee grounds. Sometimes this becomes confusing, as there are three of us, and the person who is next in line to buy coffee is not necessarily aware that the coffee supply is low.
| |
|
| |
|
| I'd like to develop a system that ensures that our WG is always supplied with enough coffee. Using Arduino and a photoresistor, I propose to install a sensor inside the coffee ground that will send a reminder SMS to the next person in line as soon as the coffee levels are low.
| |
|
| |
| [[File:Coffee03.jpg|500px]]
| |
| <br>
| |
| [[File:Coffee04.jpg|500px]]
| |
|
| |
| http://farm5.staticflickr.com/4053/4473164605_99c7a30b21.jpg
| |
| <br>
| |
| Above image source: Flickr user iDecrease
| |
| <br><br>
| |
| <b>Setup</b><br>
| |
|
| |
| http://farm4.static.flickr.com/3254/2507585112_60cc338bfb_m.jpg
| |
| <br><br>
| |
| [http://code.google.com/p/sserial2mobile/ <b>Code Example</b>]
| |
|
| |
| SSerial2Mobile phone = SSerial2Mobile(2,3); <br>
| |
| phone.sendTxt("+017627700334","Remember to buy more coffee!"); <br>
| |
| phone.sendEmail("diannamertz@gmail.com", "Remember to buy more coffee!"); <br>
| |
| Serial.print("Batt: "); <br>
| |
| Serial.print(phone.batt()); <br>
| |
| Serial.println("%"); <br>
| |
| <br>
| |
| Serial.print("RSSI: ");<br>
| |
| Serial.println(phone.rssi());<br>
| |
|
| |
| [http://www.uni-weimar.de/medien/wiki/IFD:PhysicalComp2011/code#III_Potentiometer_.28Arduino.29 <b>Photo Resistor Code Example (from class)</b>]
| |
|
| |
| // specify the pin numbers we are going to use:<br>
| |
| int ledPin = 13;<br>
| |
| int potiPin = 3;<br>
| |
| // create a variable to hold the value from the poti:<br>
| |
| int potiValue;<br>
| |
| <br>
| |
| void setup(){<br>
| |
| // set the pin mode of the led pin to act as an output:<br>
| |
| pinMode(ledPin,OUTPUT);<br>
| |
| // establish a serial connection:<br>
| |
| Serial.begin(9600);<br>
| |
| }<br>
| |
| <br>
| |
| void loop(){<br>
| |
| // read the current value of the poti pin <br>
| |
| // and store it in the variable potiValue:<br>
| |
| potiValue = analogRead(potiPin);<br>
| |
| <br>
| |
| // if the value is over a certain threshold<br>
| |
| // (here it's 511 or the middle of the range),<br>
| |
| // turn the LED on, otherwise turn it off:<br>
| |
| if(potiValue > 511){<br>
| |
| digitalWrite(ledPin,HIGH);<br>
| |
| }else{<br>
| |
| digitalWrite(ledPin,LOW);<br>
| |
| }<br>
| |
| <br>
| |
| // in oder to send the poti value as one byte (0-255)<br>
| |
| // we have to scale it from the original range (0 - 1023):<br>
| |
| int scaledVal = map(potiValue,0,1023,0,255);<br>
| |
| // send the scaled value via the serial port as a byte:<br>
| |
| Serial.print(scaledVal,BYTE);<br>
| |
| // wait a little bit to not overload the serial buffer:<br>
| |
| delay(50);<br>
| |
| }<br>
| |
| <br>
| |
| <b>Equipment:</b>
| |
| <br>
| |
| [http://www.sparkfun.com/products/9607 Cellular Sheild] <br>
| |
| SIM card <br>
| |
| Antenna <br>
| |
| Arduino <br>
| |
| Photoresistor <br>
| |
| Coffee can <br>
| |
| Depleting coffee grounds <br>
| |
|
| |
| <b>Tasks:</b><br>
| |
| <ul>
| |
| <li>Alter or replace coffee can so the connection from Arduino to photoresistor is possible.</li>
| |
| <li>Alter code so that the phone numbers alternate between roommates.</li>
| |
| </ul>
| |