We’ll use the box the printer came in as a DIY enclosure!
If you already tossed the box, or if you need a different shape (for example, using a different Pi board or a different battery), not to worry…you can improvise from almost anything. Maybe a slightly larger box that an Adafruit order came in, or some kind of Tupperware-like plastic container. Improvise, go nuts, it’s not rocket science.
Measuring some parts, or just tracing around others directly as a template, use a pencil to mark where the components will go, then cut out these sections with a hobby knife.
I chose to put the thermal printer at the lower front center, camera board at upper center. The Pi and battery pack will then fit to either side.
Nothing should be soldered to the Perma-Proto board yet. If you’ve made these connections already, un-solder the wires from the board. Re-do these after everything’s in position.
Starting from the outside, feed the wires through each hole and press the buttons and LED into place. The buttons include washers and nuts to hold them in place on the inside, while the other parts can be held with hot glue.
The camera board is pressed in place from behind and held down with small dabs of hot glue…don’t go crazy on this part, it may be sensitive to heat.
Since I didn’t have the same 4X AA battery holder on hand, I added my own power switch, which you can see at the top-left of the box.
Experiment with parts placement inside the box. I'd planned to have the battery on left, Pi on right, but there wasn’t adequate clearance under the buttons. Fortunately I’d connected long wires to everything and it was no problem to swap these positions!
The 4X AA battery holder with switch is a little larger than the battery holder I’m using here. Instead of the right side, it might sit flat against the back of the printer instead.
There’s some “electronics origami” as parts are connected and fit into place…
Perma-Proto HAT is removed from the Pi for the time being.
The camera cable needs to snake through the slot on the Perma-Proto HAT, then into the Raspberry Pi.
The printer TTL cable was cut in half, TX and RX connected to the Perma-Proto (remember, cross these to RX and TX on the Pi), red and black to the +5V and GND rails. The end of the unused wire (DTR) was insulated so as not to cause mayhem.
Once everything’s connected, then the Perma-Proto HAT can be reattached to the Pi.
Find a stable position for the Pi and battery pack. The former can be held in place with some foam tape or hot glue. The battery pack should be able to be lifted out, so the batteries can be replaced.
Try powering it on. The red LED (power indicator) on the Raspberry Pi should light, then the green LED (SD card access) should flicker.
After 30 seconds or so, the status LED (on GPIO pin 5) should flash a few times, indicating the system is ready. Aim the camera at something and try the shutter button…
- Check that the batteries are fully charged and are installed in the correct orientation.
- Check that the red and black wires from the battery pack go to the +5V and GND rails on the Perma-Proto board, or (if wired manually) are split to the equivalent points on both the Raspberry Pi and printer.
- Is the SD card installed and properly seated?
- Disconnect the Perma-Proto board and try booting the Pi “bare.” If this works, you might have a short or wrong connection somewhere in your wiring.
- Disconnect the TTL cable from the printer. Connect a monitor and keyboard to the Raspberry Pi, run the raspi-config utility and disable the serial console.
- Confirm that the + (longer) leg of the LED is connected to GPIO5 (or whatever pin you’ve configured in the script), and the other leg is connected to a ground pin.
- The camera might be failing to capture a photo. Confirm that the camera ribbon cable is installed in the correct orientation and is firmly seated in both the Pi and camera board connectors. Remove the Pi from the box, connect a monitor and keyboard, run the raspi-config utility and make sure the camera is enabled.
- Make sure that TX and RX are crossed between the Raspberry Pi and printer. Pi TX should go to printer RX, while Pi RX should connect to printer TX.
- Review the steps on the “System Setup” page. Make sure the CUPS software is installed and that you’ve added a line to /etc/rc.local to run the camera script automatically at startup.
- Part of this may be the lighting, especially if shooting outdoors.
- Really dark printing may require more current than the batteries can provide. See notes below about modifications you can make for alternate power supplies (though they won’t fit inside this same case).
I used the leftover scrap of cardboard from the printer cutout to fashion a little viewfinder. This is more stylistic than functional…the actual field of view is much wider…but gives people a little hint how to point and work the camera.
You could also use stickers or colored markers to spruce it up…draw a “lens” on the front, or give it a Polaroid rainbow logo. Or just draw some dragons at random, they make everything better.
Custom Enclosures
This project is ripe for all kinds of hacking…especially custom enclosures, perhaps 3D-printed or laser-cut, or retrofitted into an old Polaroid camera.
If you do make a custom enclosure, note that the printer is very orientation sensitive and should only go one of two ways:
- Paper feeding out the top.
- Paper feeding out the front, with the slot nearest the top (not bottom).
Any other orientation, the paper roll will wedge in place and the printer will jam!
Portrait vs Landscape
You’re not required to install the camera in the box in the traditional “landscape” orientation…turning the camera board “sideways” is totally fair game, if you want a camera that’s optimized for portrait photography without having to turn it. As explained above, the printer component should be kept horizontal, else the paper will jam.
Alternate Power Sources
The 4 Eneloop batteries provide sufficient voltage and current to run the Pi and thermal printer, though the output may be a bit light for some users’ tastes. Other power sources are possible but increase cost and complexity, and may require some trial and error…
- A 5 Volt UBEC can provide ample current (3A) by stepping down a higher-voltage battery, such as a bank of 8 NiMH cells, or a 7.4V camcorder battery (we have holders for some Canon, Sony and Panasonic varieties in the shop). Camcorder batteries are a bit expensive to buy just for this project, but might make sense if you already have some around.
- A USB power bank may or may not actually work…it depends, some can’t sustain sufficient output current and prints will be extremely light or paper won’t feed properly. Sometimes the culprit isn’t the power bank, but the USB cable, with tiny conductors that can’t deliver much current.
Diffusion Dithering
I like the “ordered” dithering pattern CUPS uses by default…but if you’d prefer diffusion dithering instead, it’s a simple change.
First, install ImageMagick:
sudo apt-get install imagemagick
Then modify the camera.sh script as follows…the “raspistill” line should be changed to:
raspistill -n -t 200 -w 512 -h 384 -o - | convert - -remap pattern:gray50 png:- | lp
You’ll need to reboot the system or restart the camera script for this to take effect.
Not quite the look you’re after? ImageMagick has a ton of image conversion and filtering options!
Adding More Controls or Other Features
If you’re the hacking type and would like to add additional buttons, sensor feaures or control a flash…or even a PiTFT viewfinder…here’s a map of the GPIO header again:
Any of the green GPIO pins are fair game as 3.3V logic inputs or outputs. If you plan to use a TFT display or maybe add one in later, steer clear of the yellow pins…the PiTFT displays require exclusive use of these. GPIO pins 2 and 3 may be available if I2C is disabled using raspi-config…but some sensors or devices may require using I2C.
As presented, our example script does not support a PiTFT viewfinder…this will require your own custom code, perhaps written in Python.
Text editor powered by tinymce.