Monday, February 14, 2011

Proof of Concept

When I brought my final concept to class, Nick told me that I should use an infrared sensor instead of the sonar ping sensor I was going to use. This threw a kink in my chain as the code for the ping sensor seems to be endless and I spent hours the first night just trying to find an article that even talked about the sensor I was given. Soooooo after a lot of searching and almost giving up on finding good code to make this infrared sensor work, I got it! I tried probably 4 completely different codes (and a series of meddling with them to see if I could "make" them work) before I came across the one I'm using. It's from this site: http://luckylarry.co.uk/arduino-projects/arduino-using-a-sharp-ir-sensor-for-distance-calculation/ and after now using it, there's only one real thing I don't particularly like about it. The article is about how the Sharp IR sensors have a weird output ratio for data and don't give linear feedback like you would expect something measuring distance should. So this guy did a series of tests on his sensor and created a formula for his specific environment to counteract the wonky numbers. The "problem" is that my setup is obviously not his so his numbers really don't do anything for me (from what my testing tells me at least). Despite my best efforts to simply get rid of the extra formulas he's stuck in the code, it doesn't work as I somehow mess up the syntax and aren't learned enough in Arduino to figure it out. I put the word "problem" in quotes earlier because it's not really a problem...I charted the figures it gave me and I can use those just as easily as if it gave me the non-manipulated numbers as I still don't think it'd give it to me in clear inches or anything. So, it's more of a nuisance than a deal breaker. I've babbled enough, onward with pictures!!


The setup
The initial figures....ALL OVER!
Then I tried to be sneaky and make it convert to inches....yeah.....
Yay some regular readings!
More of the setupConcept prototype
Concept prototype
Concept prototypeWith the board attached

Measuring out the distances from the sensor
marking the distances in half-inch incrementshow I went about charting my data


just a pic of the "resting" state of my sensor in this prototypechart with all of the distances plotted and the numbers output by the sensor

At this point, I have to figure out what I need to do to get around the output data problem inherent to the sensor. It wouldn't be a conflict if there weren't any similar numbers but it becomes a pretty big problem when something 2.5inches and 19.5inches away from the sensor output the same number. Once I sort that issue out, I need to figure out the code for how to make an if statement and apply it to sections of the prototype so that different sounds will be made when different distances are captured. Looks promising, though...I'm optimistic at this point!

No comments:

Post a Comment