This beer scale utilises a wifi shield and Arduino board measuring the time that one takes to finish a cup of beer. This is a simple demonstration of "Internet of Things" technology that a beer glass is capable of communicating with smartphones or other devices equipped with wifi module.

To realise this scale, the following skill is needed:

1. Arduino coding
2. 3D printing or other basic fabrication skills
3. Electrical soldering

Step 1: ​Step 1: Preparing the Following Components:

1. Arduino UNO x1
2. Sparkfun Wifi Shield ESP8266 x1
3. BreadBoard x1
4. Strain gauge load cell x2
5. IC LM741 x1
6. Resistance 1 kohm x1
7. Resistance 1 Mohm x1
8. Leads ~10

Step 2: ​Step 2: Build the Circuit

Built the circuit as illustrated. You might need to solder some contact points. Note that the two strain gauges have to be placed in an opposite order. This can be determined by the colour of the leads as shown in the figure.

Step 3: ​Step 3: Make the Scale Base

You may print out the base from the attached .stl file with a 3D printer or make it by your own way according to the charts. The dimension is not optimised for the demonstrated glass. In fact, it was meant to be integrated with a cylinder glass.

Once the components are ready, place in the strain gauges. You may use some glue to fix them.

Step 4: Step 4: Upload the Arduino Code

You can download the Arduino code and upload it to you Arduino board. Note that you also need to install the Sparkfun ESP8266 Library to make the code work.

Sparkfun ESP8266 Library

Once you download it as a ZIP file, do the following:

1. Open Arduino IDE
2. In the menubar, find Sketch > Include Library > Add .ZIP Library
3. Choose the ZIP file you just download and it will install by itself

The other thing before you upload the code is setting up the SSID and password of the available WiFi. You may find them at the 6th and 7th lines in the code.

Step 5: Step 5: Calibrate the Scale

With different weight of the sum of the empty glass and scale base, the scale needs to be calibrate to give you the accurate indication of the beer. It is also crucial for the scale to determine the status of the beer, whether it is full, half way or empty.

Here's what you have to do:

1. Get the whole scale set ready in an empty status. Open up the Arduino IDE serial monitor and check the Reading number. This number is the low bar of the scale. Add a number of 2 to 4 as the low margin then replace the value of "beerLow" at line 11 with it (it's 278 in the provided code).

2. Pour a full glass of beer. You should have a larger number of the Reading; if not, swap the 2 pins from strain gauge to pin 2 & 3. Check the new Reading and minus 2 to 4 as the high margin, replace the value of "beerHigh" at line 10 (it's 330 in the provided code).

3. Check the beerVolume at line 12 which should depict the volume in ml of a full glass. It's provided in 330 ml.

Step 6: Step 6: Now See How Long It Takes You Finish a Glass of Beer

Once everything is ready, pour a glass of beer for yourself to celebrate your hard work. Open the serial monitor from Arduino IDE to check the IP address of WiFi shield, then use your internet browser to check the amount of the beer as well as the time passed. The time only updates when you finished the beer. There is a 10-second threshold for the scale to judge if you have really finished the glass or just pick it up for a sip.

<p>Hi Tim!</p><p>Great work on your project for TfCD. Seen the fact I happen to know it's a University course; I want to help you learn a little. I've got some tips for you to improve your coding.</p><p>1. Be consistent. Follow a set of rules for writing variables, comments and functions. It will make it easier for you to find small errors, because you'll be able to identify typos by their deviation from your own rules! For example: all variables by the format of: &quot;firstSecond&quot; or &quot;first_second&quot; or &quot;firstSECCOND or really anyway you'd like as long as you don't mix.</p><p>2. Use comments, but don't drown your code in comments. Keep your commenting short and to the point. When using code from a source check the existing comments and determine if they should be in your code. Your example has borrowed a lot of the example library of the SparkFun ESP module, which was written with explanatory purposes and therefore a lot of descriptive comments. Is the explanation of a library really necessary in your final product??</p><p>3. Keep your code short but functional. Try to eliminate as much duplicate functionality as possible.The Arduino has limited available memory, as soon as your programs will start to become more complex and bigger you might run into memory problems. That's why you should always consider if your functions could be simpler, shorter and less similar with other functions. For example: beerStatus() and beerEmpty() seem very similar, maybe there's a way to combine both into one slightly more complex but shorter function? This is were some of the real challenges start to show up!</p><p>4. Arduino specific: Serial print is great for supplying feedback to the user. Also it's a great tool for debugging (not sure if a certain variable has the value you would expect? Print it!). As soon as you are certain your code works properly, get rid of all the unnecessary prints. Serial.print actually is a slow function which uses more time than you might expect. If you'll start to work with systems which require high responsiveness, the first thing you want to do is eliminate as many serial.print as possible!</p><p>Additionally, make sure you understand the used functions as much as possible. You sometimes use the F() function in your serialPrint(). Which can be a nice tool in some specific cases. However, seen the usage in this example I start to wonder what you would think the F() function actually does.</p><p>Finally, some IDE specific commentary, just like designing products, keep your target users in mind. If you decide to publish something make sure your code and comments are tailored to their needs! Why do i have to scroll and search for the variables I need to adapt following your instructions? Why not clearly visible almost at the top?</p><p>Anyway, plenty of feedback. But I can see you put effort in your project and I got the idea you're interested in learning more. Which makes me hope my time replying was worthwhile!</p>
<p>Hi Rens,</p><p>Thank you for your thoroughly feedback of teaching. I've made some improvements according to your suggestions and comments. And like you said, making code shorter is quite a challenge which is the only one I can't do it right now. It is really helpful of your advices even though I am not going to be a professional programmer. Cheers.</p>
<p>Nice. There are so many drinking games that you could make with this. </p>

About This Instructable




More by TimLin9527:[TfCD] Beer Scale 
Add instructable to: