jason_mckee
ServiceNow Employee
ServiceNow Employee

Knowledge is always an awesome opportunity to see what other people are doing with the platform and get inspired for things you can do.   For me, Knowledge 15 and CreatorCon were no different.   Fruition brought FruBot, which would drive up and serve you a beer, initiated by service catalog request.   And Joshua Bray put together an awesome lab for the Creator Con Hack Zone that interfaced ServiceNow with an Arduino to perform alerts and actions.

Looking at those two projects, I started thinking about how I could take those concepts and take them further. Since I was in Vegas and the iPad driven drink menus were everywhere, the answer hit me: make a ServiceNow powered bartender robot to mix drinks!

After learning how to develop on the Arduino (prior to Josh's HackZone lab, I had never played with an Arduino before) and a bunch of cutting, drilling, grinding, welding, plumbing and painting, I had a Wi-Fi-enabled bartender robot with a very basic REST API that take a simple list of how many ounces to dispense from each of it's 8 bottles.

LiquorBot at Santa Clara.jpeg

The vast majority of what makes LiquorBot tick is all built in ServiceNow.   There is a database of over 10,000 drink recipes (loaded from a terrible, terrible comma and pipe separated flat file full of bad formatting and errors, but that's a story for another day), and 1700 potential ingredients.   There's a Script Include to parse and validate recipe text like "1 ½ oz fresh orange juice" into discrete "1.5"/"oz"/"orange juice" fields as well as convert different units of measure into ounces.   For example, it turns out that a "dash" and "splash" actually have precise volumetric definitions (0.03125oz and 0.125oz in case you were wondering).   And another Script Include for making calls to LiquorBot's API using RESTMessageV2.

On the bot side of things, the pumps are fairly consistent in terms of X number of seconds of run-time moves Y volume of liquid (1990ms per oz for those of you wondering).   When the API receives "bottle 1 gets 0.33 oz", that translates to "turn on the relay for bottle 1 for 657ms".   I wasn't sure how accurate the pumps would actually be until I got the bot all put together and started testing, but I was pleasantly surprised to find that it could indeed accurately dispense a single dash of Vermouth (I like my martinis very dry).   After all the ingredients have been dispensed, a pump flushes the output plumbing with air to clear the output tubing so no ones tequila sunrise gets mixed up with the last person's whiskey sour.

To setup LiquorBot to start pouring drinks, you put the feed tubes from the pumps into the bottles of alcohol and mixers and load them into LiquorBot.   You then configure select the ingredients in the ServiceNow interface and set the dispenser number for each ingredient.   In the background, changing the dispenser field on an ingredient fires a series of events causing every recipe with that ingredient to be checked to see if it has all of it's ingredients available on a dispense or not and updates it's "mixable" flag.   In addition to checking for exact ingredients, the "mixability validation" logic also takes into consideration substitutions, so if you tell LiquorBot that you have "vodka" on bottle #1, it will pull in recipes that call for Kettle One and Gray Goose vodka as well.

Screen Shot 2015-09-15 at 7.18.38 PM.JPG

Today interaction with LiquorBot is via UI Actions on the List and Form views.   There are actions to prime the pumps (pulling just enough liquid in to fill the feed tubes) and run a clean cycle to flush the system with water.   The most important UI Action is Vend.   You may browse/search recipes using a List view (want a non-alcoholic drink? Filter on the category field) or pull up the Form view to see the ingredients that go into the drink.   When you've made your selection, click the Vend action under Related Links (or right-click in the list view to select Vend) and your selected recipe will be converted to ounces, packaged up into a RESTMessage and sent to LiquorBot's API via a MID Server.   Within a few seconds LiquorBot will have pumped the perfect amounts into your glass and your drink is ready to enjoy.

LiquorBot recently had its first outing at our Santa Clara headquarters and is also being demo-ed at our Custom Application Development Workshops in Houston and Dallas this week.   What's next for LiquorBot?   Adding a Service Catalog interface, reporting on drinks that were served, inventory control, like any good project the list of fun things to do never ends.   Interested in seeing what makes LiquorBot tick?   There's lots of moving parts between the ServiceNow code and Arduino code, not to mention that actual building of the bot itself (for example, lesson learned: 1/8" wall steel tubing may be what's laying around the garage, but is massive overkill.   LiquorBot tips the scales at a touch over 30lbs without any bottles loaded).   Let me know what's interesting in the comments below and I'll make sure to cover it in a "making of" post.

download_20150903_185754.jpg

8 Comments