Instead of a selfie booth, bring SelfieBot to your next party! This Raspberry Pi project has a mind of its own: SelfieBot giggles, snoozes, and prints selfies on its thermal printer. Animated facial expressions and sounds are triggered by movement-based interactions. SelfieBot is contained in a customizable laser-cut acrylic and 3D-printed case.

My husband and I built our original SelfieBot for our booth at Seattle Mini Maker Faire 2017. This battery-powered version is a simpler build. Instead of laminated laser-cut plywood as in the original, here the walls of the case are 3D printed. Alternate methods of constructing the case are explored at the end of this guide. Use the animations and sounds provided, or create your own!

camera__MG_3628.jpg

camera__MG_3615.jpg

camera__MG_3616.jpg

This is a big build, and definitely a multi-day project with a lot of parts and several fabrication techniques. It's a fun mix of electronics and fabrication, and there are lots of opportunities to customize this project along the way! Although the case is laser cut and 3D printed, you may still need to drill/cut into parts of it along the way, so be prepared to use a drill, small hand saw, and file. If you're not comfortable with these tools, have a friend or parent show you how to use them safely.

Parts & Supplies

This project uses lasercutting and 3D printing to build the case. You can check with your local makerspace for access to these tools, or send the files out to a service.

Main Components:

Connectors, Wire, Etc.:

  • USB connector shell
  • Right angle HDMI adapter
  • 12" HDMI cable - find one with small plugs, like this one
  • 2 micro USB cables (at least one with a left-angle micro USB connector)
  • 4-pin JST Cable Connector Set 
  • Power switch rated for 2 amps like this one
  • 22 or 24 AWG stranded wire in assorted colors
  • 16 AWG silicone stranded wire in black and red
  • heat shrink tubing, various sizes and colors
  • Wireless Mouse & Keyboard - If you can, buy a cheap set just for this project and leave the USB dongles plugged into your Pi permanently. Or, modify the case and placement of the Pi so that the dongles can be easily removed when SelfieBot is not in use.

For Case & Assembly:

  • 3x Acrylic Sheets 3mm thick, at least 9.5" x 12.5" (Protect the panels from scratches and stray paint by leaving the protective film on the acrylic until the assembly phase.)
  • 3D Printer Filament
  • 4x 1/2" Nylon spacers for Pi
  • 4x 3/4" Nylon spacers for screen
  • 6x Grip Rivet Nuts #6-32 drill size 12
  • 6x Machine screws: #6-32, 2 1/2" long & matching washers for case
  • 6x Machine screws: #4-40 3/4" long & matching nuts for handles
  • your choice of filler & spray paint (optional)
  • Model Magic clay or Blue Tac (optional, for masking holes)
  • 3 mm craft foam
  • Gaff tape
  • Industrial strength sticky back velcro 1" wide
  • Glue gun & glue sticks

The circuit will be built across the two internal sections of SelfieBot. At the heart of the circuit is the Pi Cobbler, which routes all the pins of the Raspberry Pi neatly to a perma proto board. Here is a rundown of the Cobbler's connections:

Thermal Printer

RX to GPIO 14, and related ground to GND rail

Arcade Button

Data pin to GPIO 17, power to 5v rail, ground to GND rail

Accelerometer

SCL to GPIO 3, SDA to GPIO 2, VIN to 3V rail

Amplifier

A- & A+ to audio out on Pi (see Assembly for location on back of Pi) Power to 5v rail, GND to ground rail.

Power Circuit

Power and ground from the battery are split: one set of power and ground goes directly to the thermal printer, the other set goes to the input side of the UBEC step-down converter.

Power and ground from the output side of the UBEC goes to power the Raspberry Pi via the micro USB port.

You'll also connect power and ground from the Raspberry Pi GPIO to the perma proto board.

Other Connections

The display plugs into the HDMI port on the Raspberry Pi, and is powered by USB from the Pi. 

The speaker wires connect to the screw terminals on the amplifier.

Start by building the case:

The case is made up of three laser cut acrylic panels separated by two 3D printed wall sections. It is held together with screws and rivet nuts (we'll be using them like Chicago Screws). The handles assemble around the exposed edges of the middle acrylic panel, we'll put those on at the very end of the build.

Cut the Panels

Download the panel files:

Use the provided files to cut one front, one middle, and one back panel out of 1/8" acrylic. Leave the protective film on your acrylic while cutting for clean panels with no fogging.

For the front panel, two separate files are provided: one for cutting and one for scoring lines. Experiment with the laser cutter's settings on scrap material to get the engraving depth you prefer. 

camera__MG_3720.jpg
Optional: Engrave the diagram labels directly onto the middle panel.

 Optional: A file for labels is included for the middle layer. Engrave this layer on the middle panel, and your holes will be nicely labeled and easy to navigate while building. Or, refer to the diagrams below for placement of components.

The back panel is reversed so that the sharp edge of the cut is toward the inside of the project.

 

Use the provided files to 3D print the wall sections and handles. Note: depending on the material you are printing with, allow for shrinkage after cooling by scaling the model up before printing. For ABS, somewhere between 1.5% and 2.5% should work. I highly recommend doing some tests, measuring, and math to calculate your actual shrinkage factor before printing the whole run of parts. Otherwise, be prepared to do some extra drilling out of holes at the end of this project, and for the 3D printed parts to not quite line up with the laser cut parts.

Print the Walls

Full models are provided, so you can scale them based on your shrinkage calculation. You will then need to slice the walls into two or more pieces to fit on your printer bed. After printing, use glue (epoxy works well on ABS) to assemble each wall section. For a smooth finish, I filled the joins with Bondo Spot Filler, and sanded smooth when dry.

NOTE: The 3D files do not have a hole for the power switch. I used a scavenged switch in my project, the switch you source may have different dimensions. You can either cut a hole for the switch later (method described in the "Make the Power Circuit" section of this guide), or add a hole into the 3D model before you print it.

camera_IMG_7673.jpg

camera__MG_2347.jpg

The thinner wall section is the front section (blue in the photo below), and the thicker wall section (white below) is the back section.

Make the Handles

The handles are split into two pieces each, to wrap around the exposed sections of acrylic on each side of SelfieBot (do not glue the handle pieces together!). We'll install the handles at the very end of the build.

camera_SelfieBotBuild2_70.jpg

camera_SelfieBotBuild2_71.jpg

The handles are held together with screws and captured nuts in the back of each handle. Here's how to insert the nuts into the hexagonal holes:

camera__MG_3485.jpg

camera__MG_3491.jpg

Turn on your soldering iron. Find the two back handle pieces (the pieces with the bigger, hexagonal holes). Lay the nut on top of the hexagonal hole, it won't quite fit into the hole. Place the tip of your soldering iron on the nut to heat it a bit, and press the nut gently into its hole. Take your time and be careful not to touch the nut while hot.

Painting the Acrylic

I chose to leave the back and middle acrylic panels clear, and back-paint the front panel for a clean finish. Leave the protective film on the front of the panel, and paint the back side. Spray paint needs to be applied to acrylic in many very light coats. Be patient and take your time. I masked and painted the back side of the acrylic in three different colors. Choose your favorite colors and get creative here!

camera__MG_2389.jpg

camera__MG_2370.jpg

camera__MG_2374.jpg

camera_7521008880__MG_2339.jpg

camera__MG_2425.jpg

camera__MG_2451.jpg

camera__MG_2458.jpg

camera__MG_2469.jpg

Some painting tips:

Masking is a lot of work, but makes for a stunning and crisp paint job. Masking the edges of 3 mm acrylic is tedious, but worth it!

To mask the edges of smaller holes, I filled them with bits of Model Magic, a non-toxic air dry clay. I just pushed little spheres of clay into the holes from the front (non-paint) side, and kept them flat on the paint side. Tape in place with blue painters tape.

Another option for dealing with edges is to leave some areas unpainted. For the speaker holes, I turned this approach into a design element by masking the whole area with a hexagon shape.

To paint the three different colors, I masked the panel in two sections, and removed one between colors. I started with the darkest color (black), and finished with the lightest (white) to minimize color bleed.

camera__MG_2457.jpg

camera__MG_2483.jpg

Sand, finish, and paint the 3D printed parts as desired. I sanded, filled, and primed the outside of the wall sections before painting with spray paint. I left the handles unpainted.

Download and unzip the disk image below, then follow this guide to burn it on your micro SD card. Then insert the micro SD card into the Raspberry Pi, and you should be ready to go!

Thanks to Kim Pimmel for writing this code. Note: this code was written for our booth at Seattle Mini Maker Faire 2017. This was our first attempt at Python and Raspberry Pi, and we'll refine this project as we continue learning! 

The core library being used is PyGame, for running SelfieBot's expressive animations and driving the selfie functionality. The CUPS library is used for printing to the thermal printer. The accelerometer library is adxl345.py written by Jonathan Williamson.

The animated facial expressions and sounds are what make this project special. Here's how they were made, in case you want to customize your SelfieBot's personality!

Faces

The faces are a series of images that play in a loop when triggered. Keeping the basic face simple made it easy to create expressions by changing the shape of the mouth and focus of the eyes. Each frame was drawn in Adobe Illustrator and saved as a .png.

Sounds

The sounds are my voice, and were recorded as individual .wav files in Adobe Soundwave and processed in Reason for a robo-cyborg effect.

Install the Thermal Printer

Slide the thermal printer into its hole in the front panel. Protect the paint on the back of the panel by applying gaff tape along the short edges of the hole. Attach the printer with the included plastic braces over the gaff tape. 

The plastic braces will need to be filed down slightly to fit into the case properly. Using sand paper or a file, remove about 1 millimeter of material from the top of each brace. Secure in place with the included screws, don't over tighten.

camera__MG_2672.jpg

camera__MG_2670.jpg

Install the Button

Unscrew the outer ring on the arcade button. The LED arcade button needs two wires for ground, one for power, and one for data. The wires will need to be about 9" long. Solder the wires as shown.

Feed the wires through the hole in the front panel and insert the button into its hole. Replace the outer ring and screw tight (but not too tight) to attach.

camera__MG_2578.jpg

camera__MG_2588.jpg

camera__MG_2598.jpg

Install the Pi Camera

Place the front panel front-side-down on your work surface, lay down a towel first to protect it from scratches.

Prepare the camera: Cut a small square of thin plastic (I used a piece of the plastic packaging that the usb mouse came in) and tape it over the back of the camera hole in the front panel. Cut a small square out of craft foam about the same size as the Pi Camera pcb, and make a spacer for the front of the camera as shown. Glue in place. 

camera__MG_2730.jpg

camera__MG_2733.jpg

camera__MG_2737.jpg

Place the Pi Camera against the back of the front panel so that the camera looks through the hole at the top of the panel, and the ribbon cable is towards the top of SelfieBot. Tape in place with gaffer tape - be careful, peeling tape off could ruin your paint job!

The front panel is done! Lay the front wall section in place on top of the front panel, and set the whole bundle aside. Do a quick victory dance, and then move on to the middle panel.

Mount the Raspberry Pi

The Raspberry Pi will be mounted face up to the back side of the middle panel (locate the holes for mounting the Pi using the diagram.) The HDMI port should be towards the top of the panel. Attach the Raspberry Pi using 1/2" nylon spacers, 3/4" long #4/40 screws and matching nuts. 

camera__MG_2651.jpg
The spacers in this photo turned out to be too short - use 1/2" spacers.

Mount the Screen

Next, we'll mount the 5" HDMI Backpack to the front of the middle panel, with its back facing the Pi. First, pass the micro usb cable through the hole next to the screen, and plug the right angle HDMI adapter into the HDMI port on the backpack. 

Use 3/4" nylon spacers, 1/4" #4 screws, and matching nuts to mount the screen in its holes. You will need to cut or sand about 1 mm off of each nylon spacer so that the screen fits nicely behind the front panel. Check the fit before moving on. The HDMI adapter should be pointing back through the hole in the panel to the right of the screen.

camera__MG_2688.jpg
You will probably need to pass your micro usb cable (for powering the screen) through this square hole before plugging the HDMI adapter into the port.

Mount the Speaker

Attach wires for power and ground, (if your speaker came with wires, replace them with longer wires or extend them to about 10"). It's fine to simply glue the speaker to the panel, but I chose to create a housing for the speaker for a clean look behind the front panel's speaker holes. To do this, I cut a circle the same size as the speaker into two squares of craft foam, and made a channel for the wires out to the side. I layered the squares together with glue, and glued the speaker into the circle from the back. 

camera__MG_2692.jpg

camera__MG_2697.jpg

camera__MG_2701.jpg

camera__MG_2708.jpg

Position the speaker on the middle panel so that it will sit behind the speaker holes in the front panel, and leave space at the edge of the panel, to allow for the thickness of SelfieBot's side wall. The speaker wires should point toward the hole for the thermal printer. Once you've found the right spot, mount the speaker to the middle panel. Hot glue works fine for this.

Add the Middle Panel to the Stack

Flip the middle panel over so the screen faces the front panel and lay it on top of the front wall section. Feed the camera cable, button wires, and speaker wires through their holes in the middle panel (refer to panel diagram) and lay the middle panel face-down onto the front wall section, aligning the screw holes. The back of the thermal printer, and its wires, should slide into the large rectangular hole in the middle panel.

camera__MG_2853.jpg

camera__MG_2846.jpg

Plug the camera's ribbon cable into the camera port on the Pi. The silver connectors should face the HDMI port.

Next, we'll set up the Pi Cobbler!

Insert the Cobbler into the center of the perma-proto board and solder all pins in place. Connect 5v to one power rail of the board, and 3v to the other, as shown. (To remind myself of the different voltage rails, I marked the 3v wire with a piece of white heat shrink.) Connect ground to both ground rails. 

camera__MG_2749.jpg

camera__MG_2753.jpg

Connect the Thermal Printer

Cut the cables for the thermal printer in half, we will only use one half for each bundle - for the red and black bundle make sure you are working with the end that fits into the printer. We won't be using the green TX wire, so trim it to about an inch and attach it to the other wires with heat shrink to keep it out of the way.

camera__MG_2779.jpg

camera__MG_2787.jpg

camera__MG_2794.jpg

Connect the cut ends of the wires to the Cobbler on the perma-proto board: Yellow to TXD, black to GND. Set the power and ground wires aside for now.

Connect the Accelerometer

Prepare the accelerometer by soldering wires about 6" long to VIN, GND, SDA, and SCL. Connect the wires to the perma-proto Board according to the circuit diagram: VIN goes to the 3v rail, GND to the GND rail, SDA to GPIO 2 (SDA), and SCL to GPIO 3 (SLC).

Connect the Amplifier

Prepare the amplifier: Insert the included screw terminals into power and ground and solder on the back of the board to attach. Solder 6" long wires to VIN and GND. Connect the wires to the perma-proto Board: VIN to the 5v rail, and GND to the GND rail.

camera__MG_2805.jpg

camera__MG_2843.jpg

Add Connectors to the Button Wires

Locate the button wires coming from the front panel. In case we need to take SelfieBot apart in the future, we'll add connectors to these wires so that they can come apart. There are four wires coming from the button, so a 4-pin connector like this is perfect. (I had a bunch of two-pin connectors on hand, so I used them.) Solder the connectors to the button wires, and to the perma-proto board: both black wires to GND, red to 5v, and white to GPIO 17 on the Cobbler.

My connectors came pre-wired with black and red wire, so I soldered them to the wires as shown, and covered the solder points with heat-shrink. Since my white data wire connected to a red wire on the connector, I marked it near the connector with a piece of white heat shrink.

camera__MG_2816.jpg

camera__MG_2815.jpg

camera__MG_2820.jpg

camera__MG_2864.jpg

The perma-proto board is complete! That's most of the wiring done, and if you want to change or add anything in the future, there's still plenty of room on the board for modifications. Now's a great time to take a break, and then move on to the power circuit!

Let's build the power circuit! Here's the circuit diagram again, it's not to scale, and is just a reference for the connections we'll be making.

Install the Switch

First, we'll need to make a hole in the back wall for the switch. A good place to put it is behind the upper handle on the left side of SelfieBot. Measure your switch and mark the size and placement of the hole you need.

Carefully drill a hole inside your mark, and use a small hand saw or jeweler's saw to cut material away to make the perfect rectangular hole for your switch. Test fit the switch often, and use a flat file to smooth the edges.

camera_SelfieBotBuild2_5.jpg

camera_SelfieBotBuild2_4.jpg

Next, we'll install the power switch. Cut two pieces of red 16 AWG wire about 3.5" each. Strip the ends and solder one wire to each pin on the switch. Slide some heat shrink over each solder joint and heat to tighten. Feed the wires through the hole in the side wall of SelfieBot and push the switch into place. Secure the switch with a generous bead of hot glue around the inside edge.

camera_SelfieBotBuild2_6.jpg

camera_SelfieBotBuild2_12.jpg

Add the Battery Connector

Next, we'll add a connector for plugging our battery into the circuit. My battery came with a Tamiya connector, so that's what I'm installing here - if you are using a different kind of connector, refer to the manufacturer's instructions for how to install it properly. 

There are three parts to the connector: two metal crimp-on contacts, and a plastic housing. Install one metal contact on a 4" piece of black 16 AWG wire, and the other on one of the red wires coming from the switch.

To install the contacts, strip about 3/8" of the insulation away from the end of the wire. Lay the wire in the channel of the contact so that the insulation starts just before the lowest crimp on the contact.

Using pliers, close the two crimp sections on the contact; the lowest should close onto insulation, and the next one up should close onto bare wire, as shown. (For a more solid connection, solder the wire to the contact after crimping.)

camera_SelfieBotBuild2_16.jpg

camera_SelfieBotBuild2_17.jpg

Once your contacts are installed, look at the connector on the battery, and note which sides ground and power are connected to. On my battery, the half-round terminal is the ground side. 

Make sure to set up your wires in the same configuration as the battery's wires, so that ground plugs into ground, and power plugs into power. 

Insert the contact ends of the wires into the connector housing. They will snap into place. Again, be absolutely sure the wires are in the same configuration as your battery's connector.

Make the Y-Split

Next, we’ll create a split so that the thermal printer gets its power straight from the battery and the Raspberry Pi gets a nicely stepped-down 5v from the UBEC. To do this, add a Y-split to both the remaining red wire coming from the switch, and the black ground wire coming from our newly installed battery connector. One side of the split will run to the thermal printer’s ground and power wires, and the other side of the split will run to the input side of the UBEC. 

Note: The UBEC’s input side is the end that the large capacitor is soldered to (it should be the side with thicker wires), and the output side is the end with three SMD resistors and thinner wires.

camera_SelfieBotBuild2_19.jpg

camera__MG_3174.jpg

Add the Micro USB Connector

Make sure your wires are long enough for everything to plug in comfortably: the micro USB plugs into the top of the Pi, the printer power and ground plug into the right side of the printer, and the battery will be located at the bottom of the case.

Finally, add a micro usb connector for powering the Raspberry Pi. I highly recommend using a USB shell for this, instead of cutting up an existing micro usb cable, which is what I did. It works fine, but I had to cut up a couple of cables to find one with decent wires inside.

If using an existing cable, when you strip off the insulation and metal foil inside the micro usb, you will find four wires. We are only using the power and ground wires in the micro usb cable, so cut away the white and green wires.

camera_SelfieBotBuild2_21.jpg

camera_SelfieBotBuild2_22.jpg

Slide some heat shrink onto each of the UBEC's output wires, and onto the micro USB cable. Connect the micro USB cable's power and ground wires to the corresponding power and ground output from the UBEC. Cover the soldered connections with the heat shrink.

camera_SelfieBotBuild2_24.jpg

camera_SelfieBotBuild2_25.jpg

camera_SelfieBotBuild2_26.jpg

camera_SelfieBotBuild2_27.jpg

Your power circuit is complete! We’re ready to plug everything in and close it all up.

We're in the home stretch! Next, we'll stick everything down:

Apply double stick foam tape to the back of the proto board, and stick the board firmly onto the middle panel about halfway down, between the thermal printer and the power switch. Do not cover the pass-through hole for wires coming through from the front section.

Using more double stick foam tape, affix the amp and accelerometer to the panel below the proto board, beside the thermal printer.

camera_SelfieBotBuild2_37.jpg

camera_SelfieBotBuild2_41.jpg

Now let's plug everything in:

Plug the HDMI cable into the right angle adapter from the screen, and into the HDMI port at the top of the Pi. Plug the micro usb power cable into the power port at the top of the Pi.

Plug the dongle for your usb mouse and keyboard into a usb port on the Pi. Plug the usb power from the 5” screen into USB a port on the Pi.

Plug the Cobbler’s ribbon cable into the header pins on both the Raspberry Pi and the Cobbler. The white side of the cable should face the thermal printer side of the case.

Plug the connectors for the button wires into their corresponding connectors coming from the photo board.

Insert the speaker’s power and ground wires into the screw terminals on the amp and screw to tighten.

Plug in the printer’s wires.

Secure the Battery

To keep the battery in place (yet removable), affix it to the bottom of the panel with industrial strength sticky velcro. Plug in the battery.

camera_SelfieBotBuild2_44.jpg

camera_SelfieBotBuild2_45.jpg

Check Please!

Before closing SelfieBot up completely, let’s do a test to make sure everything is working. Stand SelfieBot upright (use blue painter's tape or insert two of the long screws into their holes in the case to temporarily keep the layers together). Flip on the power switch. 

If everything is connected correctly, you will see the Raspberry Pi boot screen, the arcade button will illuminate, and the green light on the printer will flash intermittently. If any of these things don't happen, check your connections and fix before moving on. To get back into the front section of the case, unplug the printer's wires and the connectors on the button wires and lift off the middle panel. Remember to disconnect the battery while working on your circuit.

Close It Up

When you are sure everything is working, reward yourself by pulling the protective plastic sheet off of the screen (so satisfying!), and then close up the case.

First, check the fit of the screws in the holes. You may need to drill the holes out slightly for the screws to slide all the way through smoothly.

Insert the six rivet nuts into the holes in the front of the case. Thread a washer onto each of the six 1 3/4" screws. 

Insert the screws into the holes in the back of the case and screw them into the rivet nuts. You'll have to hold the rivet nut to keep it from turning. Don't over tighten.

camera_SelfieBotBuild2_53.jpg

camera_SelfieBotBuild2_51.jpg

Mount the Handles

Finally, we'll mount the handles on the case. Match the front and back pieces of each handle (the exposed holes should be on the back of SelfieBot). Fit the two pieces of each handle around the exposed sections of the middle panel, lining up the three holes. Insert the 3/4" screws into the back handle piece, through the panel, and screw them into the captured nuts in the front handle piece.

camera__MG_3501.jpg

camera__MG_3523.jpg

camera__MG_3508.jpg

camera__MG_3514.jpg

Congratulations! You're finished building SelfieBot! Flip that switch and meet your new friend!

Now that you've finished building SelfieBot, load up the printer with some paper and get to know your new friend:

To turn on:
Flipping the power switch to on will boot the Raspberry Pi. Open the SelfieBot program on the desktop and run the program in IDLE.

SelfieBot reacts to motion, and will react when picked up, tipped side to side, and placed on its back.

To take a selfie:
Press the arcade button to enter selfie mode. Smile at the camera, and press the button again to take and print a photo! 

To turn off:
To exit the SelfieBot program, press escape on the keyboard. Shut down the Raspberry Pi and then flip the power switch to off.

Alternate Methods of Building the Case

You may not want to 3D print the wall sections of SelfieBot, it's tricky to calculate the correct shrinkage factor, and it is also tricky to glue the pieces together after printing. Instead, you may want to laser cut the walls in layers and stack them together.

Below are files for laser cutting the wall sections. "Thin" is the shape we used to cut the walls out of plywood. "Thick" is the shape we used for the cardboard version. There are no holes in the "Thick" files - if you're using the cardboard and zip tie method described below, it's best to poke the holes with an awl after cutting to keep the holes small. 

Original SelfieBot had laser cut plywood walls that were laminated together with wood glue. We used a combination of 6mm and 3mm baltic birch plywood to make the wall sections. The front wall section is 24mm high, and the back wall section is 33mm high.

You could also build the walls out of laser cut cardboard. That's how we built the prototype for SelfieBot. We cut 4 wall layers for the front section and 5 for the back section. Instead of screws to hold the case together, we used zip ties. This is a much cheaper, easier, and lighter solution!

camera_IMG_6620.jpg
Our cardboard SelfieBot prototype with an early version of the face.

To close the case with zip ties instead of screws, feed one zip tie straight through all the layers from front to back. Feed the clasp of another zip tie onto the back of the first zip tie and cinch it tight against the back of SelfieBot. Clip both ties short, and you're done!

This guide was first published on Dec 10, 2017. It was last updated on Dec 10, 2017.