ARTIST Jacob Waites
Python & UNIX Programming
ABOUT THE PIECE
Pi2GO is a free-floating hand built camera with acrylic abstraction lenses. Powered by a Raspberry Pi, found objects, a donated 1.4 megapixel webcam, a DC motor, and an external cell phone battery, Pi2GO provides a wireless, compact, and versatile way to create abstract digital images utilizing a variety of acrylic abstraction effect lenses. A DC motor hooked to a plastic pulley spins a lens wheel at random when the silver button on the camera is pressed, creating even more variety in the photoseries. A challenge that I had made for myself in this project was to be sparing in the use of bought items. Everything in the project except for the Raspberry Pi was either scavenged, donated, or crudely hacked off of something else.
The Pi2GO features a living hinge on its side, which allows for insertion and removal of the power supply, which can be any 5V power supply (most cell phone "backup batteries"). The situation called for a minimal latch mechanism, so I thought that the living hinge's practically non-existent profile was the proper fit for the situation.
Accessing the power supply's USB Port is as simple as pressing in on the hinge, the hinge's natural strength holds in the supply until compressed.
When it's time to recharge the supply, removal is accomplished by pivoting the hinge outward and sliding out the battery.
SOME SAMPLE IMAGES
A caveat to this project is that whilst planning, I actually ended up shorting a pi by sending 5V back into my GPIO board on accident (lesson learned). Subsequently, this also ended up frying my much nicer camera board. So while image quality is fairly poor with the on-board 1.3 megapixel camera, the photos produced exhibit near complete abstraction when overlayed with the acrylic lenses and brought a different meaning to the project. Rather than just making a tool to take photos, I set out to make more of a tool to abstract images. When viewed in series, these samples manifest the ideas of how digital representations of photos, paintings, and other images can be broken down to just colors and shapes by means of both intentional abstraction and mechanical interpretation.
The code behind Pi2GO is fairly simple, it utilizes python and bash scripting to take photos using the fswebcam applet installed
onto the raspberry pi. A simple python listener function is launched on boot using cron that reads for input from a button hooked to one of the GPIO board pins on the pi, and utilizes the os library to run another python script when false. This script sets into motion another UNIX command to tell the webcam to take a photo and store it. The script is even modified to light an LED while the image is being processed for general feedback.
The button script, as shown here, is dormant until false:
import RPi.GPIO as GPIO
import time, os
GPIO.setup(8,GPIO.IN) #Set our pin for our button as an input
GPIO.setup(10,GPIO.OUT) #Set the LED pin as an output
if (GPIO.input(8) == False): # So, if the button gets pressed,
GPIO.output(10,True) # light up the LED
os.system('sudo python /home/pi/py-scripts/py-insta/takephoto-wc.py')
# Run the photo-taking script
time.sleep(1) # let the photo process
GPIO.output(10,False) # and don't forget to turn off the LED
Moving to the photo-taking script, we can see that it is simply a python script that runs a UNIX command using the os library:
import os, time
cmd = 'fswebcam -r 2000x2000 --no-banner --no-title -d /dev/video0' # Define the command to be executed
cmd += (" /home/pi/py-scripts/py-insta/images/p_%d%m%y_%H%M") +'.jpg'
# Concatenate the file pathway and datetime information into the string
os.system(cmd) # Initiate the command and take the photo
print("photo taken") # Give inline feedback
time.sleep(1) # let the photo process and give the button a break.
As for the DC motor, no code is needed, when supplied with 3.3v of power from the GPIO board and hooked to a button, it is adequately powered when pressed.
After fiddling with the MCP3008 analog to digital converter, I devised a way to create a light meter for the camera using a small photosensor, measuring the voltage yeilds a light level, and could effect the fswebcam's exposure attributes to properly expose photos in dynamic light settings utilizing a conditional and string concatenation. When going to implement this however, I noticed that I wouldn't have possibly had enough room on the GPIO board for the connections needed for the ADC. Real-estate inside the case was also a discouragement, as the webcam's extra USB cabling is definitely taking up too much space. After having a Pi short out due to a careless error and managing to damage my more high definition camera board, definitely means higher quality photos are a desirable thing for the future.