Monthly Archives: January 2013

Arduino 101 Challenge

I attended an event by MakeICT this past Saturday where they went through the basics of using Arduino Uno R3 micro-controller–which is basically a tiny computer device that you can program to do certain things depending on the devices you might attach to it.? It is especially interesting because it is a really user friendly way of bringing the digital world of coding into the physical world where the output of your code is made visible in one fashion or another.

At the conclusion of the workshop they presented a challenge and I thought it might be of interest to someone, or even for just my own reflection later on, to see my thought process of how I tackled the task at hand.? The challenge is this:

Develop a mock solution using the arduino to simulate a 4-way intersection light traffic control situation.? As an added bonus challenge, incorporate the use of a pedestrian crosswalk request button.

At first glance, this really seems pretty easy, just a bit of busy work to organize the logic, but a fun little challenge to tackle.? I also want to try to see if there is a way I can push it a bit further– perhaps incorporate a new idea that isn’t yet the norm–like a traffic light sensor that can detect if an emergency vehicle is approaching with its lights on and direct traffic accordingly, or perhaps achieving the objective in the fewest lines possible.? Something like that.? First, I will work to achieve the primary objective and then come back and revisit my own added twists if time permits.

So, my first step is to dissect the problem at hand and break it up into bite size pieces, get it really granular and put everything on the table so I can see how the pieces might fit together best.? Then I will have a checklist to help guide my coding strategy.

  • “Camera Sensors” (I will substitute a camera sensor with a light sensor while working with the arduino) will detect traffic from all four directions.? Eight camera sensors in all–two pointing in each direction–one for traffic continuing straight or turning right and one for traffic turning left.
  • Two buttons at each corner will detect? if a pedestrian desires to cross a particular street in a particular direction.
  • The camera detecting traffic going straight or left need to check if there has been a car waiting for a set amount of time and thus requires the light to change to continue on.? The alternate scenario would be if there was a car turning right who had to wait momentarily, but then was able to continue on without the need for the light to change.
  • Another consideration would be the preferred default state of the light.? This would only take effect if there was no detected traffic for a given period of time.? If no traffic is present, the light will default to green for the most commonly traveled direction, thereby decreasing the amount of stopping for the average commuter.
  • Switch to a default program if one of the cameras is not working.
  • Find some way to test if all the sensors are working, if it is determined that one is not working, then an warning signal needs to be set off and the “backup” program needs to take effect.
  • Also need to work out the actual setup and timing of the light colors switching…green, then yellow for x seconds, then red, wait y seconds, then change the perpendicular street’s lights to green…

On my next post I will draw a diagram of the sensors and lights layout and write out the logic for the steps/considerations listed above.

Some other things that might be considered for critical cross sections, but I won’t consider for this test: Additional cameras

Automatons

In yet another workplace conversation, the subject of automation was brought up.? Specifically the automation of “production art” that is repeatedly requested.

See, I work for a 12,000+ company, which though not gigantic is quite large.? We have our own in house design team that handles everything from fully produced high quality training videos down to signs that will be posted on the bathroom directing people where to aim (okay that last one was made up, but we do work all the time that is just as mundane).? Several of the jobs we have on a daily basis are extremely repetitive, such as headline boards of a set font-size, color scheme, and height.? The only thing that changes is the width.? Another item is best described as portrait cards, which are essentially employee trading cards that can be Velcroed to a carpeted wall just as fast as the employees they represent enter and exit their new positions.? The latter scenario is what sparked the conversation.

Ever since I hired on, I saw the possibility of automating such tasks based on a user filled out form: [Who do you want a picture of],[What size do you need],[How many do you need],[When do you need them by]…I however haven’t had the time or green light to tackle it until now.? As I approach this I know we first need to standardize the way our portraits are captured so that I can in turn safely crop and scale down into the various requested sizes with some degree of consistency.? ENTER UNIONIZED PHOTOGRAPHER

I say unionized, not because this individual is a union member, but because he embodies the flaws I see in modern day unions and why they are dying.? This coworker, we will cal “Pat”, was adamant that we couldn’t introduce automation of current work because that would in turn be displacing work that is currently being done by another one of our coworkers.? I countered that yes, that is exactly right, but that our coworker would then be freed up from this mindless drudgery to do more sophisticated and higher value work at no additional cost to the company, thereby increasing the perceived and real value of our Creative Group to the corporation as a whole.? I was and still am baffled that he would stand in the way of such a legitimate innovation.? Thankfully my manager has the foresight to see what is coming and what is demanded of us, that he supported the effort and we are moving forward.? In a stream, stagnation only breeds fungus, algae, and decay, but movement, though it will change the historical path of the stream, will provide fresher, cleaner waters for use to all downstream.