# BrickPi Selfie Stick

 Site: GoLabs Course: BrickPi Selfie Stick Book: BrickPi Selfie Stick
 Printed by: Guest user Date: Tuesday, 4 October 2022, 4:00 PM

## Description

Turn your BrickPi into a Selfie Stick.

## 1. Introduction

Turn your Brick Pi into a Selfie Stick! Because… why not?? The selfie stick is an absurd trend sweeping the world, and so we bring shame to the Raspberry Pi community by converting a beautiful, useful piece of technology into a crude tourist sensation.

## 3. Set up your Pi Camera

Before building anything, you’ll need to setup and test your Raspberry Pi Camera (if you haven’t already.) It’s a good idea to familiarize yourself with how the camera works and where the pictures get saved – you may have to explore a little.

For tips on how to setup your camera properly, see the “Setting up the Camera” section of this other tutorial or this great link.

## 4. Download the Code & Test

Once you have your camera working, you should test out the selfie stick code. You should first plug your touch sensor into Port 2 of your Brick Pi.

At this point, you’ll probably want your Pi connected to a display and control setup of some kind (either a monitor/keyboard/mouse combo, or a virtual connection–check out the tutorial here for tips.)

Once you’re all set up, you can download the code here. You can either get your Pi on the internet and download straight to it from the GUI, or you can download on another computer and use a USB stick to transfer the program (see here for linux tips with USB drives.) I named my file “selfie_stick.py”.

It’s a good idea to start a folder for your selfie stick project. You can save the Python file in there, and save your test photos in that folder as well. To make this folder your working folder so the images you are about to take are saved in it, navigate to it via the terminal using the “cd” command. In the following example, I navigate to my Pi’s desktop, create a new folder named “Selfie_Stick” and then make that new folder my working directory.

cd ~/Desktopmkdir Selfie_Stickcd Selfie_Stick

You’ll also need to put a copy of a piece of the Dexter Industries image in your working folder– just the “BrickPi.py” file. You can do this through the terminal or using the GUI. Either way, copy and paste the file into your folder.

To test the code in the terminal, type in “python”, followed by the name of your file. In my case this is: “python selfie_stick.py” and hit enter. You should see the word “RUN” appear, like this:

Hit the touch sensor and see what happens. You should see a red light appear on your Pi Camera, and an image appear on your screen. This means a photo was taken! If nothing happens, and all you see is the word “RUN,” that means something is not quite right. Double check that you’ve got both your selfie stick file and the BrickPi.py file in your current folder, and make sure your touch sensor is plugged in to the correct port.

Optional Bonus Step: You may want to set it up so your selfie stick code launches every time your BrickPi starts up, so you don’t have to keep plugging in a monitor and sending the file over. Unlike an Arduino, the Pi won’t just store your program unless you tell it to – check out these instructions to have your Pi run your selfie stick program every time it boots.

## 5. Design Your Selfie Stick

Now that everything is working, it’s time to turn this camera setup into a selfie stick! This is where you can let your creativity take over – I used an old scrap of PVC pipe, some LEGOs I had laying around, and some electrical tape for stability. You could also use a yardstick, cardboard + tape, or any building material you can get your hands on. Recyclables like old (clean) yogurt containers could work well for supporting the battery pack, for example.

The basic idea is to have the touch sensor down by your hand, and the Pi Camera way at the other end of the stick. The other stuff is all up to you!

The main limiting factor in my design was cord length. You need to plug the touch sensor into your Pi, your Battery Pack into your Pi, and your Pi Camera into your Pi! All of this stuff impacts your design, so think about any modifications or other supplies (like an extra long cord to plug in your touch sensor!) you may want to order or make.

## 6. Build a Camera Support

I used a few LEGO pieces to position the Pi Camera exactly how I wanted. The key is to prop the camera up, and secure it so it doesn’t flop around while you are trying to take a picture.

Front view of LEGO support.

Alternate View

## 7. Trigger & Battery Support

The BrickPi itself is pretty heavy, so in my design, I wanted to cut down on the weight perched way out on the stick by moving the Battery Pack to the base of the stick. To do this, you either need a long power cable, or you can do what I did and extend the regular short wire by splicing in a length of wire and soldering it together. There are a lot of great resources online for this process – check out this example, or search around for yourself.)

Cut & Strip Wires

Twist one end of the wire with a stripped end of a long piece of wire.

Solder and cover with electrical tape.

This meant that my trigger (touch sensor) and my Battery Pack would both be sitting at the base of my selfie stick. So I again built a little LEGO structure to secure the parts to the stick. My PVC pipe had a small drill hole in it already, so I used that to anchor the LEGO to the stick. Again, you can do this any way you like – the key is stability.

LEGO stuck into PVC with the help of a hole and an axle.

My trigger and battery holder

Front View

## 8. Anchor your Pi

I took a bit of a shortcut here and used tightly wrapped electrical tape and a few LEGO beams to secure the BrickPi to my PVC stick. What more creative structural way can you find to support your BrickPi? Post in the comments!

My sophisticated anchor of LEGO beams and electrical tape.

## 9. Selfie Away!

My complicated selfie stick! What improvements did you make?

BrickPi selfies will make you the coolest person at the office!

You're all set! Go forth and take selfies! When you’ve taken a bunch, bring your Pi back to its monitor and grab the photos off it. You may find that the photos don’t save where you think they do, or that your face is blurry in all of them – practice makes perfect, even in the selfie world!

Tip: If you are struggling to find your selfies, you can always type “find / -name *selfie-*.jpg” into your terminal. It will return any files with the name “selfie-XX.jpg”. If you have a monitor hooked up, you can then use the “display” command to look at the photos. Check out the camera testing links above for more details.