Pedestrian Crosswalk Button: Electronic Prototype

Design Challenge:

For this week’s assignment we had the chance to explore different aspects of physical computing and visualization using Arduino and Processing. Because there was such limited time for this assignment (the usual one week turn around), those with little to no prior experience in programming in a high level language, like myself, got the opportunity to build their skills by following and building tutorials or example Arduino projects available online.

I started with walking through some of the basic tutorials on Arduino’s own site. When, I felt more confident that I could do something more challenging, I began to look for additional projects online.

Working on some tutorials

Working on some tutorials

Since I learned how to create a working button for input and how to blink various LED lights on the Arduino, I decided it might be fun to simulate a traffic light using three LEDs. I found a tutorial for just that on http://www.makeuseof.com/pages/getting-started-with-arduino-a-beginners-guide. To take it a step further, I added a button and additional indicator LED to simulate a pedestrian crossing button that would initiate a change in the lighting sequence.

Prototype:

Photo description from left to right: Attempting to connect my Arduino prototype to an actual traffic signal light, Circuit setup, Green light on and button pressed, Clicking the button turns blue indicator light on and changes the light to yellow, after 2 seconds the light changes to red, When green light turns back on the blue light indicator goes off to indicate that it’s no longer “safe to walk”.

Although I didn’t design the circuits or write the code myself, I found that wiring up the circuits and making the code myself was challenging, frustrating, exciting, and valuable for learning how to break things down step by step, visually chart out things out, and think through a process. It was also nice to think tangibly and use my hands.

Classmates, Aniket and Tarhata, helping me debug the code.

Classmates, Aniket and Tarhata, helping me debug the code.

Code:

 

// I used a blue led as a visual marker that the switch was activated. Just replace it with the extra red led you have in the arduino kit.

int green = 13;

int yellow = 12;

int red = 11;

int blue = 8;

int button = 2;     // button connected to pin 2

int reading;        // current reading from button

int previous = LOW; // previous reading from button

int state = HIGH;    // changelights function initially off


// the following variables are long's because the time, measured in miliseconds, will quickly become a bigger number than can be stored in an int.

long time = 0;         // the last time the output pin was toggled

long debounce = 200;   // the debounce time, increase if the output flickers

void setup(){

pinMode(green,OUTPUT);

pinMode(yellow,OUTPUT);

pinMode(red,OUTPUT);

pinMode(blue, OUTPUT);

pinMode(button, INPUT);


digitalWrite(green, HIGH);

digitalWrite(blue, LOW);

}


void changeLights(){

// green off, yellow for 3 seconds

digitalWrite(green,LOW);

digitalWrite(yellow,HIGH);

delay(3000);


// turn off yellow, then turn red on for 5 seconds

digitalWrite(yellow,LOW);

digitalWrite(red,HIGH);

delay(5000);


// turn off red and yellow, then turn on green

//digitalWrite(yellow,LOW);

digitalWrite(red,LOW);

digitalWrite(green,HIGH);

delay(500);

digitalWrite(blue,LOW);

}


void loop(){

// read the value of the switch

reading = digitalRead(button);

  // if the input just went from LOW and HIGH and we've waited long enough

  // to ignore any noise on the circuit, toggle the output pin and remember

  // the time

  if (reading == HIGH && previous == LOW && millis() - time > debounce) {

      digitalWrite(blue, HIGH);

      changeLights();

    time = millis(); }

  previous = reading;

}

What I learned:

As physical products become increasing embedded with digital technology, I definitely see an advantage of being able to prototype quickly and relatively cheaply (<$50 to get started) using Arduino.

Pros & cons of electronics prototyping using Arduino:

  • Electronics prototyping isn’t easy. It takes a lot of patience to troubleshoot both software and hardware. Sometimes, just one miss pin or damaged resistor can prevent the whole thing from functioning. However, mapping things out on paper helps a lot for documenting and double-checking your work when you need to troubleshoot.
  • When working with hardware stability matters. Our basic Arduino starter kits were considered low stability since wires were sometimes uneven, easily displaced, and or accidentally disconnected, etc. Simply transporting the prototype from one location to another felt risky at times because small, unnoticed changes could break the prototype and require additional troubleshooting. Higher stability hardware prototypes might involve more work such as soddering wires together to prevent loose connections from falling out, so depending on how stable a prototype you’d require the investment might be worthwhile.
  • Tools that have great online resources and active communities help. It’s really amazing what you are able to prototype using the Arduino and having a vibrant community online that is generous with sharing tips, tutorials, advice, and ideas is crucial because you can easily find the support you need. There is also a cross-pollination affect that allows people in the community to mutually build off of each other’s ideas. This is the beauty of open source. However, on the flip side, I did learn that not all information and tutorials are created equal. The extremely open nature pretty much allows anyone to post anything, and there are definitely some posts and tutorials that are better or less error prone than others.

While I felt I learned a lot in the process of building my own prototype, I learned the most during the show and tell session during our in class critique. I was blown away by everyone’s creative use of different sensors and actuators. I hope my classmates learned something from me and my project as well.

These two weeks have also been an excellent exercise in understanding what I’m good at and passionate about, and when to reach out to collaborators and teammates for help. I learned that even though I don’t consider myself a programmer, or find joy in troubleshooting and coding, there are others that actually do! And they are willing to teach you in areas that you are not as well versed in. My idea might not have been executed if not for the help I received online and from my classmates. The best ideas come to life when people are connected to the others with skill sets that compliment their own.