Navigation Menu

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

Design

More work »

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
     
     http://www.arduino.cc/en/Tutorial/InputPullupSerial
     
     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)

part2-leftpart4-right
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.

kit

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.

Accessories

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.

part1-left

part3-right

 

 

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
    open-anyway
  6. You may be asked to install a version of Java. Go ahead and click “More Info” to go to the website, download, and install.java
  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

 

part2-right

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