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.
YOU WILL NEED:
- Raspberry Pi
- SD card (with Dexter Industries Brick Pi image installed)
- Brick Pi
- Raspberry Pi Camera
- Battery Pack + Cable
- Some sort of stick
- Some LEGOs, electrical tape, or other creative building material
Step 1: Setup 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.
Step 2: Download the Code + Test
Once you’ve got 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 ~/Desktop
mkdir Selfie_Stick
cd 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.
Step 3: Design your Selfie Stick
Now that everything is technically 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 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.
Step 4: 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.
Step 5: Build a Trigger + Battery Pack 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 one for this example, or search around for yourself.)
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.
Step 6: 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!
Step 7: Selfie Away!
You are 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.