Welcome back to the Digilent Blog!
Last time, the Pmod Racing Ruler was getting into the final stages of preparation — all we needed was the (admittedly critical) addition of the front pair of wheels. They were placed in front of the drag racer, but whenever it was merrily racing along and ran headlong into an object, such as a wall, it simply tried to drive straight up the wall without stopping. Pretty embarrassing when you consider that it was supposedly designed to stop whenever it hit something.
But no more! After taking part of a plastic pen that easily contains the front axle and using electrical tape to hold the axle underneath the ruler chassis with the wheels far enough back so that they do not protrude out in front of the ruler, the Pmod Racing Ruler was ready to rumble…until it reared up, slammed back down on the front wheels which indicated to the PmodACL that a bump occurred so the motor stopped running. Awkward.
At first, I thought I could simply program the Racing Ruler to ignore the first one or two bumps that occur, but after a bit of thought and some empirical evidence, I realized there is no way to ensure that the accelerometer only ignored the first one or two “bumps” and treated the rest as valid hits in a reliable fashion. So instead, I had the accelerometer ignore all bumps within the first second of operation. This effectively excluded any artifacts from the boot-up sequence and only detected valid collisions. Granted, this would not work if the Racing Ruler struck a wall within the first second, but I would attribute this collision towards user error, rather than defective code.
Check out the video below for a taste of the Pmod Racing Ruler! Construction details will soon be available on Instructables.com. You may also get to see it in a Pmod Monthly!