Thursday, February 10, 2011

DPHP 3 - Electronics Genesis

Onto the start of the heart and soul of the project.  I'm sure for most the helmet itself would seem like the fulcrum upon which the rest of the project pivots, and you're probably right.  But if you want to talk about where most of the development hours, effort, learning, blood, sweat, and tears (honestly) went in this project, it would be into the electronics.

From the get go I knew this was going to be the biggest part of the project, which more than anything else the functionality of the LEDs and all that would make or break the project.  It was where things would shine, where things that had never existed would be created, where I could be a true innovator.  And also the area where I knew almost nothing.

I often tell the story of how I became an aerospace engineer when I explain what it was like getting into the electronics of this project.

Today will be no exception.

Freshman year at university, like many others, I knew roughly what I wanted to study.  Luckily, all freshman are taking general required classes their first year anyways, so they get the year to also take some intro classes.  I had built many a gaming desktop in my teens and loved the power and flexibility inherent in a computing platform, so naturally I thought computer science would be the major for me.  My intro to programming class taught me otherwise.

We programmed in a rather arcane language that was LISP based, which to this day I have no idea what that implies other than it's not C based (like C, C++, java, and oodles more).  For one nights homework I spent three hours debugging my code until I realized I had misspelled LAMBDA.  That's how hard it was to code in this language.  That's how bad the editor was at pointing out compile time errors (which to this day I don't think it could throw compile time errors, it was all or nothing).  That's how annoying it was for me, the king of spelling mistakes.  And that's how I didn't become a Comp Sci major.

Conversely, my intro to aerospace class was completely different.  We built all kinds of things, from paper clip parachutes to radio controlled helium balloon racers.  We did math that (although simplified) was the same math you used to get something into space.  We looked at the fundamentals of how the whole commercial air travel business was one giant, well balanced, and sometimes broken equation.  It was interesting, and that's why I became an aerospace major.

Despite going into aerospace, I still had to learn to code.  You can't be an engineer today (or even a mathematician or scientist) without at least being able to write an integrator in excel, or use data analysis functions in MATLAB.  But on the first programming homework assignment, which was in the Ada95 language, I knew I had picked the right major.  I had a number of spelling and syntax mistakes, and for each one the compiler caught it.  For each one it even would pop up a little text string at the bottom asking "I noticed you put a ':' here when you probably meant to put a ';' , would you like me to change it?".  Ok, it may not have been exactly like that, but to a person who is plagued with spelling and syntax problems, it was a godsend.  I had picked the right major.

So hopefully now you understand what it was like in the early days of this project.  What comes next (or more likely many installments from now) may astound you, but keep in mind it comes from the same mind that coded three different line drawing functions of his own before stumbling onto Breshenham's line algorythm.  It hasn't been easy.

So when did electronic genesis happen?  Some time in June or July of 2009.  When I discovered the Rainbowduino from Seeed Studio.  No, that's not a typo.



In the year preceding I had learned about row & column multiplexing, current sinks and sources, persistence of vision, and all  that good stuff.  But I barely new anything beyond basic V=IR circuit, and even less about microcontrollers.  I had built an RFID door unlocker with a servo to pull the door handle, but that was largely from borrowed code and ideas from other peoples projects.  And looking back the code was so hideous it makes me cringe.  There was no way I was going to be able to build my own circuit to drive all of those LEDs.  I had to have an off the shelf solution, at least to get me started otherwise it would have been far too overwhelming.



I knew of Sparkfun and their SPI based LED matrices.  But they weren't ideal.  SPI sounded really scary, what with the very loose standards surrounding it, and Spark's example code was even more off putting.  Plus, the pin-out of the backpack board was designed for a specific matrix, and that pin-out was all over the place with no apparent rhyme or reason.  It would have been incredibly painful to hard wire the helmet display given the lack of order.

Then I found the rainbowduino.
It was RGB, so lots of colors.  Joy.
It was based on a ATMega168, and the code was in the arduino language.  Joy joy.
It was cheap, way cheaper than Sparkfun's offering.  Joy of all joys.

So I put in an order for 6 of them and 6 prefabbed matrices for prototyping purposes.

No comments:

Post a Comment