Compliment-activated gumball machine

Kakapo Labs employed a Raspberry Pi Pico W to make a gumball machine that uses ChatGPT to accept compliments instead of money. They’ve named it the Love Machine. Say something nice, and it dispenses a sweet treat right into your hand: definitely sounds like love to us.

Robust and reliable

It’s no fun if things don’t work! The newly added stepper motor, which triggers the original vending mechanism, needed to be powerful so the machine doesn’t jam up. The gumball machine itself (purchased for £75 on eBay) had been built to last, so no problems there with robustness. At the moment there’s no feedback to the Pico from the stepper motor or the vending mechanism; however, future upgrade ideas include a sensor on the shaft to detect when the motor jams, as well as a detector on the delivery chute to make sure that a capsule containing a treat has indeed been vended.

Yet soft and attractive

It was important for the Love Machine to look approachable, friendly, and appealing. Kakapo Labs sewed it a fluffy skirt, and also gave it a colour LED matrix heart covered with felt for that soft, diffuse light effect.

chat gpt gumball machine
Fluff for effect

This first installation worked just fine. The team was able to leave the machine in a café for over a week without needing to visit in person to fix anything. The ability to update and debug via USB proved handy, because there was no need to disassemble the machine to fix software or make changes.

A placard explained the Love Machine’s intentions to passers-by:

Hello gorgeous, I’m a vending machine that accepts compliments instead of money. Say something nice to me and I will give you a treat! Just scan my QR code to start a conversation.

How does it work?

Users submit messages to the gumball machine via WhatsApp. ChatGPT is in charge of evaluating whether a message contains a compliment: if it does, the machine vends a chocolate.

Raspberry Pi Pico W is in the driving seat, with the code written in MicroPython. When the gumball machine starts up, Pico W attempts to connect to a wireless network; if that doesn’t work, it switches to AP (access point) mode which lets the team connect to it from a mobile device and provide it with the network name and password. The fact Pico W can do this was really handy for this build — it meant there was no need for the machine itself to have any display or keyboard. The team used the useful phew library from our friends at Pimoroni for this.

Once it has connected to a network, the Love Machine connects to an SSL WebSocket which receives commands from a cloud application Kakapo Labs has written. The cloud app handles communication with both the WhatsApp API and the ChatGPT API. They’re using Amazon API Gateway for this, which avoids the need to have a constantly running cloud server and keeps the cost low. The Pico W then does what it’s told through the WebSocket.

“You look like a red Cookie Monster, but in a nice way”

The cloud app asks ChatGPT to assess whether each WhatsApp message is a compliment, telling ChatGPT to give a one-word answer of “yes” or “no”. If the answer is yes, the app sends a command to vend a chocolate. And in case any message is not only uncomplimentary but especially rude, the app can reply with one of a selection of disparaging put-downs. The team calls these “Zingers”. Happily, though, it turns out that almost everyone is polite to the Love Machine.

When the Love Machine receives a command to vend, it sends a train of pulses to an EasyDriver stepper motor driver board. This activates the stepper motor. This, in turn, controls a bespoke laser-cut piece which replaces the original gear assembly that used to accept 20p pieces. Lastly, the laser-cut gear engages the original vending mechanism to release a chocolate.

Pico W also controls the LED matrix beneath the felt heart on the front of the machine. This is an Adafruit LED Backpack, which Pico W controls over I2C. The team wrote code to let them draw LED patterns with text, using “R” for red, “G” for green, and “.” for off.

The passion behind the project

Kakapo Labs focuses on builds that encourage positive interaction and play. They’re also keen to work on systems that bridge online activity and offline experience, so being able to squeeze Raspberry Pi boards into compact builds out in the real world works perfectly for them. In this build, Kakapo Labs wanted to showcase AI in a playful application, having seen lots of worried media stories about it replacing human jobs. Using WhatsApp here was a good fit with the chat-style interaction the team wanted, and meant they didn’t have to build a bespoke mobile user interface. Work smart, not hard!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Server Status

Aradippou Chat Larnaca Nicosia

Chat Links

Official Links.

Chat.

Alternative Mirror Links.

1. KiwiIRC 1.
2. KiwiIRC 2.

Other Web Clients.

1. IrcCloud.

Recent Posts

Related Posts:

Archives

Follow me on Mastodon

Super Club Radio

Mighty Deals

CyIRC

CyIRC Tweets