Twitter Coffee Pot
This program allows users to brew coffee using the mbed, Twitter, and a Power Switch Tail
Parts Needed
- Coffee maker
- Power Switch Tail
- mbed
NOTE: interacts with proxy on local machine facilitated by supertweet.net. Refer to http://www.supertweet.net/about/localproxy/ to configure.
NOTE: Any issues that may occur, most of the time lies within the setup of the proxy.
Details
Our program uses the builtin HTTP Client library to interact with twitter in order to brew coffee. The communication with twitter is facilitated through the use of a proxy running on a local machine. Our setup involves using a network bridge on the local machine to bridge the mbed and allow it to send its HTTP GET/POST requests to the local proxy, which will then handle communicating directly with twitter.
The program initially does an HTTP get request to get the newest tweet from the coffee machines timeline to use as a starting point to determine when a new tweet has arrived. Each tweet has a unique ID attached to it, therefore one can use this to determine if a new tweet has come in. After initially getting the first tweet to start, the program waits for the user to press the pushbutton down, indicating that the user has put coffee and water into the machine and the machine is ready to brew.
The program then issues an HTTP GET request to the local proxy server to see if a new tweet has arrived. If one has, it goes and checks if it is in the valid format (format is <coffeehandle> <numCups> cups) and notifies the user if the coffee machine is busy or currently not ready for brewing. If it is ready to brew, it notify the user that the brewing process is beginning and then informs the user when the coffee is done brewing.
The brewing process is controlled by a power switch tail which provides power to the coffee machine for a certain period of time to brew the proper amount of coffee.
Download Coffee Maker Program
Import programtwitterCoffeeMakerFinal
Twitter Coffee Maker
Twitter REST API V1.1
We use two commands from the twitter API: one to get tweets from our wall and another to post tweets
Get Tweets Command: GET statuses/mentions_timeline (link to description: https://dev.twitter.com/docs/api/1.1/get/statuses/mentions_timeline)
POST statuses/update (link to description: https://dev.twitter.com/docs/api/1.1/post/statuses/update)
One has the ability to set various parameters to change the data they receive for their own applications. View the API to see what those options are.
Coffee Maker Main Program
NOTE: Change IP address in URL to that of the local host running the proxy server.
The figure above explains what the main program is executing.The main program constantly communicates with Twitter to check for new tweets in order to initiate the brewing process. Even after the brewing process has begun, the mbed is still looking for new tweets. The brewing process will not begin until the push button is pressed to signal that the ingredients are there to make coffee. The mbed sends tweets to notify user of all actions that it is taken. The LCD lets the user know if communication between the mbed and twitter are successful as well as showing the state of the brewing process.
- Look into the program to see what each individual called function does.
Communication between Mbed and Twitter via proxy server
Picture of Twitter Coffee Maker
Video of Twitter Coffee Maker
Wiring
Ethernet
Mbed | Sparkfun RJ45 Ethernet MagJack Breakout |
---|---|
TD+ | P1 |
TD- | P2 |
RD+ | P7 |
RD- | P8 |
uLCD
PowerSwitch Tail
Mbed | PowerSwitch Tail | AC Device | AC Wall Outlet |
---|---|---|---|
gnd | 2 -in | ||
P6 | 1 +in | ||
3 (AC) | |||
AC female plug | AC male plug | ||
AC male plug | AC wall socket |
Pushbutton
mbed | Push button |
---|---|
P5 | Pick one leg |
GND | Pick another leg |
Presentation Slides:
Overview of Project /media/uploads/tlisowski3/daily_dose.pptx
Please log in to post comments.