Intro: Oktoberfest of Things Beer Table
The Oktoberfest of Things is a a community of makers that gather each year around the Oktoberfest in Munich (or elsewhere soon?) and hack the Oktoberfest. Inspired by the Internet of Things, we discovered the Oktoberfest as the perfect setting for trying out all kind of crazy ideas.
The hybris labs team, a small research lab part of hybris/SAP decided to support the Oktoberfest of Things with our own Oktoberfest of Things Beer Table in 2014. After creating and showing the table in 2014, we've moved it into our permanent showroom in Munich and now get requests from other teams to recreate our table. So we thought it would be cool to create this tutorial and help you to create your own table.
What does it do?
The beer table uses sensors to track the lifts of the beer mugs. These events are finally received in a web ui that tracks the lifts and also updates the fill level of each beer mug based on the number of lifts. This is extremely handy as the waiter will be informed about the level of beer in your mug and bring you a new one just in time. In addition, we implemented a double-beer-coaster-tap event, so double-tapping the coaster will highlight the mug in the web ui. This could be used to call the waiter for food for example. Yes, it's pretty useless but a fun gadget.
What will I need to make one?
When it comes to skills, you'll need a tiny bit of microntroller/web experience and must not be a complete idiot for being able to paint a beer table and drill some holes. Also, some basic soldering skills are required to solder some cables onto pressure sensors.
Here are the parts:
- Spark Photon, Min-Breadboard and some jumper cables and 10k resistors. If you get the start kit, it's all in there.
- 8x pressure sensors. The ones we've used these, but similar ones should be ok. Maybe round sensors would even fit better.
- A beer table and benches. Also paint and potentially some laser-cut templates to add your own logo.
- Beer Coasters to place above the pressure sensors. Of course kind of optional, but we recommend the #OktoberfestOfThings beer coaster design we've uploaded to the resources.
So let's begin with the beer table...
Step 1: Prepare the Beer Table and Benches
Of course you can choose another table, but this is about the Oktoberfest. So get a real one :-) They are typically colored yellow/orangish, so you might have to paint them twice. Once we had painted ours, we used some laser cut templates/stencils to spray our team logo onto it. There'll be a ton of tutorials around laser cutting on instructables, so we'll not go into details here.
One important thing that you should not forget at this point is to drill some holes. Typically you can fit around 4 people on each side of an Oktoberfest beer table - so drill 4 holes on each side. We spaced the holes a bit off the center, so you can better position the beer mug with one of your hand.
Feel free to add labels to the drill holes, e.g. numbering the spots from 0 to 7 to later identify the analog inputs of the Particle Photon. It will also help you identify the spots in the web UI.
Now that we have a modified beer table, let's add the electronics.
Step 2: Attach the Pressure Sensors and Particle Photon
Next up are the pressure sensors. First, solder two long cables to each of the pressure sensors. One will be connected to VIN, the other to a 10K resistor (which goes to GND) and the analog inputs of the Spark Photon.
Take a look at the schema part of this step for the details and repeat the wiring for each pressure sensor.
Step 3: Program the Particle Photon
We're now ready to program the Spark Photon. This requires the initial setup of the Photon first, which basically means connecting the Spark Photon to a Wifi network and binding it to your account. Start with registering on particle.io and then following the Getting Started page. This should take less than 5 minutes.
Now, open the Particle Web IDE and create a new app under the "code" tab on the left. Name the app OOT for example and then paste the code in the resources.
I'll try to explain the most important parts of this code and how they relate to the Web UI and the receiving of these events.
The setup function is run once just as in an Arduino sketch and simply initializes an array with 8 boolean values. These booleans are the states of our mugs over time. We store the values over time to be able to detect double taps - otherwise this could be made simpler.
The loop function is repeated forever and will check each mug's pressure value and store it. With each iteration, we call the checkDoubleTap function that checks if it finds a pattern for a double tap. If there is one, it sends out the 'tap' event.
Also with each iteration, we compare the mug's state against the previous state. If the state changed, we call the event function that checks the current mug's state and sends the up/down events.
The events themselves are sent using the Spark.publish() function and is pretty transparent for us, no network checking, etc.
At this point you may want to login to dashboard.particle.io to check if you receive some events when the pressure sensor states change.
Next, we will connect a Web UI to these events to visualize the events.
Step 4: Host the Web UI
Finally, we needed to host a simple static web page on the hybris cloud APIs, yaas. You can yourself sign up for an account here or alternatively use a local server for testing.
To get the access token, navigate to the Particle Cloud IDE and access the settings tab on the left. You'll see your access_token - be careful. The web page will store the access_token locally on your browser.
Congratulations! You now have an IoT Beer Table.