# Instant Camera using Raspberry Pi and Thermal Printer

## Overview

 **This guide is marked as DISCONTINUED — thermal printers and accessories are no longer carried by Adafruit, and some of the APIs and drivers referenced here are no longer available or compatible. Code will not be updated and guide feedback will not be reviewed. The information remains online because a few elements may be of use for anyone who still has this hardware, but will still need to DIY their own code.**

 **“Instant photography”** with Polaroid cameras was a _thing_&nbsp;up through the 1990s until ubiquitous digital photography took hold…though, like vinyl music, the medium has&nbsp;since made a nostalgic resurgence.

In this project, we’ll replace chemical film with more modern _electronic_ parts: a **Raspberry Pi computer and camera** paired with a diminutive **thermal printer** , all working off a battery. **Press a button, get a print!**

![camera_polaroid.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/294/medium640/camera_polaroid.jpg?1462514519)

This camera-and-thermal-printer combination is not&nbsp;a new idea…Nintendo released their **Game Boy Camera and Printer** as mass-market devices in 1998. What’s exciting is that **we no longer need the resources of a giant corporation to create something similar** …inexpensive computer power and open source software make infinite customization possible!

![camera_GameBoy.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/291/medium640/camera_GameBoy.jpg?1462511676)

# Parts from Adafruit:

- **Any model Raspberry Pi with a camera connector** (i.e. all but Pi Zero). The **[Model A+](https://www.adafruit.com/products/2266)**&nbsp;is an excellent choice because it’s small and power-efficient, but if you have a different model on-hand this’ll work all the same (though might need your own case). The Raspberry Pi 3 only works with our USB receipt printer so it might not be the best option.
- **2GB or larger microSD card** (or full-size SD for older Raspberry Pi boards).
- **Any model Raspberry Pi Camera board** ; visible light or NoIR (infrared), original 5 megapixel or newer 8 MP models. This project does not require high resolution, so if you’ve upgraded another project to the latest camera, it’s an excellent opportunity to repurpose the “classic” unit.
- **Any model Adafruit Thermal Receipt printer.** We’ll use the “**[Nano TTL](https://www.adafruit.com/products/2752)**” model because it’s compact, but any of the other varieties can work as well.
- **Thermal Paper Roll(s).** The Nano printer requires a special [nano roll](https://www.adafruit.com/products/2755). There are corresponding fitting&nbsp;rolls available for the Mini and full-size receipt printers.
- **[4xAA Battery Holder with On/Off Switch](https://www.adafruit.com/products/830).**&nbsp;Or you might be able to adapt a different 5-ish Volt power supply…it requires a couple Amps of current, and most USB battery packs didn’t quite cut it.
- **[Perma Proto HAT — No EEPROM](https://www.adafruit.com/products/2310).** This is used for connecting buttons and power to the Raspberry Pi GPIO header…though if you’re resourceful, any Pi Cobbler or even some M-F jumper wires could be adapted to the task.
- **16mm Panel-Mount Momentary Push Button** &nbsp;or similar, two required. [Various](https://www.adafruit.com/products/1503)&nbsp;[interesting](https://www.adafruit.com/products/1445)&nbsp;[colors](https://www.adafruit.com/products/1502)&nbsp;[are](https://www.adafruit.com/products/1504)&nbsp;[available](https://www.adafruit.com/products/1505).
- Latest version of **[Raspbian Jessie Lite](https://www.raspberrypi.org/downloads/raspbian/)**&nbsp;for Raspberry Pi web site. No not&nbsp;use the full version, it’s _enormous…_the&nbsp;Lite version is sufficient for this project.

# Parts Not From Adafruit:

- **4 (four) Panasonic&nbsp;Eneloop rechargeable NiMH batteries.** Yes, this is actually important, not a shill…we tested with other cells and they lacked the same “oomph.” Additionally, the Eneloops hold a charge much longer when stored.
- **NiMH battery charger.**

**You will also need the usual electronics project items:** soldering iron and related paraphernalia, some bits of wire, etc. Optionally, you can add an **LED** (any color) and resistor (100 Ohm or thereabouts) as a status indicator.

**Some prior Raspberry Pi experience is assumed** &nbsp;— downloading the OS, writing an SD card, basic system and network configuration, etc. You can search the Adafruit Learning System for related&nbsp;guides if any of this is unfamiliar.

**During setup, you will temporarily need a monitor, keyboard and network connection.** The Model A+ may require using a USB hub and a wireless adapter…if you already have a working Raspberry Pi system that’s networkable, it may be easier to borrow that for the software setup, then move the card over to the A+ board.

**Creating an enclosure for your camera is a DIY project.** We’ll upcycle&nbsp;the box the thermal printer comes in, but you might want to create&nbsp;something fancier than that…maybe 3D printed, or even fit into an old camera body.

## Read through the full guide before commiting to any purchases. You might already have some parts on-hand…or there may be some “gotchas” that require specific components.
![](https://cdn-learn.adafruit.com/assets/assets/000/032/316/medium800/camera_Banner.jpg?1462594098)

# Instant Camera using Raspberry Pi and Thermal Printer

## System Setup

Warning: 

Danger: 

# Basic Setup

Download the latest version of&nbsp;**[Raspbian Jessie Lite](https://www.raspberrypi.org/downloads/raspbian/)**&nbsp;if you haven’t already. You do not need the regular full version; “Lite” is adequate for this project’s needs and can fit on a 2GB card with room to spare. You’ll also need a **keyboard** and **monitor** attached, and a **network** connection…if using a Pi Model A+, this may require a **USB hub** and a **WiFi** or **Ethernet** adapter…or, if you have another working Pi system, it’s often easier to borrow that for setup, then move the working card over to the A+ board.

Write the OS to an 2GB&nbsp;or larger SD card, insert in the Raspberry Pi and power it up. After a minute or so you’ll get a login prompt. Log in with the usual default pi/raspberry user and password, then run&nbsp;the raspi-config utility:

```auto
sudo raspi-config
```

The following options are **required** :

- **Expand Filesystem.**
- **Enable Camera.**
- Under “ **Advanced Options** ,” select “ **Serial** ” and&nbsp; **disable the serial console**.

The following are **optional** but **recommended** :

- Under “ **Internationalisation Options** ,” configure the **keyboard** (and optionally the locale and time zone) to match your needs. If you’re getting unexpected&nbsp;output&nbsp;from the keyboard, this is why.
- **Change User Password** because everybody knows the default.
- **Advanced Options: Change Hostname** to distinguish this system from other Raspberry Pi systems on the network.
- **Advanced Options: Enable SSH** to allow&nbsp;remote administration via network.
- **Advanced Options: Disable Overscan** gives a little more working space if using an HDMI monitor.

When you’re done, tab over to the button and **reboot** the system when prompted. Log in as the “pi” user again, using the password you assigned above (or the default “raspberry” if you opted not to change it).

# Networking

This is most easily done with a wired Ethernet connection — usually just a matter of plug it in & go. The Model A+ board doesn’t have an Ethernet port, which is why we recommend doing the setup on a more capable Pi system, then moving the card over when finished. Alternately, a USB hub and WiFi adapter can work.

Connecting to wireless networks usually involves editing either **/etc/network/interfaces** or&nbsp; **/etc/wpa\_supplicant/wpa\_supplicant.conf** with your wireless network name and credentials. Beyond the scope of this guide, it’s explained in other guides here, or Googling can quickly turn up some reference material.

The network is only needed during setup…once the camera’s tested and working, it’s all self-contained.

# Install Software

First we’ll install printer support (_CUPS&nbsp;—_&nbsp;the _Common UNIX Printing System_) and some related development tools…

```auto
sudo apt-get update
sudo apt-get install git cups wiringpi build-essential libcups2-dev libcupsimage2-dev
```

Then install the _raster filter_ for CUPS. This processes bitmap images into the thermal printer’s native format…

```auto
cd
git clone https://github.com/adafruit/zj-58
cd zj-58
make
sudo ./install
```

Your thermal printer may have arrived with a&nbsp; **test page** &nbsp;in the box or the paper bay. If not, or if you threw that away, you can generate a new one by installing a roll of paper and holding the feed button (on printers that have one) while connecting power, or tapping the button on the back of the “Nano” printer or the “Printer Guts.”

Look for the&nbsp; **baud rate** &nbsp;that’s printed near the bottom of the page. This is typically either&nbsp; **9600** &nbsp;or&nbsp; **19200** &nbsp;baud. This is important…you’ll need to know the correct value for your printer.

![](https://cdn-learn.adafruit.com/assets/assets/000/032/197/medium800/camera_raspberry_pi_components_test-baud.jpg?1462489868)

 **The printer doesn’t need to be connected yet.** We can prepare the system the same regardless.

To add the printer to the CUPS system and set it as the default, we’ll be typing two lines similar to the following (but not necessaryily identical…read on)…

```auto
sudo lpadmin -p ZJ-58 -E -v serial:/dev/ttyAMA0?baud=9600 -m zjiang/ZJ-58.ppd
sudo lpoptions -d ZJ-58
```

On the first line, change the “ **baud** ” value to **9600** or **19200** as required for your printer.

For a **USB** &nbsp;receipt printer, change the device name to **/dev/ttyUSB0**

For **all other** (TTL) printers, use **/dev/ttyAMA0** for the device name.

The rest of the line should be typed _exactly_ as it appears above. Likewise for the second line, which needs no changes.

# Camera Script

The code that handles the shutter button and moves&nbsp;images from the Pi camera to the printer is included&nbsp;with our version of the CUPS filter software. You’ll find it in **/home/pi/zj-58/extras/camera.sh** (unless you’re using a different account or home directory, or downloaded the **zj-58** repository elsewhere…the important bit is, look in the “ **extras** ” directory for this script.

It’s all written as a Bash shell script, no Python or anything else required:

```auto
#!/bin/bash

SHUTTER=16
HALT=21
LED=5

# Initialize GPIO states
gpio -g mode  $SHUTTER up
gpio -g mode  $HALT    up
gpio -g mode  $LED     out

# Flash LED on startup to indicate ready state
for i in `seq 1 5`;
do
	gpio -g write $LED 1
	sleep 0.2
	gpio -g write $LED 0
	sleep 0.2
done

while :
do
	# Check for shutter button
	if [ $(gpio -g read $SHUTTER) -eq 0 ]; then
		gpio -g write $LED 1
		raspistill -n -t 200 -w 512 -h 384 -o - | lp

		sleep 1
		# Wait for user to release button before resuming
		while [ $(gpio -g read $SHUTTER) -eq 0 ]; do continue; done
		gpio -g write $LED 0
	fi

	# Check for halt button
	if [ $(gpio -g read $HALT) -eq 0 ]; then
		# Must be held for 2+ seconds before shutdown is run...
		starttime=$(date +%s)
		while [ $(gpio -g read $HALT) -eq 0 ]; do
			if [ $(($(date +%s)-starttime)) -ge 2 ]; then
				gpio -g write $LED 1
				shutdown -h now
			fi
		done
	fi
done
```

A&nbsp;few variables at the top of the script may need editing depending how you assemble your camera…we’ll return to this on the “Connections” page.

# Configure for Auto-Start

Let’s make the camera script launch automatically when the system boots…

```auto
sudo nano /etc/rc.local
```

Before the final “exit 0” line, insert:

```auto
sh /home/pi/zj-58/extras/camera.sh
```

It should look something like this:

![](https://cdn-learn.adafruit.com/assets/assets/000/032/317/medium800/camera_nano.png?1462595865)

If you’ve located the camera.sh script somewhere else, enter the full path here.

Save&nbsp;the changes to the file and exit the editor.

## Once the system’s fully configured, you may want to **back up the SD card.** Like any battery-operated Pi project, there’s a small possibility of the filesystem getting corrupted. Many utilities that write SD card images can also _read_ a card to create a backup.
# Instant Camera using Raspberry Pi and Thermal Printer

## Connections

# Camera

Connecting the camera to the Raspberry Pi is [explained (with video) on the Raspberry Pi web site](https://www.raspberrypi.org/documentation/usage/camera/README.md). Note that there is a **specific orientation** &nbsp;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](https://www.adafruit.com/products/2087).

# Buttons

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&nbsp;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](https://www.adafruit.com/products/2310)&nbsp;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](https://www.adafruit.com/products/1152)&nbsp;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&nbsp;not&nbsp;solder everything together yet!** &nbsp;Wires can be soldered at&nbsp;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.

![camera_perma-proto.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/402/medium640/camera_perma-proto.jpg?1462912937)

![camera_quick-connects.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/403/medium640/camera_quick-connects.jpg?1462912955)

![camera_buttons-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/404/medium640/camera_buttons-wired.jpg?1462912976)

# LED

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&nbsp;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&nbsp;(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&nbsp;solder the LED wires to the board yet.

![camera_led-wires.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/405/medium640/camera_led-wires.jpg?1462913056)

One leg of each button and the LED cathode (shorter or “minus”&nbsp;lead)&nbsp;will connect to a **ground** pin&nbsp;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:

```auto
SHUTTER=16
HALT=21
LED=5
```

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&nbsp;to steer clear of some&nbsp;pins that might be useful for adding features in the future…

![](https://cdn-learn.adafruit.com/assets/assets/000/032/187/medium800/camera_GPIO-Diagram.png?1462486576)

Although **this project does not use a PiTFT display** , it&nbsp;seems like an obvious direction that some will want to take…so try to avoid using those pins for the buttons or LED.

# Printer

The serial connection on the Raspberry Pi can **not** &nbsp;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&nbsp;be _crossed._ TX** from the Pi connects&nbsp;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”&nbsp;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

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:&nbsp;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&nbsp;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 **+** &nbsp;wire.

# Instant Camera using Raspberry Pi and Thermal Printer

## Assemble and Customize

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&nbsp;center, camera board at upper&nbsp;center. The Pi and battery pack will then fit to either side.

![camera_box-cutting.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/406/medium640/camera_box-cutting.jpg?1462913216)

 **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&nbsp;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.

![camera_hot-glue.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/407/medium640/camera_hot-glue.jpg?1462913252)

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.

![camera_positioning.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/408/medium640/camera_positioning.jpg?1462913298)

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.

![camera_printer-connections.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/409/medium640/camera_printer-connections.jpg?1462913317)

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.

![camera_all-packed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/410/medium640/camera_all-packed.jpg?1462913342)

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…

Success!

![camera_test-pic.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/411/medium640/camera_test-pic.jpg?1462913363)

# Troubleshooting
### 

- Check&nbsp;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&nbsp;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.

![camera_Banner.jpg](https://cdn-learn.adafruit.com/assets/assets/000/032/412/medium640/camera_Banner.jpg?1462913394)

# 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&nbsp;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&nbsp;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&nbsp;UBEC](https://www.adafruit.com/products/1385)**&nbsp;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&nbsp;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,&nbsp;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:

```auto
sudo apt-get install imagemagick
```

Then modify the camera.sh script as follows…the “raspistill” line should be changed to:

```auto
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!](http://www.imagemagick.org/script/convert.php)

# Adding More Controls or Other Features

If you’re the hacking type and would&nbsp;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:

![](https://cdn-learn.adafruit.com/assets/assets/000/032/188/medium800/camera_GPIO-Diagram.png?1462486599)

Any of the green GPIO pins are fair game as 3.3V logic inputs or outputs. If you plan to use a TFT display&nbsp;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.**


## Featured Products

### Raspberry Pi Model A+ 512MB RAM

[Raspberry Pi Model A+ 512MB RAM](https://www.adafruit.com/product/2266)
 **Note:** As of August 10th, 2016 the Raspberry Pi A+ now includes 512 MB of RAM!

The Raspberry Pi Model A+ is the perfect board for the minimalist Pi fan. This low-cost Pi uses the same processor as the model B+, but does away with the Ethernet jack and three of the USB...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2266)
[Related Guides to the Product](https://learn.adafruit.com/products/2266/guides)
### Raspberry Pi Camera Board

[Raspberry Pi Camera Board](https://www.adafruit.com/product/1367)
The Raspberry Pi Camera Module is a custom designed add-on for Raspberry Pi. It attaches to Raspberry Pi by way of one of the two small sockets on the board upper surface. This interface uses the dedicated CSI interface, which was designed especially for interfacing to cameras. The CSI bus is...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1367)
[Related Guides to the Product](https://learn.adafruit.com/products/1367/guides)
### Nano Thermal Receipt Printer - TTL Serial

[Nano Thermal Receipt Printer - TTL Serial](https://www.adafruit.com/product/2752)
Add a _really really small_ printer to any microcontroller project with this very cute thermal printer. Thermal printers are also known as receipt printers, they're what you get when you go to the ATM or grocery store. Now you can embed a little printer of your own into an...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2752)
[Related Guides to the Product](https://learn.adafruit.com/products/2752/guides)
### Thermal Paper Roll - 16' long, 2.25"

[Thermal Paper Roll - 16' long, 2.25"](https://www.adafruit.com/product/2755)
A little roll of thermal paper! This fits very nicely into our [Nano Thermal Receipt Printer](https://www.adafruit.com/products/2752). It's ~2.25" wide (about 57mm) and 16 feet long or about 5 meters.

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2755)
[Related Guides to the Product](https://learn.adafruit.com/products/2755/guides)
### 4 x AA Battery Holder with On/Off Switch

[4 x AA Battery Holder with On/Off Switch](https://www.adafruit.com/product/830)
Make a nice portable power pack with this 4 x AA battery holder. It fits any alkaline or rechargeable AA batteries in series. There's a snap on cover and an on/off switch which can be handy when wiring to something without a switch.

**New**! We now have 0.1" headers...

In Stock
[Buy Now](https://www.adafruit.com/product/830)
[Related Guides to the Product](https://learn.adafruit.com/products/830/guides)
### Adafruit Perma-Proto HAT for Pi Mini Kit - No EEPROM

[Adafruit Perma-Proto HAT for Pi Mini Kit - No EEPROM](https://www.adafruit.com/product/2310)
Design your own Pi HAT, attach custom circuitry and otherwise dress your Pi Zero, A+, B+, Pi 2,&nbsp;Pi 3 and Pi 4 (any Pi with a 2x20 connector) with this jaunty prototyping HAT kit.

To kick off the Adafruit HAT party, we have this Perma-Proto inspired plug in daughter board. It has a...

In Stock
[Buy Now](https://www.adafruit.com/product/2310)
[Related Guides to the Product](https://learn.adafruit.com/products/2310/guides)
### 16mm Panel Mount Momentary Pushbutton -  Red

[16mm Panel Mount Momentary Pushbutton -  Red](https://www.adafruit.com/product/1445)
OK, this item is pretty simple - it's a panel mount pushbutton. It's not that exciting, no LEDs, no bells & whistles. But we really like it anyways – look at that lovely rounded shape, that elegant bevel. If you're going to go with a momentary pushbutton, let it be this...

In Stock
[Buy Now](https://www.adafruit.com/product/1445)
[Related Guides to the Product](https://learn.adafruit.com/products/1445/guides)
### 16mm Panel Mount Momentary Pushbutton -  Yellow

[16mm Panel Mount Momentary Pushbutton -  Yellow](https://www.adafruit.com/product/1502)
OK, this item is pretty simple - it's a panel mount pushbutton. It's not that exciting, no LEDs, no bells & whistles. But we really like it anyways – look at that lovely rounded shape, that elegant bevel. If you're going to go with a momentary pushbutton, let it be this...

In Stock
[Buy Now](https://www.adafruit.com/product/1502)
[Related Guides to the Product](https://learn.adafruit.com/products/1502/guides)

## Related Guides

- [reef-pi Guide 2: Power Controller](https://learn.adafruit.com/reef-pi-power-controller.md)
- [DotStar Pi Painter](https://learn.adafruit.com/dotstar-pi-painter.md)
- [reef-pi Guide 7: Dosing Controller](https://learn.adafruit.com/reef-pi-guide-5-dosing-controller.md)
- [Retro Gaming with Raspberry Pi](https://learn.adafruit.com/retro-gaming-with-raspberry-pi.md)
- [reef-pi Guide 4: Water Level Controller](https://learn.adafruit.com/reef-pi-water-level-controller.md)
- [Adafruit Prototyping Pi Plate](https://learn.adafruit.com/adafruit-prototyping-pi-plate.md)
- [Quadcopter Spray Can Mod](https://learn.adafruit.com/quadcopter-spray-can-mod.md)
- [Adafruit IO Connected Animated GIF Display](https://learn.adafruit.com/adafruit-io-connected-animated-gif-display.md)
- [Raspberry Pi radio player with touchscreen](https://learn.adafruit.com/raspberry-pi-radio-player-with-touchscreen.md)
- [Adafruit 16 Channel Servo Driver with Raspberry Pi](https://learn.adafruit.com/adafruit-16-channel-servo-driver-with-raspberry-pi.md)
- [Run an X-Carve CNC Machine Wirelessly with a Raspberry Pi](https://learn.adafruit.com/control-an-xcarve-cnc-machine-wirelessly-with-a-raspberry-pi.md)
- [Basic TensorFlow Object Recognition on any Computer or iOS device with Google Colab](https://learn.adafruit.com/basic-tensorflow-object-recognition-in-the-cloud-google-colab.md)
- [Adafruit 2.2" PiTFT HAT - 320x240 Display](https://learn.adafruit.com/adafruit-2-2-pitft-hat-320-240-primary-display-for-raspberry-pi.md)
- [Adafruit PiTFT 3.5" Touch Screen for Raspberry Pi](https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi.md)
- [Adafruit's Raspberry Pi Lesson 2. First Time Configuration](https://learn.adafruit.com/adafruits-raspberry-pi-lesson-2-first-time-configuration.md)
