Preparing Gimp files for machine knitting

This tutorial assumes you’re working on a PC and have no background in digital imaging.

Finding your image

  1. Open up a web browser like Firefox or Explorer and find a simple, high-contrast image.
  2. When you find an image you like, right-click it and “save image as”.
  3. Keep track of where you save.  Saving to the Desktop makes things easy to find.

Modifying your image

  1. Click on the start button in the lower left corner of the computer screen.
  2. Type in “gimp” and click on the program when it pops up.
  3. In the menu, navigate to FILE > OPEN and select the image that you downloaded.
  4. IMAGE > SCALE IMAGE and change the width to 60px.
  5. Press the number keys to zoom in and out.  Try 4 to start.
  6. COLORS > BRIGHTNESS/CONTRAST and move the sliders until you have almost no greys left in the image.
  7. COLORS > POSTERIZE and enter 2 for the number of colors.
  8. Select the paint bucket tool.  This will bring up some options in the vertical window on the left.  For fill type, select pattern and select one of the dot patterns we discussed in the lecture.
  9. Fill all black areas with the dark pattern and all white areas with the light pattern.

Saving your image

  1. FILE > SAVE AS to save a Gimp version of your project.
  2. Insert a USB thumb drive into the computer.
  3. FILE > EXPORT and pick JPEG from the drop-down menu.
  4. Save this file to the thumb drive.
  5. Make sure to eject the drive safely.  Ask for help if you’re not sure how to do this.
  6. Now go knit!

RoboKnitting Workshop @ HWL Innovation Lab, Chicago

Back due to popular demand!  Dieter Kirkwood and I are running a knitting workshop at the Harold Washington Library Innovation Lab every Tuesday evening in March.  Participants can transfer a simple digital image to an 80′s-era knitting machine via img2track software.  See workshop calendar to sign up – seats are free but limited.

See the results of the first set of workshops here.

Hardening a headless RPi to run an infinite script

Though a Raspberry Pi can act like a conventional desktop computer, my RPi projects are generally “headless”, in that no monitor, keyboard or mouse are present.  This means that we must “harden” the system settings and code to be self-starting and fault-tolerant.  Here are the steps I took to ensure that my CTA bus tracker could run indefinitely without user input.

  1. Set the default user “pi” to automatically log in on power up.
  2. Follow these instructions to daemonize your script.  This allows it to run as a service, which is easier to monitor and restart.
  3. Install and configure Monit to resurrect the daemon if it dies.  A script can die/exit unexpectedly if it encounters an unhandled error.  It’s good practice to take care of these errors within the script itself, but I kept getting occasional script exits despite my best efforts.  Here’s a nice little python tutorial about exceptions.
  4. sudo nano /etc/kbd/config and search for BLANK_TIME=30 and POWERDOWN_TIME=30.  Change both values to zero (meaning never).  This prevents the Pi from falling asleep.

Update:  I’ve been chasing bugs for a month, and I’ve finally got 24 hours of up time according to Monit.  I think the problem had to do with the python requests module.  I added a timeout to each URL request, allowing the loop to continue even if the CTA server is acting up.

SSH Between OSX and Raspberry Pi

Use SSH so you can operate your Pi in “headless” mode:  no monitor, keyboard or mouse required.  Adafruit has covered this at length, but here are my personal notes on one page.

From RPi

  1. Connect RPi to modem via Ethernet cable.  Connect a keyboard, mouse and monitor too.
  2. Power on the RPi.
  3. If it’s your first time booting, you can search through the setup menu to enable SSH.
  4. If you’ve already booted up before, open up the Terminal application and type sudo raspi-config
  5. SSH > Enable

From OSX

  1. Connect your computer to the same network (wired or wireless).
  2. Determine the IP address of your RPi.  Steps will vary based on your modem.  If I type the IP address on the side of my modem into a web browser, I can find an option to list all device IPs that are currently connected.  Here’s another method that I haven’t tested.
  3. Open the OSX terminal (Applications > Utilities).  Be aware that you can do some major file/systems damage if you’re not careful.
  4. Type  ssh [device IP] -l [device name] .  Replace the bracketed text and delete the brackets.  The RPi is named “pi” by default.
  5. When prompted, enter the RPi password.  It’s “raspberry” by default.  You won’t see any cursor activity as you type – this really confused me the first time around.

CTA Bus Tracker

Let’s make a custom “clock” that constantly checks and updates the arrival times for the bus outside my house.  You’ll need to apply for a CTA API key to make this work.  I’ve run my clock for about 12 hours total, will update if I find reliability issues.

Materials:

  1. Raspberry Pi
  2. Pi power supply
  3. Wifi dongle
  4. 7-segment LED “backpack”

gpio-pinout-rev2

Wiring (Backpack to Pi Rev2).  If you look at the Pi with the SD card facing up, you’ll see GPIO pin #1 marked at upper right as “P1″.

  1. D >> SDA
  2. C >> SCL
  3. + >> 5v
  4. - >> GND
  5. IO >> 3.3v

Now follow this tutorial to get all your libraries in place.  Once everything is wired/updated, try entering the following 3 commands into the terminal:

IMG_1265

If that works then you’re ready for the last step.  Download this python script on Github.  Follow these instructions to get your Pi to automatically run the script on startup.  Enjoy!  Will update soon with pictures/CAD files of the finished housing.

About Controlled Feeding Status

Controlled Feeding Status
Nutraloaf recipe, metal, glass, polypropylene, velvet
2013

Controlled Feeding Status is comprised of two objects.  The first, a set of 3D printed flatware, sits on a velvet cushion inside a glass vitrine.  The second is a recipe for Nutraloaf, a completely tasteless food product that is used as a behavior modification tool in some American prisons.  In 1999, inmates at TAMMS Correctional Center argued that Nutraloaf constituted cruel and unusual punishment.  Judges on the case noted that while a calorically restricted diet is prohibited, Nutraloaf is nutritious and therefor legal (if unappetizing).

Before the advent of pottery, no human lacking healthy teeth could survive into adulthood.  Cooking pots softened food, and allowed those with poor dentition to persist and reproduce.  When chopsticks arrived 900 years ago, the average Chinese jaw adopted an overbite that would spread worldwide with the popularization of the fork.  It seems that no assistive tool can be introduced without reinforcing or creating some unintended frailty in the body (more…).

Spices, originally used to slow food spoilage, now serve a sensual purpose.  Salt, once so valuable that soldiers received it as payment, is now so common that modern eaters must work to avoid it [1].  Contemporary cuisine repositions food as mental, rather than tangible, sustenance.  This inversion of function is so complete that many first-world consumers find their physical health threatened by an overabundance of things to eat (more…).

Rube Goldberg, like so many artists of his era, responded to global crises with dark humor.  Emergencies such as war or hunger are too stark to face head-on, and can often be more effectively discussed through absurdity.  In his Pulitzer Prize winning cartoon from 1948, Goldberg depicts a family whose house is built upon a teetering atomic bomb.  Similarly, Controlled Feeding Status points to the dysfunction of consumption by interrupting the most basic tool with which we engage that system.

Additional sources:
[1] Kurlansky, Mark. Salt: A World History. New York: Penguin, 2003. 12. Print.