Posted by: Tyler Green | 04/09/2010

Line-Sensing Car

Line Sensing Car

In lab this week, we created a line-sensing car.  Well, the thing didn’t actually work, but all the design considerations were taken so that the car would alter its two motors’ speeds depending on its location on a piece of aluminum duct tape.  The front of the car was rigged with a left sensor and a right sensor (as visible on the scooper of the vehicle, the back wheels are vertical so it could be tested without continuing to drive on the table).  If a sensor was on the tape, the tape would complete its circuit and its sensor would be in the normal state.  As soon as the circuit was broken, meaning the sensor had left the tape, correction needed to be made by lowering the speed of the opposite motor.  Thus when the left sensor left the track, the right motor would slow to get the car back on track… literally.  Once the circuit through the sensor was complete again, a state change would occur and both motors would continue at the same speed.

While the motor speed was altered using a digital-to-analog approach called Pulse-Width Modulation where an intermediate value (here of speed) could be achieved by providing full power only a percentage of the time, this was not the intriguing part of this lab.  When both sensors left the track, this meant a hard turn in the tape had been made that required faster correction than only having one sensor leave the track.  The problem arises in how to distinguish the state for when a hard left turn is needed from when a hard right turn is needed, since both appear as both sensors being activated.  To solve this, the logic needed to escape from being purely combinational, where the state depended only on its current input.  The car needed to act based on its inputs determining its next state, as well as its present state.

Code was written for all of this state logic that was implemented by software and sent to the FPGA (on table in picture).  The programmable logic receiving the values from the sensors, made the correct state decisions, and then sent the motor control signals out to the motors.  It would have been a lot neater to see the car behave in response to its environment, but at the same time, learning the basis behind sequential logic in circuitry was very rewarding.

Sequential logic is taken for granted because all programming languages, and for that matter, all human thought is based on order.  Very complicated designs had to first be implemented on the bit level before the programming languages could even operate this way.  All that said, next time you want the computer to do what you actually meant instead of what you said, cut it some slack, it will always do its job – it may just be bit by bit.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: