Navigation Menu

A portfolio for an exhibit designer, planner, interactive designer, developer, artist, coder, optimist, and normally too humble of a guy.


More work »

MCN Workshop Part 4

MCN Workshop Part 4

Posted on Oct 30, 2014 in Arduino | 0 comments

On the previous part, we got the GEMMA receiving input from a simple button. Now, we’ll work on only output from the GEMMA to control some fun lights.


  1. First, unplug the GEMMA from your computer.
  2. Then, take out three alligator clips: yellow, red, and black.
  3. Now, attach the clips as below:
    • Yellow from GEMMA DO to NeoPixels IN
    • Red from GEMMA Vout to NeoPixels PWR
    • Black from GEMMA GND to NeoPixels GND
      NOTE: Be careful when you clip. Only get a small bit of the NeoPixel ring. If you put the clip on too far, it may touch other electronics and short out your circuit.neopixel wiring
  4. With the circuit created, now we move to the code.
  5. Start up a new, blank sketch by opening the File menu and choosing New.
  6. Copy and paste the following 124 lines of code.
    #include <Adafruit_NeoPixel.h>
    // constants won't change. 
    #define neoPixelPin 0 //the number of the neopixel pin
    #define numPixelsInStrip 12 
    // Parameter 1 = number of pixels in strip
    // Parameter 2 = Arduino pin number (most are valid)
    // Parameter 3 = pixel type flags, add together as needed:
    //   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
    //   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
    //   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
    //   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
    Adafruit_NeoPixel strip = Adafruit_NeoPixel(numPixelsInStrip, neoPixelPin, NEO_GRB + NEO_KHZ800);
    // IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
    // pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
    // and minimize distance between Arduino and first pixel.  Avoid connecting
    // on a live circuit...if you must, connect GND first.
    void setup() {
      strip.begin();; // Initialize all pixels to 'off'
    void loop() {
      // Some example procedures showing how to display to the pixels:
      colorWipe(strip.Color(255, 0, 0), 50); // Red
      colorWipe(strip.Color(0, 255, 0), 50); // Green
      colorWipe(strip.Color(0, 0, 255), 50); // Blue
      // Send a theater pixel chase in...
      theaterChase(strip.Color(127, 127, 127), 50); // White
      theaterChase(strip.Color(127,   0,   0), 50); // Red
      theaterChase(strip.Color(  0,   0, 127), 50); // Blue
    // Fill the dots one after the other with a color
    void colorWipe(uint32_t c, uint8_t wait) {
      for(uint16_t i=0; i<strip.numPixels(); i++) {
          strip.setPixelColor(i, c);
    void rainbow(uint8_t wait) {
      uint16_t i, j;
      for(j=0; j<256; j++) {
        for(i=0; i<strip.numPixels(); i++) {
          strip.setPixelColor(i, Wheel((i+j) & 255));
    // Slightly different, this makes the rainbow equally distributed throughout
    void rainbowCycle(uint8_t wait) {
      uint16_t i, j;
      for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
        for(i=0; i< strip.numPixels(); i++) {
          strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    //Theatre-style crawling lights.
    void theaterChase(uint32_t c, uint8_t wait) {
      for (int j=0; j<10; j++) {  //do 10 cycles of chasing
        for (int q=0; q < 3; q++) {
          for (int i=0; i < strip.numPixels(); i=i+3) {
            strip.setPixelColor(i+q, c);    //turn every third pixel on
          for (int i=0; i < strip.numPixels(); i=i+3) {
            strip.setPixelColor(i+q, 0);        //turn every third pixel off
    //Theatre-style crawling lights with rainbow effect
    void theaterChaseRainbow(uint8_t wait) {
      for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
        for (int q=0; q < 3; q++) {
            for (int i=0; i < strip.numPixels(); i=i+3) {
              strip.setPixelColor(i+q, Wheel( (i+j) % 255));    //turn every third pixel on
            for (int i=0; i < strip.numPixels(); i=i+3) {
              strip.setPixelColor(i+q, 0);        //turn every third pixel off
    // Input a value 0 to 255 to get a color value.
    // The colours are a transition r - g - b - back to r.
    uint32_t Wheel(byte WheelPos) {
      if(WheelPos < 85) {
       return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
      } else if(WheelPos < 170) {
       WheelPos -= 85;
       return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
      } else {
       WheelPos -= 170;
       return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  7. Save the code somewhere on your computer with a good filename.
  8. Plug in the GEMMA to a USB port on your computer.
  9. While the red light is pulsing, press the upload button to upload the code. If you don’t do it fast enough, press the physical button on the GEMMA to start the connection and press upload.
  10. Hopefully, the NeoPixels will start to light up in many different patterns. Watch for a bit and try to figure out the different patterns.
  11. If nothing is working, check your circuit to make sure everything is tight. If the computer successfully uploaded the code, it should be running. Try un-plugging the USB cord and then plug it back in.
  12. Enjoy the success of getting the GEMMA to output to the NeoPixels. Next we’ll combine the input and output.




Cover photo by Adafruit

Read More

MCN Workshop Part 3

MCN Workshop Part 3

Posted on Oct 30, 2014 in Arduino | 0 comments

Now that we know the goodies in our kits, let’s start to put them to work. The first thing we’ll do is get a button to light up—the stereotypical first thing to do with an Arduino. It’s good for us, because it will confirm all the parts are working without having a super complex system yet.

Simple Push Button Light

  1. First, unplug the GEMMA from your computer’s USB port, if you have it plugged in.
  2. Then, open the Adafruit Arduino software, if you don’t have it open yet.
  3. Go under File and choose New. A blank code sketch will open.
  4. Copy and paste the following 48 lines of code into your new sketch.
     Input Pullup Serial
     This example demonstrates the use of pinMode(INPUT_PULLUP). It reads a 
     digital input on pin 2 and prints the results to the serial monitor.
     The circuit: 
     * Momentary switch attached from pin 2 to ground 
     * Built-in LED on pin 13
     Unlike pinMode(INPUT), there is no pull-down resistor necessary. An internal 
     20K-ohm resistor is pulled to 5V. This configuration causes the input to 
     read HIGH when the switch is open, and LOW when it is closed. 
     created 14 March 2012
     by Scott Fitzgerald
     This example code is in the public domain
    const int buttonPin = 2;     // the number of the pushbutton pin
    const int ledPin =  1;      // the number of the default LED pin
    void setup(){
      //configure pin2 as an input and enable the internal pull-up resistor
      pinMode(buttonPin, INPUT_PULLUP);
      pinMode(ledPin, OUTPUT); 
    void loop(){
      //read the pushbutton value into a variable
      int sensorVal = digitalRead(buttonPin);
      // Keep in mind the pullup means the pushbutton's
      // logic is inverted. It goes HIGH when it's open,
      // and LOW when it's pressed. Turn on ledPin when the 
      // button's pressed, and off when it's not:
      if (sensorVal == HIGH) {
        digitalWrite(ledPin, LOW);
      else {
        digitalWrite(ledPin, HIGH);
  5. From the Tools menu, choose Board, and then Adafruit Gemmaboard
  6. From the Tools menu again, choose Programmer, and then USPtinyISPprogrammer
  7. verify

    The verify button

    Click the small check mark button in the upper left-hand corner of the sketch window. It will verify that the code is accurate. If not, you will see an error message on the bottom.

  8. Save your sketch somewhere that makes sense on your computer with a good filename.
  9. Now get out the GEMMA, the push button, and two alligator clips (one white and one green).button wiring
  10. Clip the white alligator clip to the D2 pin on the GEMMA.
  11. Clip the other side of the white clip one of the metal feet of the button.

    The dashed line represents the electrical connection between the alligator clips and the button. Notice the current cannot flow when the button is not pressed as there is no connection.

    The dashed line represents the electrical connection between the alligator clips and the button. Notice the current cannot flow when the button is not pressed as there is no connection. DO NOT put both clips on the same side of the button.

  12. Now look at the button. The two of the feet connect in a line. This is one side of the button. The other side has a symmetrical line with the other two feet. When untouched, the button stops electricity from flowing from one side to the other. When you press the button, the circuit is completed and electricity flows.
  13. Clip the green alligator clip to one of the feet on the other side of the button.
  14. Clip the other side of the alligator clip to the GND pin on the GEMMA. This stands for ground.
  15. At this point we have the code written and the circuit complete. It’s time to upload the code to the GEMMA. Plug in the GEMMA to your computer’s USB port.
  16. The green power light should be solid. The red light should be pulsing. This is a sign that you can upload code.
  17. By now, the red light is probably not pulsing any more. That means we cannot upload code. First look where the upload button is on the sketch window—the arrow button. Get ready to click this.
  18. First, press the physical button on the GEMMA to start the pulsing red light, opening the door to upload code.gemma button
  19. upload

    The upload button

    Then, quickly, click the upload button on the sketch window. There should be a message at the bottom of the sketch window that the code is first compiling, and then uploading.compiling

  20. If you are having trouble, try unplugging and re-plugging the GEMMA. While it’s pulsing red, click the upload button.
  21. Once it finishes uploading, the GEMMA runs the code.
  22. This one is simple, press the push button you wired. When it is pushed, the red light on the GEMMA should light up. Release, and it will turn off. Try it a few times.
  23. SUCCESS. You have now learned how to copy and paste code, upload code, wire a circuit, and run a program on a microcontroller. Good work. But now let’s do something more flashy. (ugh, groaner pun)

Cover photo by Ali Kholi

Read More

MCN Workshop Part 2

MCN Workshop Part 2

Posted on Oct 30, 2014 in Arduino | 0 comments

Now let’s dig in. You should now have a hardware kit in you hands. Let’s take a look at what is inside.


GEMMA microcontoler

At the heart of our project lies the microcontroller. The GEMMA is a tiny arduino compatible microcontoller. It’s small size and small cost allows us to do fun things. For more information, see the complete guide here. Notice the USB port, battery port, various gold pins around the oustside labeled things like D2 (for digital 2), and a small black push button.

NeoPixel Ring

This is a ring of small lights that we can control individually to produce nearly any color in the visible spectrum. It’s pretty fun. There is also a great guide on how to use them.

Input Devices

There are a few different devices that we can use to record input to the GEMMA. This includes a simple push button, and two vibration sensors of different sensitivities (fast and slow), and a piezo.


There are a few other goodies in the kit too:

  • A USB cable to connect the GEMMA to the computer
  • A battery holder that will hold two coin batteries. But you don’t need to use this at the same time as the USB cable in plugged into the computer. The computer can power the device too.
  • A bunch of alligator clips provide a quick and easy way to connect electrical circuits as we build our system. Eventually, once we have the circuit we want, we will use a more permanent system such as solder or conductive thread.





Cover photo by Adafruit

Read More

MCN Workshop Part 1

MCN Workshop Part 1

Posted on Oct 29, 2014 in Arduino | 0 comments

Welcome to the MCN workshop Dabble with Microcontrollers. This is the first post in a series that we will use during the workshop.

First, we need to download the software we’ll use to code later in the workshop. It’s a little tricky, but once it’s done, you should be able to run all the code we are using today. You will need administrative rights on your computer to install.


Adafruit Arduino Software

We will need a program to develop code. Download the Adafruit Arduino Software. Full instructions are here.

For Mac:

  1. Download the application
  2. Unzip it
  3. Move it to your applications folder
  4. Try opening the programcant-open-from-web
  5. If you are running a newer version of OS X, you will need to change your security settings so that this program downloaded from the internet will run on your computer. Follow the instructions on the Adafruit site.system-preferences
  6. You may be asked to install a version of Java. Go ahead and click “More Info” to go to the website, download, and
  7. You may also be asked to allow incoming connections from the program. Go ahead and choose allow.

For Windows

  1. Things may be a bit more interesting with Windows.
  2. First, we need to install the drivers for GEMMA. Full instructions here. Download Windows XP/Vista/7 drivers here or Windows 8 drivers here. Unzip them to a temporary place you know, like the desktop.
  3. Plug-in the GEMMA and you should get this screen. If not, use the device manager to update the driver.drivers
  4. Click “Browse” to find the folder we unzipped on the desktop. Make sure you choose to include subfolders. Then click “Next.”drivers2
  5. You may get a security warning. You should be ok to choose “Install this driver software anyway.”drivers3
  6. After a little bit, you should get a message that the driver was successfully installed. Click “Close.”Screenshot_2
  7. Now, download the software
  8. Unzip it
  9. Rename the unzipped folder from “windows” to something more useful, such as “Arduino Adafruit”foldername
  10. Move the folder to your programs folder C:\Program Files (x86)\. You may get a permissions pop-up message. Choose “Continue.”userights
  11. Try opening the program C:\Program Files (x86)\Adafruit Arduino\arduino.exe
  12. Make a shortcut to this program if you would like.

NeoPixels Library

We will all need to do this step, regardless of the operating system.

We will be using some fancy flashing lights, called NeoPixels. You will need the code library. This part should work the same on all three platforms.

  1. Find the download button on Github

    Download the library on this page

  2. Look on the right side of the page at the bottom of the column, for the button labeled, “Download Zip”.
  3. Save this file to a temporary place on your computer, like the desktop.
  4. Rename the folder to not have any dashed, only underscores

    Rename the folder to not have any dashed, only underscores

    Unzip the folder and rename it, “Adafruit_NeoPixel”. Notice there are no dashes, only underscores.

  5. Now open the Arduino program.
  6. Choose Sketch >> Import Library >> Add Library…
  7. Navigate to the “Adafruit_NeoPixel” folder and click “Choose”
  8. This will save the library to the proper location on your computer. To make sure it worked, go to Sketch >> Import Library and look for “Adafruit_NeoPixel” in the contributed list at the bottom
Adding the library to the software

Adding the library to the software



Cover photo by John Nussey

Read More

Wearable Tech Hat

Wearable Tech Hat

Posted on Apr 1, 2014 in Arduino | 0 comments

I was inspired by the folks at MCN2013 to try and make my own wearable tech hat. So, I found a tutorial that looked interesting and modified it for myself.  I decided to add a button that would select the light pattern or mic use. That was fun.

Here are some of my quick lessons learned:

  • I used a Gemma instead of a Flora for the Arduino microcontroler. Although they are similar, the Gemma has less features. Know that when planning your project.
  • Adafruit makes it’s own version of the Arduino IDE. Download it here.
  • Microcontrollers cannot multi-task. So, when I added a button to select the pattern of lights, I also added the complexity of code. Check out the Arduino Blink without Delay examples. Basically, I needed to change the code to keep checking if the button had been pushed. I first tested with an Arduino so that I could receive serial messages of variable states. View that code here. I ended up rewriting all of the NeoPixel code examples to follow the blink without delay style of code.
  • It’s easy to get a button to think it’s been pushed many times. Follow the Debounce tips.
  • I need to work on my sewing skills.
  • Gemma has a tiny amount of space allowed for code. So, I was not able to get all of the pieces into one program. There are probably ways to optimize my code. But for right now, I’ve just divided them into two different options. Download the code at the following links:

Also, see a Flickr set of the project development.


Read More