PComp HW #6

This week’s assignment was to work with an Infrared (IR) sensor, read the data coming into it, and linearize that data. I worked collaboratively with Oylum Boran, Liz Kauff, and Adam Scher.

We began by simply connecting the IR sensor to the Arduino and using simple analogRead and Serial.print commands to see how the sensor worked and what types of numbers it would spit out at us. Once we had it working, we attached the IR sensor to a piece of scrap wood to stabilize it and set up a 30 inch stretch of measuring tape to measure distances away from the sensor, in order to calibrate it.

We found the following spec sheet to be helpful in converting the analog data into human-looking numbers, and then converted this equation into inches, our unit of measure. Below is the equation we used to convert the data into inches. (Note: the italicized numbers can be removed to convert from in to cm)

(4800*0.393700787)/(average – 20)

Calibrating short distance

Calibrating longer distance

In trying to calibrate the sensor, we realized the data was quite finiky. We used averaging to regulate the data, and found that it gave us more accurate readings. Please see our code.

Finally, we attached some LEDs to our circuit to see how we could affect an output using our collected IR input data. Please see our code.

A picture of our circuit

A video of our circuit in action

IR Linearization Project from Oylum Boran on Vimeo.