Do you miss your old Polaroid instant camera, or your old Gameboy Classic's black and white camera? So do we, when we feel really nostalgic! In this Instructable, we will show you how to make your own instant camera using a Raspberry Pi, a Pi camera and screen and some electronics and a bunch of cardboard!.
Step 1: The Things You'll Need
For this project, we used the following supplies:
- A Raspberry Pi 3B or 3B+ with microSD card (this model is our go-to for builds, but this project should work with other Raspberry Pi models)
- A Raspberry Pi camera module
- A 3 amp, 5V microUSB power supply
- An official Raspberry Pi touchscreen
- A USB thermal printer - we used one of Adafruit's tiny thermal 3D printer
- A switch - we used one of Adafruit's arcade button from a previous project, but any switch will do
We also used the following equipment:
- A third hand tool, to hold your electronics while you solder
- Pliers - the flat, needlenose and cutting kinds
- A wire stripper - to save you time prepping wiring
- A soldering iron and solder
Step 2: Optional: Prep Your Raspberry Pi for Anything
For this Instructable, we will be using a Raspberry Pi we prepped using our previous tutorial. If you’re starting from scratch, it’s a great way to make sure we are using roughly the same setup.
Feel free to setup your Raspberry Pi with this guide if you want to, then come back here to continue with our Thermal Printer Camera project!
Step 3: Cutting Your Cardboard Camera Frame
We designed a cardboard frame so we can easily move our camera where we need it - for example, if you need better lighting or to take it to an event.
You can download the vector files for laser cutting from Github, or you can use it as a guide to cut your own with an X-acto blade or a box cutter. For this Instructable, we will assume you’re using our cardboard frame!
Step 4: Prepping and Mounting Your Touchscreen
Open your touchscreen box and check that you have:
- your video cable
- your mounting screws
- your DuPont cables
- your touchscreen
If you have everything, you're ready to go!
- Connect the red DuPont cable on the 5V pin on the screen board
- Connect the black DuPont cable on the Ground pin on the screen board
- Sit your Pi on top of the posts on your touchscreen
- Screw your Pi in place
- Connect the black DuPont cable to a 5V pin, and the red DuPont cable to a ground pin on your Pi
Power your screen and your Pi through the microUSB port on your screen. If everything went well, the Pi and Screen should both turn on! When you're happy that everything seems to work correctly, turn everything off: we'll get back to your Pi in a moment.
Step 5: Prepping and Mounting Your Camera Module
TIP - The Pi camera module is one of the most sensitive pieces of electronics we’ve worked with and we have seen some get fried just because of static electricity. Ground yourself by touching something big and metallic in the MakerSpace or around your home, like one of the laser cutter, a dishwasher or a radiator!
Open your Pi module box and check that you have:
- your Pi camera module
- your Pi camera cable
If you do, great! Time to connect the camera to your Pi:
- Gently pull up the brown tab on the camera module's port
- Insert the end of your cable, silver contacts (up? down?)
- Push the tab back in to secure the cable in place
- Gently pull the camera port's brown tab up on your Pi
- Insert the other end of your cable inside the port, silver contacts turned towards the screen port
Finally, secure the Pi camera module in the cardboard frame from the back with a piece of duct tape.
Step 6: Prepping and Mounting Your Thermal Printer
TIP: First time using a soldering iron? Check out Adafruit’s guide to excellent soldering first!
Time to check your printer package! For this step you will need:
- Your thermal printer
- Your printer power adapter
- The connection wires that came with your printer
If you have everything, you're ready to prep your printer for power! Turn on your soldering iron and:
- Tin the back and front pins of your barrel plug
- Strip and tin some red and black wire
- Solder the red wire to the back pin
Solder the black wire to the front pin (if you want to use some heathshrink tubing to insulate the wires, now is the time to cut it to size and slip it on the wires!)
- Solder the red and black wires to the corresponding wires on the power connector that came with your printer (if you used heatshrink tubing, you can heat it now to make it hug, insulate and secure your wires)
Your printer is ready! You can now place it into the frame:
- Feed your printer in through the front of the frame, with the door opening down
- Connect your power wires and USB cable from the back
- Connect the USB cable to the Pi
- Connect the power adapter to the barrel plug
Step 7: Prepping and Mounting Your Switch
TIP: If like ours your switch has more than two pins and you don’t know which do what, you can use a multimeter’s continuity mode to identify which pins are connected when you press your switch!
After you identified the switch pins, turn on your soldering iron and:
- Tin the switch pins with a little solder
- Strip and prep some wires the same way you did for your printer’s power wires, this time using some DuPont wires (or regular wires, in case you just want to solder everything on your Pi’s pins)
- Solder them to your switch’s pins
- Feed your switch through the hole on your cardboard frame, wires first. Secure your switch from the back with the screw ring, but not all the way
- Connect the black DuPont cable to a Ground pin, and the other cable to your Pi’s pin 16
Step 8: Installing Your Printer
Now that your printer is ready for use, let's work on the software side of things. First off, let's make sure your Rapsberry Pi operating system is up to date. In your Terminal, type:
sudo apt-get update sudo apt-get upgrade
This might take a little while, but once everything is up to date we can install printer support on your Pi. Still in your Terminal:
sudo apt-get install git cups wiringpi build-essential libcups2-dev libcupsimage2-dev
This will install all the software you need to support your printer. Next, let's add the capacity for your printer to print raster graphics. Still in your Terminal:
git clone https://github.com/adafruit/zj-58 cd zj-58 make sudo ./install
Execute each command one after the other, giving them time to finish.
You should have a test print in your printer's box: you should find a BAUDRATE value on it. Keep it handy, because we need it for this next step! In your Terminal, create a profile for your USB printer with:
sudo lpadmin -p ZJ-58 -E -v serial:/dev/ttyUSB0?baud=YOUR BAUD VALUE HERE -m zjiang/ZJ-58.ppd
Then, make this new printer your default printer with:
sudo lpoptions -d ZJ-58
That's it! Your printer should be ready to go.
Step 9: Install the Picture-Taking Script
To install the picture-taking script, you can just copy the code we made available on Github. It's a simplified and commented version of Philip Burgess' original script, automatically setting up the exposure for the camera. In your terminal, type:
git clone https://github.com/jocolibrarymakerspace/thermal_printer_camera
This will create a thermal_printer_camera folder and download all the necessary files there.
To test your setup now, go to the thermal_printer_camera folder:
Give yourself the permissions to run the instant camera script:
sudo chmod +rx thermal_printer_camera.sh
Run the script:
When you press your switch, your screen will display a preview of what the camera can see, give you a few seconds to pose and print out the picture to your thermal camera!
Step 10: Starting the Camera Software on Boot
Finally, let's have the picture-taking script start automatically when we turn the Pi on! In your terminal, type:
sudo crontab -e
At the end of the file, add the following line:
#crontab @reboot /pi/thermal_printer_camera/thermal_printer_camera.sh
This will start the camera software up with your Raspberry Pi on boot. Now is a good time to reboot your Pi and test it out! Nothing special will happen on your Pi, until you actually press the switch.
Step 11: Would You Like to Know More?
This design was inspired by Phillip Burgess's tutorial "Instant Camera using Raspberry Pi and Thermal Printer"
We used this camera and a fancy laser cut wood frame for our 2018 Library Lets Loose fundraising event, and are already gearing up for the next! Find out more on the Johnson County Library Foundation website at https://www.jocolibraryfoundation.org/