Connecting the camera to the Raspberry Pi is explained (with video) on the Raspberry Pi web site. Note that there is a specific orientation for the cable…the blue tape at each end must face a particular side or it won’t work.
Mentioned on the System Setup page, but for posterity: the Raspberry Pi must be configured to access the camera using the raspi-config utility.
You can test the camera using the raspistill command. If it refuses it work, it’s usually one of the above two things; cable’s installed wrong, or camera’s not enabled in raspi-config.
The stock 150mm camera cable should be sufficient for most projects, but if you have an unusual form-factor in mind (e.g. fitting into an existing camera housing), alternate flex cables are available.
There are two buttons on this camera project. The first, as you’d expect, is the shutter release…you press it to take a photo.
The other button initiates an orderly system shutdown before you switch off the power. This button needs to be held for at least two seconds, so it won’t trigger accidentally. Once activated, allow 20 seconds or so for the shutdown to complete before switching off power. Don’t switch off without a proper shutdown…Linux systems hate that…and it may even corrupt the filesystem on the SD card (then you’d have to start over).
A Perma-Proto Pi HAT is recommend for the most durable connections, and also makes it easier to distribute power and ground to multiple points.
If you’re building this as just a temporary project, to be dismantled and re-used for other things later, button quick-connects can be used instead. With a little planning, each plug fits atop a GPIO pin and adjacent ground point.
If using the Perma-Proto approach, do not solder everything together yet! Wires can be soldered at the button end, but leave the other end unconnected until all the parts are fitted into the case.
The wires should be a little longer than the width of your planned case, so they can snake around as needed.
The LED is optional but provides useful status information…lets you know a picture has been taken or that the system has shut down.
This doesn’t need to be anything fancy…you might already have a suitable LED in your parts stash. Not a NeoPixel, just a plain ol’ through-hole LED, any color. Add a resistor in-line to limit current…minimum 75 Ohms, but a little higher is okay (100 Ohms, 220, it’s all good).
Add wire leads long enough to reach across the camera. Insulate any connections with heat-shrink tube.
For a temporary build, you can clip a F-F jumper wire in half, strip the ends, solder this to your leads and press onto pins on the GPIO header.
If using the Perma-Proto board, do not solder the LED wires to the board yet.
One leg of each button and the LED cathode (shorter or “minus” lead) will connect to a ground pin on the GPIO header…there are several scattered around.
The other leg of each button, and the LED anode (longer or “plus” lead) will connect to GPIO pins. These are configurable in the camera.sh script. The default values are:
The default pin assignments were chosen to make it easy to use quick-connects to straddle a GPIO pin and adjacent ground. However, the pins used above are only present on Raspberry Pi boards with the 40-pin GPIO header…“classic” boards (like the original Model B) with a 26-pin header will require selecting different pins.
The defaults were also chosen to steer clear of some pins that might be useful for adding features in the future…
Although this project does not use a PiTFT display, it seems like an obvious direction that some will want to take…so try to avoid using those pins for the buttons or LED.
The serial connection on the Raspberry Pi can not be reassigned to different pins — it’s always on GPIO14 (TX) and GPIO15 (RX). (Also sometimes labeled TXD and RXD.)
When making the connection between Pi and printer, these wires must be crossed. TX from the Pi connects to RX on the printer, and RX to TX. (If using the USB mini printer, this step is bypassed, just use a USB cable.)
The standard and “Nano” thermal receipt printers, plus the “Printer Guts” model, all have their pins labeled. On the “mini” printer, if using the TTL interface instead of USB, green wire is RX, blue is TX (but remember to cross these when making the connections to Pi TX and RX).
Power from the battery pack needs to be split to both the Raspberry Pi and the printer.
If using the Perma-Proto HAT, this is super easy: use the +5V and GND rails on the board; battery pack and printer can both connect there, and these also go to the appropriate points on the GPIO header.
If wiring “manually,” you may need to splice two ways off the battery pack to both the Pi and printer.
Four Eneloop NiMH cells nominally provide 4.8 Volts to the system (sometimes a little more, sometimes less)…this is close enough to 5V to keep the Pi happy…and provide adequate current to run the printer. Do not install alkaline cells…this could potentially damage the Pi or anything connected to its USB port, and probably won’t have enough current for the printer.
Our 4X AA battery holder has an On/Off switch. If using a different battery holder without a switch, add your own switch in-line on the + wire.