Free Workshop: Earring Exposition




When: Saturday, October 1, 2016, 1:00 pm – 3:00 pm
Where: Arts Area (upstairs) Pumping Station: One 3519 N Elston Chicago, IL 60618

Drop in and make a pair of earrings for yourself or as a gift for someone! This is a very basic form of jewelry assembly, no prior experience is required. Learning this skill may help you financially as the “winter holiday gift season” of various faiths approaches.

Beads and findings will be supplied in nickel-free gold and silver costume metal. Bringing a pair of basic round nose pliers will be helpful if you have your own. Expect total time commitment to be in the range of 10 to 20 minutes. Please limit one project per member so the maximum number of people can participate.

Share this!

NERP Tonite! Improving the Retro Gaming Experience

Ste Kulov is Lead Design Engineer at HD Retrovision. Ste (known in NBA Jam as STE) was born and raised in the suburbs of Chicago and spent most of his childhood with his hands glued to a SNES controller. Like so many life-long nerds, Ste went to school for electrical engineering and became an expert at working with circuits. His passion for working on really cool engineering projects is second only to his obsession with video games. Ste conceived the original idea for HD Retrovision in his engineering design class to solve the world’s most pressing problem: allowing gamers to play their old systems on TV’s that don’t have the right inputs. [NERP Note: HD Retrovision cables are analog circuit devices. The HD Retrovision circuit board is molded into the cable.]

PS:One knows Ste for being a really good teacher. We wish he could find time to do more analog and fpga circuit classes (hint, hint).

A vital aspect of manufacturing is testing and quality control. Someone has to do it, and they need test instruments, test fixtures, custom software, and detailed written test requirements and procedures. Ste had to design a turnkey QC system for use by his contract manufacturer. The HD retrovision circuit itself is all analog, but the QC system is FPGA based. At NERP tonite, Ste will explain how you QC a cable on the other side of the world.

NERP is not exclusively Raspberry Pi, the small computer and embedded systems interest group at Pumping Station:One in Chicago. NERP meets every other Monday at 7pm at Pumping Station:One, 3519 N. Elston Ave. in Chicago. Find NERP and Pumping Station:One at



Doors open at 6:30pm. NERP is free and open to the public. Ed Bennett ed @ kinetics and electronics com Tags: electronics, embedded, NERP, Open Source, raspberry pi, hackerspace, Beagle Bone, Pumping Station One

Share this!

Mandolin Plates on the ShopBot

My name is Ralph, and I’m an amateur luthier and PS:1 “starving hacker”.

I make all kinds of instruments: guitars, ukuleles, bouzoukis, and more, but my favorite thing to build is mandolins.  They are far and away the most difficult instrument that I make, and require a level of craftsmanship not found in the simpler instruments.

There’s only one real downside to building mandolins— the carving.  Mandolin plates are made from 1” thick stock, carved into a very precise dome shape ranging from 3mm thick at the rim up to 6mm thick at the bridge.  Making the plate accurately is the key to getting a good tone from the instrument: too thick and it sounds “dead”, too thin and the top can’t withstand the force of the strings.

To make the plates requires a set of inside and outside templates that show the proper curves (making these templates on the laser cutter was a primary reason I joined PS:1), using carving gouges to get close the the final shape, and then curved planes and scrapers to get the dimensions exact.  There is about 40-50 hours of carving and scraping that go into a set of mandolin plates.  To make things worse, the back plate is made of hard maple, which is VERY difficult to carve.  Even with leather carving gloves, my hands are a mess of blisters and callouses after making a plate.

When I saw the CNC routers at PS:1, I was immediately struck by the idea of using CNC to produce a rough mandolin plate.  Even if I would still need to scrape to get things perfect, the hard carving work (and blisters) would be taken care of by the machine.

Thus began a year-long journey of discovery…

I learned about CAM, and taught myself to use Fusion 360, only to discover that this 3D modeling stuff is HARD.  I managed to turn out some pretty simple models for bridges and headstocks, which I was able to make on the Shapeoko and ShopBot, but every attempt at modeling a mandolin plate failed.

After flailing around for many months, I discovered the Fusion 360 meetup (sponsored by Autodesk and held at PS:1), and everything changed.  With the help of Autodesk’s Michael Aubrey (Fusion evangelist), and PS:1’s resident CAD experts, I improved my skills to the point where I was able to make a reasonable model of the top plate for an A-style mandolin.


Last weekend, I got to test the model on the ShopBot!  The initial version is in MDF, just to test the model and the machining commands.  Once everything is tweaked, I will do the real thing in Sitka spruce.

Since the plate needs to be machined on both sides, I needed to create a fixture to align everything.  It’s a pretty straightforward plate, with two alignment pegs that match holes drilled into the ShopBot wasteboard.  All of the shaping was done with a 1/2” round-nose bit running at 12000 rpm and a chip load of .35mm.

The inside is machined first, referencing the stock top.  It uses a pretty simple adaptive pocket to remove most of the waste, followed by a spiral with a 1mm overlap to take things to the finished size.


You’ll note that the pocket is not centered in the picture— my origin was in the wrong place in my model.  I fixed that, and the second attempt came out much better.  There is still a bit of scraping/sanding to remove the machine marks, but that was to be expected.


After the inside surface was machined, I flipped the workpiece over and re-registered the Z axis to the bottom of the piece.  That way, I know the thickness of the part will be accurate even if my stock thickness is off by a little bit.

Once again an adaptive pocket removed most of the stock, starting with a channel around the rim.


After the rim was rough-sized, the “hump” was roughed in.


A second pass of the adaptive pocket got the rim down to 4mm thick, and smoothed the transitions.


Just as with the inside, the finishing step used a spiral to clean the surface and eliminate the tool marks.  The net result was quite good, and will need only a bit of scraping to finish


After all was said and done I swapped in a 1/8” straight bit to cut the outer profile and f-holes.


Cutting off the excess stock left me with a quite nice-looking mandolin top plate!  Total elapsed time (not counting my initial screwup) was about 90 minutes.


Putting my micrometer to the finished product, the results were better than I expected.  Thickness is accurate within 1mm across the entire profile, with most areas within 0.5mm.  That leaves only a bit of scraping to get things perfect!

Next weekend… the real thing, in sitka spruce.

Many thanks to Michael Aubrey from Autodesk, Ray Doeksen and Andrew Carmadella from PS:1, and all of the Fusion 360 Meetup crew that helped me along the way!  I’m still a modeling rookie, but I’ve come a LONG way with your help!

Ralph Brendler

Share this!

A Light Diversion


In the last days of Radio Shack, I was in a store on Michigan Avenue when I spotted, buried amongst the disassembled shelving units and discarded phone cases, a small red box that turned out to be an Arduino-based soldering project, the 2770158 LED Cube ( I bought it for something like $5, took it home, and promptly put it on the shelf as a project I’ll ‘get to’ at some point.

The honest truth is that I was somewhat intimidated by the soldering; it’s a 3x3x3 cube of LEDs that are soldered together and the lights were smaller than i was expecting, and looking at some pics of the final result, I resigned myself to likely screwing it up and at best hoping that I might learn something from what I assumed would be a complete failure. So I somehow justified to myself that, in order to not waste my $5, I shouldn’t actually try to make the thing I spent $5 on.

At some point I hit myself with a clue-by-four and realized the stupidity of my situation; accept the possible loss of the $5 and actually try instead of fretting about what-ifs. So I took the kit to PS:1, sat down in the Electronics area, got out the soldering iron, magnifying glass, and went to work. It took a couple of hours, and I was certain, absolutely positively certain, that, even though it looked right, there was no chance that I had actually gotten the leads all wired together correctly, especially the ones in the middle that were extremely hard to reach with the big tip of the soldering iron. Okay, well, only thing left was to actually plug it into the Arduino Uno I had, load up the sample sketch (available in the RS GitHub repo above), and see what happens.

I fired up the Arduino IDE, loaded the sample sketch, hit upload, and all of a sudden all the lights came on as it started through the canned routines. I was initially skeptical, checking every single light to see which one was never lighting up, and all of a sudden it dawned on me that I had actually done it, all the lights actually lit up as part of the demo routine, and HOLY CRAP I MADE A THING AND IT WORKED!!!!1111

And then in my excitement I dropped it, ripping the USB cord from the Arduino, and landed lights-down on the floor. Well, of course I did. Of course I broke it, right? But as I checked the connections, nothing had come loose, there were no broken connections. I plugged the Arduino back in, and sure enough, it happily came back to life and started going through the routine. Whew!


So I resolved to make this truly my own; running a demo program that I didn’t write was not ‘finishing the job’. I remembered the QBasic ‘Snake’ program that drew a line bouncing around the screen, hitting the edge and then randomly turning and going off into another direction. Ah, but this is a cube, in threeeee deeeeeeee, so the challenge would be that more interesting, especially as I resolved to sit down and actually try to implement it without any help from the Internet; a three-dimensional matrix of lights, translated into C++.

This is where I remembered a line from Top Gun that went something along the lines of “Our pilots had become dependent on missiles” as a reason for loss of dogfighting ability. (And then I got that Everly Brothers song stuck in my head). Well, writing C++ for years, I had become dependent on the containers provided by the Standard Template Library (map, vector, etc.). While the Arduino is programmed using C++, it’s really a pretty small subset of C++ (which sort-of-kinda-not-really makes sense) and the STL is not available; go ahead and #include <map> all you like, all the compiler’s gonna do is complain. So I knew I’d have to regain some amount of dogfighting capability and do all the array/matrix stuff in pure C. So I decided the best way to keep myself honest and regain some of the skills I think I used to have, I created a C file in Vim (using Emacs always made me angry, straight-up I hate this, whatever this is), wrote the program, saved, compiled and ran straight from the terminal prompt. Again and again and again.

One of the biggest problems was forcing myself to get past the ‘sheesh, this woulda been easy to use <insert some STL thing> here’ and just focus on getting the values in the right cells of the matrix. It took a few hours to get the algorithm right, but pretty soon I had it spitting out numbers that seemed right, but how was I gonna know that it was right?

This is where I decided to make a quick diversion and build a virtual version of the matrix in OpenSCAD:


Using this model, I could walk through the output of the program and verify that the snake was truly moving correctly around the matrix. I rotated the model around, checking that the numbers were right and HOLY CRAP I MADE ANOTHER THING THAT WORKED!


The last thing to do was to actually get the program to work with the LEDs. This is where the spartan documentation of the original Radio Shack code became a problem; the sketch did a passable job of explaining how the lights were addressed, but the examples were all arrays of pre-baked values without having to do anything dynamic, and my program was all dynamic. I studied how the demo program worked, started fiddling with the values, and discovered how to set the bits in the right way to turn on individual lights, on specific levels. From there I modified my C program and added some code to translate my positioning, which turned out to be the mirror opposite of the way the lights are addressed; I solved the problem by physically turning the Arduino around so I was looking at the other side. Problem solved!)

I uploaded my sketch to the Arduino and it suddenly the lights were lighting up in what appeared to be a snake moving around the matrix. HOLY CRAP I GOT IT TO WORK!!!!!!11111


This is a long post for what amounts to a small light toy, but whilst I was feeling rather verbose (a consequence of sitting and waiting for an unrelated program to finish), I can’t emphasize how foolish I feel for not starting all this earlier; fear of failure is a very, very powerful emotion and if there’s a TL;DR in here somewhere, it’s that it is always better to try and fail than to never try at all, which is something PS:1 has done a very good job of teaching me.


The code is available at

Share this!

Spacecats Rocket Build!

A good friend of mine had the vision to make a memorial to lost cats at Burning Man 2016. It would be a whimsical project with a deeper side to it to honor our fallen feline companions.  To see more of what is behind the project can go to see the Spacecats Indiegogo at . I was asked by her to assist with creating the rocketship part of the project for the intrepid spacecats. I just starting doing CNC work this year and leaped at the opportunity to further improve my skills with a big project. Over a period of 2 months many models were created to arrive at the final form. I will detail the workflow for this and share some of the iterations!

It all started with Fusion 360, a great program for makers, to create a basic rocketship model. Well, I thought it was basic but my inexperience made it a bit harder than expected and went through many hours of “learning time” to arrive at a model I was happy with. From making the 3d model in Fusion 360, I then took it to 123d Make to have it piece together in radial slices so that it can be put together in real life! With the parts generated from 123dMake I was able to create some laser models to show my friend and get her input for her vision. As you can see it took about 4 times to get it right. These models were done 1:10 scale then 1:7 scale. it really helps to have something in front of you to decide what will look best.


After finally arriving at a model that was good it was time to bring it to the shopbot for a 1:2 model (that is also one of the indiegogo rewards!). There was much dialing in to make sure that the slot fit was tight but not too tight to be able to fit the pieces together.  Found that adding in .01 helped immensely to get the perfect fit. I did many test notch pieces to ensure the fit. One problem I had was making the test pieces too small so it did not get the full effect of sliding all the way into the wood. I found that making them larger really helped. It paid off to prototype and make test pieces , saved me from wasting many materials , especially when I moved to the more expensive wood!  Finally, we had something that the Spacecats seemed somewhat happy about – other than that orange tabby Floyd at least!


Also learned how to use a V bit for this project , very challenging to get the right font in so that it looks nice but was not too thin. This is the plate with the names of departed cats.


And finally , was able to do the full-size model that will go out to burning man! They were displayed at an event last weekend that was a Hawaiian luau, they seemed pretty pleased with it if I do say so myself!


Thanks to everyone at PS:One for the patience to answer many of my questions and excessive use of the shopbot to dial this project in 😀

If curious about the indiegogo project and the other elements of the installation can check out the page at Spacecats . And if going to Black Rock City this year, look for some spacecats in the deep playa!

Share this!

How to Wear a Cabochon with an Irregular Shape



Now that members have made a bunch of fused glass cabochons this week, what can we do with them? You can make several cabochons and mount them on your own Medieval style gemstone covered book, hot glue it onto your stapler at work and really establish that one is yours, make some really shiny refrigerator magnets but jewelry is the most common application.

I encased my cabochon in a mount by free form hand weaving seed beads. This piece used different stitches and a strong nylon mono-filament thread. The beads are 11/0 size Czech glass and 15/0 size Japanese Miyuki glass. I encased the whole cabochon because the back of the fused glass was rough and uneven.




Other methods to make jewelry with a cabochon with an irregular shape are:

  • You can stitch bead embroidery around the cabochon securing it onto a backing of leather or heavy fabric. This will be similar to my example but simpler in its execution.
  • Glue on a bar pin back to wear it as a pin.
  • Glue on a bail to wear it on a chain or cord. There are many colors, sizes and shapes of ready made jewelry bails.
  • Wire wrap the cabochon with jewelry wire.

Given the resources we have at the space, someone could even 3D print a setting for their piece and then cast it in metal!






Share this!

The Joy of Melting Glass in a Microwave Oven



Samuel and Sylvia Sion brought in to last night’s member meeting an amazing impromptu class on fused glass. Glass usually has melting points higher than metal, yet there are these new miniature kilns that work inside of a conventional microwave oven! This makes fused glass work far more accessible and affordable from past days of using a larger plug-in electric kiln for hours. The time to melt an art glass cabochon was usually under five minutes with about 45 minutes needed for cooling. The larger kiln fit several pieces at once.

The microwave being used for glass fusing needs to be dedicated to art use only and never used for food again. (Cadmium and other pigments used for colorants are toxic, so this is a needed safety precaution.) Care needs to be taken to not overheat the microwave and destroy it, so letting the door stand open and the unit cool off between rounds of fusing glass is needed. Also, microwave kiln shelf paper needs to be placed on the base of the kiln to keep glass from melting onto the surface the kiln and destroying it. Heavy weight welding gloves worked as oven mitts to transfer hot kilns and the kilns rested safely on our ceramic fire bricks to cool.

Glass specifically made for fusing needs to be used for projects, like the brightly colored Dichroic glass example I made below. Dichroic and fusing glasses are the shiny, beautiful art glass pieces you always see in jewelry at art fairs. The price for making them yourself is very reasonable with this new method; you can buy enough to make several pieces for $20-$30. The kilns and tools to get started are being added to the small metals area and will be available within the following weeks.



Share this!

July Beer Church

The opening round
The opening round

In this month’s edition of Beer Church, the bombers flowed smoothly as we started off with the beer tasting:

After several rounds of tasting, we headed to Brew & Grow to start on our Brown Ale.  If you’ve never gone to Brew & Grow, this brew shop will have everything you need to start your own batch of beer from start to finish.


Gathering our ingredients entailed grabbing a cart with a bucket and scale attached and digging through our recipe book to catch all of our various grains needed for the mash.  We also grabbed some yeast and hops pellets to finish up our collecting.  Of course when you go to Brew & Grow you can sample some of their brews while you shop.

Wort Prep
Wort Prep

While the wort was being prepared I then decided it was grilling time!

Roll burgers into balls
Roll burgers into balls

Using a 75% / 25% fat mix, the beef was rolled into giant meat balls for smashing.

Smash into patties
Smash into patties

Once the burgers are made into balls, it’s time to smash them down and evening out the edges to make solid patties that will not disintegrate or crumble on the flame.  Salt, pepper, cajun seasoning were added on both sides of the burger.

Grill, flip only once and add cheese
Grill, flip only once and add cheese

Once the charcoal (which was started before the burgers were started) turns white, the lighter fluid should have burnt off and the grill is ready for use.  Toss on the buns to toast them but pay attention or they can scorch to a crisp.  Toss on the burgers with a spatula and note that the center is the hottest area so burgers are susceptible to scorching if you’re not careful.

Medium Rare
Medium Rare

Add condiments if necessary, and avoid shrinkage by removing the burgers before they are charred to a crisp.  Grill flame can get up to 500 degrees, so watch out or you or your food may get burnt!


Back in brewing land, while the mash was settling, the kettle was loaded with water and lit to reach 190 degrees.


After letting the wort settle, it was time to separate the sugars from the grain.


In sparging we rinse the grain with hot water that is about 170 degrees, using the wrong temp can result in unwanted consequences!


After the wort is in the kettle we turn back on the turkey fryer in order to begin the sterilization process and killing off bacteria.  As we mix the wort with a giant paddle, the heat coming from the turkey fryer singes everyone’s shins.

Pumping wort to carboy

Once the wort is heated up, we then cool it down by pumping cold water through the copper coils to bring the temperature back down.  Once the temperature drops, we then pump the remainder  through a tube into the carboy.

Here our decision to use pellet hops cause a lot of blockages in the tubes.  Using a mesh or filter bag on the pellet hops may have prevented some blockage but we were able to get most of the wort out into the carboy and did not smash it.

The ring of shame
The ring of shame

From last Beer Church we got to this final end stage and this handle failed causing the carboy to fall and smash all over the shop floor.  We were not to be tricked again and employed a harness setup to prevent any dropping.

Overall another successful Beer Church, we now have beer in progress which will be ready to be tapped soon.  Next iteration will use Creeping Charlie as the bittering agent in lieu of hops so it will be interesting to see how these two beers compare when it’s time.

If you are interested in beer or brewing, make sure to stop by next month’s edition of Beer Church!

Share this!

Configuring Pi 3 with a TFT touchscreen and GPIO buttons

A while back I built a pair of sound-reactive LED towers which were on display a few times, at some local Chicago events.

To plug into the DJ mixer output required a relatively expensive device to get the stereo signals (with external gain control) seen by a computer running as a microphone input.  Also, it was a relatively bulky affair to have yet another laptop sitting next to the mixer when the artist wasn’t using it to make the music.

Recently I discovered that starting with the 3.1 release, Processing can now run on a Raspberry Pi and has built-in ability to manipulate the GPIO ports.  This blog entry highlights the release.  This is exciting news as now the laptop can be replaced by a Pi 3 with a small touchscreen.

Here is a video of the light towers in action.

The towers each have 8 panels with 60 individually addressable RGB LEDs.  These pictures show off more of the visual esthetic and the cutaway view reveals something of the construction.  The LED strips are hidden in a channel in the wood supports which side illuminate acrylic panels (backed with just a strip of white cardboard).  The acrylic is impregnated with a diffuser which reflects the edge-lit light 90 degrees to exit out of the faces of the panels.  The white cardboard reflects the 1/2 of the light that would otherwise be directed inwards.   The acrylic is produced by Evonik and is called Acrylite EndLighten.  The towers themselves only require 110 VAC power.  The data frames to control the LED strips are sent wirelessly from the processing script using an Open Pixel Control  module which maps points on the processing screen into frames sent to a Fadecandy server running inside a OpenWRT Wifi device which is then physically connected to a Fadecandy board.  I used TP-Link TL-MR3040 WiFi devices to run OpenWRT and added the Fadecandy server application into the img file used to reflash the WiFi devices.  The Fadecandy GIT repository can be found here.

IMG_1689 IMG_1682

This is the assembled Raspberry Pi 3 w/ 2.8″ TFT Capacitive Touchscreen mirroring the HDMI frame buffer in a Zebra case without the top cover.

Pi 3 w/ 2.8" TFT Capacitive Touchscreen HDMI framebuffer

There were a lot of possible paths to follow in getting this build working the way I wanted it to be.  Most of my Google searching turned up outdated examples, particularly due to the changes introduced in the 4.4 kernel with /boot/config.txt use of overlays.  Adafruit had this very nice looking tutorial of how to get the touchscreen working with their version of the Jassie Raspbian os image.  The inclusion of how to use FBCP was of particular interest as mirroring the HDMI output is important for displaying processing scripts with the 2D or 3D graphics libraries.  Their Raspbian image was based on an older kernel and updating the os (sudo apt-get update; sudo apt-get dist-upgrade) turned out not to just work.

After much tinkering, these are the steps that worked for me.  (note that I working with OSX 10.11)

  1. Download the latest Raspbian Jessie image here.
  2. Extract the .img file using “The” as opposed to the built-in “Archive” as I saw many comments that the default app caused issues.
  3. I chose a 32GB Samsung EVO Plus (model MB-MC32D) micro SD.  It has a red background.
  4. Flash the SD card with the extracted image file.  Instructions for doing this can be found easily.  I used the following procedure:
    • open a terminal window and change to the directory with the extracted image file
    • $ diskutil list
    • note the device path of the SD card (eg: /dev/disk4)
    • unmount the SD card, replace disk4 with what was discovered in the previous step
    • $ diskutil unmountDisk /dev/disk4
    • flash the SD card, again update rdisk4 and also make sure the if= filename is correct
    • $ sudo dd if=./2016-05-27-raspbian-jessie.img of=/dev/rdisk4 bs=1m
    • this will take at least 5 minutes to complete, but it is possible to see some status without interrupting the transfer, by pressing ctrl-t
    • exit the terminal window and eject the SD card
  5. Insert the SD card into the Pi and hook it up to an HDMI monitor.  You will need a keyboard and mouse as well.
  6. Open a terminal window
    • disable power management for the onboard WiFi module for stability
    • $ sudo nano /etc/network/if-up.d/wlan0
      iwconfig wlan0 power off
    • $ sudo chmod +x /etc/network/if-up.d/wlan0
    • $ sudo raspi-config
    • select Expand Filesystem and reboot
  7. Configure the WiFi as usual from icon at the top of the desktop
  8. Open a terminal window
    1. install updates
    2. $ sudo apt-get update
    3. $ sudo apt-get dist-upgrade
    4. install build utility
    5. $ sudo apt-get install cmake
    6. fetch the FBCP source, compile and install
    7. $ git clone
    8. $ mkdir ./rpi-fbcp/fbcp/build
    9. $ cd ./rpi-fbcp/fbcp/build
    10. $ cmake ..
    11. $ make
    12. $ sudo install fbcp /usr/local/bin/fbcp
    13. configure the touchscreen by uncommenting, changing or adding the following config entries
    14. $ sudo nano /boot/config.txt
      # match console size
      # force 640x480 VGA on HDMI
      # 2.8" Capacitive 320x240 Touchscreen
    15. expose touchscreen events
    16. $ sudo nano /etc/udev/rules.d/95-ft6206.rules
      SUBSYSTEM=="input", ATTRS{name}=="ft6236", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen"
    17. select an easier to read console font
    18. $ sudo dpkg-reconfigure console-setup
      • UTF-8
      • “Guess optimal character set”
      • Terminus
      • 6×12 (framebuffer only)
    19. remove extra GLES library see this issue
    20. $ sudo aptitude remove libgles2-mesa
    21. install processing
    22. $ curl | sudo sh
    23. disable auto monitor-off
    24. $ sudo nano /etc/lightdm/lightdm.conf
      xserver-command=X -s 0 -dpms
  9. Reboot

The touchscreen should now display the 640×480 desktop scaled down to the 320×240 PiTFT screen.  This makes things look less crisp but has the advantage that connecting to an external HDMI display will work and that most apps need the larger dimensions be usable.  Note that many HDMI displays will not be able to handle a 320×240 HDMI signal.

FBCP stands for frame buffer copy, which rescales and mirrors the HDMI framebuffer (/dev/fb0) onto the PiTFT framebuffer (/dev/fb1)

The version of the 2.8″ PiTFT I got from Adafruit, comes with 4 buttons and I created this test Python script to demonstrate not only how to use the RPi.GPIO library, but how to manipulate the PiTFT backlight (so as to not burn-in the screen), use multi-threaded event handlers, and shutdown the os to safely disconnect the power.

I created this script as: /home/pi/  (chmod +c to make it executable) and test by typing ./  Note that pressing the bottom right button (#27) will ask for authentication for powering off the Pi.  See below to set this script running as a service, in which case, the user will not be asked for authentication.

#!/usr/bin/env python2.7

# example code tested with Pi 3
# Raspibian Jassie (4.4 kernel):
# Adafruit 2.8" Capacitive Touchscreen:
# for running on startup see:
# make sure to update the ExecStart= entry in the Adafruit script after copying from the example

import subprocess
import time
import RPi.GPIO as GPIO

# list of BCM channels from RPO.GPIO (printed on the Adafruit PCB next to each button)
channel_list = [17, 22, 23, 27]
backlightOn = True

# event handler to toggle the TFT backlight
def toggleBacklight(channel):
    global backlightOn
    if backlightOn:
        backlightOn = False
        backlightOn = True

# event handler to manage button presses
def buttonEvent(channel):
    startTime = time.time()
    while GPIO.input(channel) == GPIO.LOW:
    print "Button #%d pressed for %f seconds." % (channel, time.time() - startTime)

# event handler to manage Pi shutdown
def poweroff(channel):
    startTime = time.time()
    while GPIO.input(channel) == GPIO.LOW:
    if (time.time() - startTime) &amp;amp;amp;gt; 2:['poweroff'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

# initialize GPIO library
GPIO.setup(channel_list, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(18, GPIO.OUT)
backlight = GPIO.PWM(18, 1000)

print "Button #17 exits."
print "Button #22 toggles the TFT backlight."
print "Button #23 displayed the time the button is pressed."
print "!!! Pressing button #27 for at least 2 seconds, powers down the Pi !!!"

GPIO.add_event_detect(22, GPIO.FALLING, callback=toggleBacklight, bouncetime=200)
GPIO.add_event_detect(23, GPIO.FALLING, callback=buttonEvent, bouncetime=200)
GPIO.add_event_detect(27, GPIO.FALLING, callback=poweroff, bouncetime=200)

    GPIO.wait_for_edge(17, GPIO.FALLING)
    print "Exit button pressed."


# exit gracefully

To install as a service,

# pitft_buttons service file, start a daemon on startup
# file: /etc/systemd/system/pitft_buttons.service

Description=Start PiTFT buttons daemon

ExecStart=/usr/bin/python -u /home/pi/


Run a processing sketch from a script or from a terminal window or ssh session.
$ DISPLAY=:0 processing-java –sketch=/home/pi/HelloWorld –present

Share this!