Preston Richey

Mapkins Machine

First, some terminology:

  • A Mapkin machine is a machine that dispenses Mapkins.
  • A Mapkin is a portmanteau of map + napkin invented by marketing people who thought ‘Screenprinted Map-Napkin Vending Machine’ didn’t quite roll off the tongue. Honestly, I can’t be one to argue.
  • The American Royal is a livestock show held in Kansas City since 1899 and has in recent decades become one of the leading barbecue competitions in the United States.

Lots of barbecue means lots of messy fingers. And lots of messy fingers means lots of napkins. That’s where the Mapkins Machine comes in.

In partnership with local organization KC Loves, partners at Barkley designed and built the machine, which would be stationed around the BBQ competition dispensing Mapkins, themselves both functional napkins but also (assuming you kept it clean) a collectible map to all the barbecue restaurants around the KC metro area. Because the Mapkins would be in a limited supply, we wanted to ensure that each customer would just receive one. Our solution? An Arduino-powered vending machine leveraging the Twilio SMS API using a CNC Shield to turn stepper motors. Obviously.

We started with with the shell of a 1960’s Pepsi vending machine. After stripping out all of the internals, we added in 4 shelves each with a stepper motor turning a custom corkscrew feeding into a hopper, as well as an Arduino Uno with CNC Shield connected to a Particle Electron 3G-enabled microcontroller. Fast forward through the weeks of 3 burnt servos and 2 ruined CNC shields (I never claimed electrical engineering is my specialty) and lots of guess and check, add a 12V power supply, and we had a working prototype.

The team made a case study video to show the machine in action (I’m posting this here because I imagine 95% of people do not care about the technical details that follow):

For the 3 of you out there still interested: here’s an image of the internals. I should probably make a Fritzing diagram, but here’s roughly how it worked:

  • A user texts a phone number, purchased from Twilio, which posts a payload via webhook to a server.
  • The server checks if the phone number is in its database. If so, respond politely to the texter that we can only give one Mapkin per person. If not, check if the machine is out of Mapkins. If the machine is out, add user to a waitlist and text back informing them that they’ll receive a message whenever the machine is restocked.
  • If the machine is stocked and the texter is unique, dispense a Mapkin. The server determines which stepper to turn (based on how many Mapkins are in machine), and posts that information via another webhook to a 3G-connected Particle Electron inside the Mapkin machine.
  • The Electron sends a message to the Arduino Uno via serial telling it which stepper to turn.
  • The Arduino Uno, via CNC Shield, turns the corresponding stepper, and passes a success message back up the stack, which responds to the user with a confirmation message.
  • ???
  • Profit!

Projects that require this amount of interconnected physical components generally fill me with a deep sense of dread, merely due to the fact that debugging any issues in the system are exponentially more difficult than any programming environment where you can just console.log(foo). Still, there’s something incredibly gratifying about hearing the clunk of a successful vend, knowing how many things came together to make it happen.