Sticker wizard is a sticker vending machine with a twist: you don't get to choose which sticker you get. Instead, you'll scan the QR code, take the "which robot are you?" personality quiz, and then receive the sticker you deserve (along with a free personality analysis).
This tutorial will walk you through making your own vending machine from scratch, along with a web application that allows you to operate your machine from any device.
Follow the Viam documentation to complete the following steps to set up your Raspberry Pi.
sudo raspi-config
. You will need to enable I2C for the motor driver. sudo reboot
.viam-server
on the Raspberry Pi device that you want to use to communicate with and control your webcam, select the Linux / Aarch64
platform for the Raspberry Pi, and leave your installation method as viam-agent
. viam-agent
to download and install viam-server
on your Raspberry Pi. Follow the instructions to run the command provided in the setup instructions from the SSH prompt of your Raspberry Pi. board
, and find the pca:pca9685
module. Give this component a name motor-board
. This adds the module for working with a PCA9685 board that displays in the left sidebar. Notice adding this component also adds a corresponding panel on the right.i2c_bus
to 1
.i2c_address
as 64
(0x40
), the default base address for PCA9685.From here, you should be able to use Viam to control your motors! To test:
If you cannot find the board, run i2cdetect -y 1
on your Raspberry Pi to check if your board is connected correctly.
The basic structure of the vending machine is a box with 3 "drawers" of 3 motors each. We prototyped using cardboard, and then made the final structure with acrylic cut to size and screws. We made each layer of motors a drawer for convenient refilling and maintenance. To fit the motors in the drawers, we created dividers between each motor and coil, and 3D printed a motor mount that sits on the drawer.
But your structure can be anything! You could build this out of cardboard and tape! As long as it can contain the motors and dispenses the stickers...you're golden!
This part is entirely up to your imagination, you can build any interface you want, using any technology you want! The only requirement is to use Viam's Typescript SDK to interface between your web application and your machine.
We built our web application with SvelteKit and Threlte. We used Aseprite-created pixel art assets with the Threlte component to create the animations. Our web app has the following basic components:
To authenticate your website with your machine, use Viam API keys. We recommend setting up an operator API key so users don't have write access to your machine (and use a .env
file to avoid committing your API keys to your Github repo!)
Here's our source code.
Through Viam, we can host our web server directly on the Raspberry Pi using a process. A process runs every time your machine starts up.
git
on your Raspberry Pi to pull changes from your websitevite preview
--host
flagrun-web-server.sh
.run-web-server.sh
. You can determine the absolute path with the pwd
command.To make your local web server available to those not on your local network, use a service like ngrok. You can set up ngrok with Viam with a process in the same way so it is always available when your machine is running.
That's it! We added a few finishing touches to enhance the experience, but these are completely optional.
The LEDs really enliven this project, and let people know that sticker wizard is alive and ready to gift you a sticker! These instructions are for WS2811 LEDs, the LEDs we used here, but any individually-addressible LEDs should do the trick.
Use any QR code generator to create a QR code that encodes your web app's URL, and display it somewhere on your machine! We used qr-code-generator.com, but any generator should work.
Personify your machine! This dude was hand-sculpted with polymer clay.
Explore the Viam platform and browse components and services to build your next project.