Ruby on Rails
Cocktail Masterclass with Ruby and Friends

Summarized using AI

Cocktail Masterclass with Ruby and Friends

Julian Cheal • November 19, 2019 • Nashville, TN

In this video, Julian Cheal presents a quirky and innovative project: creating a robotic cocktail maker named Ruby Mixologist, which utilizes Ruby programming, Raspberry Pi, and Kubernetes. He begins by sharing his background as a Ruby developer from Bath, England, and expresses his love for robotics and cocktails. He initially drew inspiration from YouTube robotic creator Simone Giertz and his experiences at a local bar with talented mixologists. Motivated to solve the problem of not having cocktails on demand at home, he decided to build a robotic bartender using his technical expertise.

Key points covered in the talk include:
- Project Inspiration: Julian's admiration for Simone Giertz's 'shitty robots' and his passion for cocktails led him to automate drink-making.
- Technical Foundations: The project integrates several technologies: Raspberry Pi for hardware, Ruby for programming, and Kubernetes for managing containers. He specifically highlights the use of K3s, a lightweight version of Kubernetes suitable for IoT devices.
- System Components: Julian describes the essential components for the cocktail robot, including:
- Peristaltic Pumps: Used to control the dispensing of liquids.
- Messaging System: He incorporates Apache Kafka to manage drink orders and updating the system efficiently.
- User Interface: A Rails app provides a user-friendly interface to track drink orders, which incorporates a state machine for managing the status of each cocktail.
- Challenges and Considerations: Julian reflects on the ethical implications of his robot potentially displacing bartending jobs but reassures that the robot won’t match the skill of human bartenders.
- Future Aspirations: After his presentation, he shares how he has attracted interest from a venture capitalist, indicating potential for future development and deployment of the cocktail robot.

In conclusion, Julian Cheal's talk at RubyConf 2019 showcases not only his technical capabilities but also a humorous and creative approach to robotics. His cocktail robot is a convergence of various technologies, embodying both functionality and entertainment. As he continues to refine the robot's capabilities, the project stands as an example of how programming and engineering can creatively intersect with leisure activities like cocktail making.

Cocktail Masterclass with Ruby and Friends
Julian Cheal • November 19, 2019 • Nashville, TN

Cocktail Masterclass with Ruby and Friends by Julian Cheal

Welcome to Nashville, Tennessee! Have you ever wanted to try making aTennessee Two Step Cocktail, an Old Fashioned, or a Citrus peach cooler for the non-drinkers? Well now you can!

Introducing Ruby Mixologist the world's first (probably) Ruby cocktail maker. Ruby Mixologist is a cocktail robot tending to all your drink needs.

In this talk we will discover how you too can build your very own Ruby powered drinks robot.

#confreaks #rubyconf2019

RubyConf 2019

00:00:12.080 Hi.
00:00:13.980 I'm Julian Cheal, and I'm a Ruby developer.
00:00:17.789 I'm from a small town in England called Bath.
00:00:22.020 Just to clarify, Bath is not London. I live in Bath where bathing was first invented.
00:00:30.359 You're more than welcome to visit! I'll take you around, and we can go to the thermal spa together. Please come to Bath and bring your tourist dollars!
00:00:43.889 I work at a small company called Red Hat, which was acquired by a bigger company called IBM. However, I still work at Red Hat.
00:00:54.269 I really love robots and robotics. One of my favorite creators is Simone Giertz; she makes what she humorously calls "shitty robots" and is quite good at it.
00:01:07.080 For instance, she created a robot that helps her make breakfast so she can continue reading her book. After all, who has time to make their own breakfast?
00:01:19.170 Just look at how well that worked! If you go check her out on YouTube, you'll see all the incredible robots she makes. This got me inspired. I thought, 'How can I make my life a bit easier?' What things could I automate or use robots for?
00:01:40.649 Then I remembered that I like drinking. Perhaps I was imbibing when that thought crossed my mind. I enjoy cocktails, but what I really love is a bar in Bath called The Hideout. Shoutout to The Hideout! They make the most amazing cocktails, and their staff is incredibly talented.
00:02:14.740 However, the problem is, as much as I've asked them, none of them would come to my home to make me cocktails on demand. I thought, how can I solve this problem?
00:02:38.140 Oh wait! I'm an engineer! I watched some YouTube videos where someone modified a Tesla Model 3 into a truck, named the Truckla. So, I thought, why not use the power of robotics to create a robotic cocktail maker?
00:03:10.920 At home, I have tons of Raspberry Pis. They are everywhere.
00:03:12.920 I use them to control our smart LED lights. Of course, when you turn off the lights at the mains, you can no longer control them with Alexa, so I swapped all the light switches for Raspberry Pis.
00:03:43.100 Now, when guests come over and say, 'The lights aren't working,' I can say, 'Let me just reboot SystemD. Don't worry, the lights will be back soon.' So, I have lots of Raspberry Pis, I work at Red Hat, and I'm familiar with OpenShift and containers.
00:03:52.670 I thought, maybe I could leverage that knowledge. Though, then I remembered that OpenShift doesn't run on Raspberry Pi. But Kubernetes does, so I thought, why not try that?
00:04:09.790 And I asked myself what programming language I should use to write my cocktail robot. Obviously, Ruby! Just look at how happy Matz would be.
00:04:15.100 So then, I thought if I create a cocktail robot in Ruby using a Raspberry Pi, I could come to RubyConf and talk about it, and you would all come to listen. That's a brilliant idea!
00:04:42.500 To recap, I have a Raspberry Pi, Ruby, and Kubernetes. But I felt like my project was missing something. I needed a messaging system, and that's when I thought of Kafka.
00:05:00.500 But I didn't have any experience with Kafka. Luckily, Stella Cotten is an expert, and I found an informative presentation she gave at a previous Ruby on Rails conference, which was super helpful.
00:05:12.490 I felt like, 'I've got a cocktail robot that uses Kafka. Now what do I do?' I watched her talk, and suddenly I knew everything I needed to know about Kafka!
00:05:38.030 I went back to The Hideout to tell the staff about my idea of creating a cocktail robot that will make drinks on demand. I explained that the robot won't get tired, doesn't need tips, and doesn't mind working overtime.
00:05:58.560 However, their reaction was mixed. They questioned whether I'd create something that puts them out of work. I assured them I didn't want the robot to replace people. I mentioned some of the technology I was using, but it seemed they were baffled by it.
00:06:35.300 I found myself wondering: have I inadvertently created something Kafkaesque by making a cocktail robot that might take jobs away from bartenders? I wasn’t sure, but I thought it wouldn't matter too much since my robot won't be as good as them anyway, and it hasn't won any awards.
00:06:50.690 Next, I went about installing Kubernetes on the Raspberry Pi. There's a version of Kubernetes known as K3s, designed for lightweight IoT devices.
00:07:06.100 This version is much more appropriate for small devices like the Raspberry Pi. I stumbled across a great blog post by Alex Alonso titled "Kubernetes on Your Raspberry Pi" and followed his tutorial.
00:07:20.270 So I grabbed my Raspberry Pi, which is essentially a small computer made in the UK. It's awesome for teaching kids programming, and I realized I had a few slides to correct regarding its description.
00:07:40.780 Now, what else did I need to create my cocktail robot? I needed a peristaltic pump. These pumps work by creating suction to move liquids, and you might recognize them from coffee machines.
00:08:13.320 I realized I would also need to control these pumps using relays, which are like electrical switches you can control with code.
00:08:39.020 The next step was to outline how my robot would make drinks. I built a user interface that communicates with a bar manager. Multiple components will work together in this cocktail robot's bar.
00:09:10.340 The bar manager receives drink orders and then finds a mixologist to make them. I ended up calling it a mixologist instead of a mixer bot because my twist was to define it as a mixologist.
00:09:39.130 Once assigned, if the mixologist is free and can take on the drink order, it adds it to its queue and eventually tells the UI that the drink is ready.
00:09:56.090 This method of programming is pretty straightforward, utilizing message queues and updates, teaching me something in the process that I can apply in a job interview.
00:10:09.520 So, here we are: I've got my hardware, I've got Kubernetes, and I've got Ruby. To streamline the process, I incorporated Rails for a better front-end interface.
00:10:25.700 I set up a Kubernetes cluster with two Raspberry Pis; one operates as the robot, and the other houses the Kubernetes controller.
00:10:47.700 The setup is efficient, and I can even run PostgreSQL and a few other cool services seamlessly on it.
00:11:06.840 Next, I wanted to connect the Rails app to Kafka. To do this effectively, I found two Ruby gems: Racecar and Delivery Boy.
00:11:34.680 The former helps consume Kafka messages while the latter publishes messages to Kafka. Although I questioned why two gems were necessary instead of one, they are both handy.
00:12:02.220 I realized I could implement a state machine to manage whether drinks are in progress or queued.
00:12:36.890 So, that’s the gist of it. Now let's review what we've accomplished.
00:12:59.750 After spending time learning about Kubernetes, I initially thought it might be too ambitious to also run a demo during the conference.
00:13:30.240 Here we have the user interface we created. It displays statistics, and right now it shows that I've sold 134 cocktails and made $1,500 in revenue.
00:14:11.220 My vision is for people to stroll around bars with iPads and simply press a button for a drink, which will be handed to them magically from the robot.
00:14:37.550 In this setup, there's an admin user interface allowing managers to add new drinks to the menu.
00:14:58.490 I've installed Kubernetes and built a Rails app with a shiny user interface. However, you're all probably wondering how the cocktails are actually made.
00:15:21.450 To control the pumps on the Raspberry Pi, I used a library called Raspberry Pi GPIO. It allows me to control the pumps easily, using surprisingly little code.
00:15:42.070 My system utilizes pins on the relay to manage power for the pumps. I can turn them on for a specific duration, allowing for exact measurements.
00:16:10.600 When I add a drink to the queue, the delivery boy sends it off to the bar queue. On screen, you can see how I manage the active state of the drink orders.
00:16:35.460 The state machine helps dictate whether drinks are queued, in progress, or completed.
00:17:00.570 Using a simple case statement, we can check the status of each order as it's being processed.
00:17:23.590 Now, how will we convey drink orders to our multi-drink robot? We use YAML to define the drinks and their ingredients.
00:17:59.180 We list drinks like gin and tonic, Tennessee two-step, and old-fashioned, including all the needed ingredients.
00:18:20.690 For each ingredient, we calculate how long the pumps need to dispense the correct amount.
00:18:37.000 Right now, some tasks remain manual, like adding sugar or placing ice into drinks, but ideally the system could automate those processes too.
00:19:00.250 The setup works and functions, but needless to say, considerable thought and preparation are needed.
00:19:27.180 This project is actually beneficial when looking for practical applications.
00:19:37.420 While in Nashville recently, I happened to meet a VC, and after sharing my cocktail robot concept, he expressed interest in discussing it further.
00:19:56.610 You never know where this might lead. If everything goes well, I might visit San Francisco and pitch my robot to Y Combinator.
00:20:31.240 So, here is my cocktail robot! I'm still working on some of the functionalities and hope to have it operating outside by tomorrow.
00:20:49.790 If you have questions or ideas, let me know! Thank you!
Explore all talks recorded at RubyConf 2019
+88