The MagPi - July 2018

(Steven Felgate) #1

raspberrypi.org/magpi July 2018 39


VOMIT COMIC ROBOT Projects


>STEP-01
Creating comics
Cadin first created the random comic generation
software using the Processing language. You can find
his code on GitHub at magpi.cc/tOYOcL.

>STEP-02
Connecting the components
All the software runs on a Raspberry Pi 3. Its GPIO
pins are connected to a push-button, status LEDs,
and the thermal printer.

>STEP-03
The final build
Laser-cut plywood was used to construct the robot’s
body. Cadin admits he made it slightly too small, so
had to make some adjustments inside.

MAKING A VOMIT


COMIC ROBOT


When the robot’s button is
pressed, the Python script sends a
message to the Processing sketch.
“The sketch generates a random
comic layout, and chooses some
of my drawings to populate the
frames,” explains Cadin. “It
chooses at random from about 100
drawings. Each image has some
associated data that informs how it


should be composed within a comic
frame. The final composite image
is saved to the Pi’s SD card.”
The Python script then loads the
image and sends it to the printer.
“With each comic I also print the
date, the comic number, and the
name of the event.”


The robot that gags...
gags, geddit?
Cadin hopes to tweak the robot in
the future: “I would like to make
a version that lets you choose a
theme for your comic, like ‘food’
or ‘animals’ or ‘nature’. I imagine
a big dial on the robot that lets you
select the theme and then you get a
comic with images from that theme
when you press the button.”


According to Cadin, the project
could easily be replicated using
his comic-generating code
(magpi.cc/tOYOcL), and makers
can add their own drawings. “If
you wanted to print something
else (not random comics) it
would be even easier, because you
could leave out the Processing
sketch entirely.”

Cadin has received a lot of
positive feedback on his humorous
hack, but says he isn’t sure that
people really understand what
is happening inside the robot:
“It would be nice if they could
somehow see the comics being
generated to understand that
it’s happening dynamically,
and not just printing out a
pre-made comic.”
Some people have suggested
adding more narrative to the
comics, but Cadin isn’t sure: “I like
that they come out as nonsense...
He’s not a very smart robot!”
Vomit Comic Robot may
not be smart, but this is one
quipster guaranteed never to get
stage-fright.

I would like to make a version that


lets you choose a theme for your


comic, like ‘food’ or ‘animals’


Each printout
features details
including the event
name and date
Free download pdf