We will use a GreenPAK chip to implement the line follower control logic. Since GreenPAKs have easy to program look-up tables (LUTs) it enable us to easily design a simple yet efficient controller for a line following robot. A TCRT5000 reflective optical sensor will also be used in this design that outputs a digital signal HIGH for white and LOW for black.
Step 1: Create a Custom IC With Integrated Line Follower LogicTo easily implement the logic needed for the line follower, download the GreenPAK software here and open this design file here. Hook the GreenPAK development board up to the computer to easily program the chip with this design file. This pre-made design file in combination with the GreenPAK development platform will allow you to easily create a custom chip with the appropriate line follower logic even if you do not understand how the line follower works. However, for completeness, we will describe how the line follower works in the next step so that you can understand the logic driving your GreenPAK chip.
Step 2: Logic for Line FollowerThe logic we plan to use is shown in the Table above. Motor at 1 means that the motor is spinning and at 0 means that it is stopped in order to keep a simple design, we will only drive two motors. The motors are placed as shown in the red motor drawing. We could design the sensor array with any quantity of sensors we like, but it can be just three TCRT 5000 arranged as below. An ideal distance between the TCRT 5000s would be the width of the black line it is going to follow.
Following the normal process using the first table shown, we are to simply obtain the logical equations using Karnaugh ́s Maps for each motor.
The Karnaugh's map for the A motor is represented in the second table. X state means that the combination is not expected to appear under normal circumstances, which means that it does not matter if the motor is either spinning or stopped. So the logic equation for the A motor is: AMotor = IN1.
The B Motor map is described by the third table. X state means that the combination is not expected to appear under normal circumstances, which means that it does not matter if the motor is either spinning or stopped. So the logic equation for the A motor is: AMotor = IN1.
The B Motor map is described by the third table. This gives us the logic equation for the B Motor:BMotor=IN1 ́+IN2 ́IN3.
Usually, in order to use only one or two types of logic gates, we do some Boolean algebra until we get the following equivalent equation.
BMotor=(IN1(IN2 ́IN3) ́) ́
This line follower is developed using simple logic, which means that going in reverse is not implemented. In case the three sensors are outside the black line, IN 1, IN 2 and IN 3 will all be reading a HIGH, which for this configuration makes the car spin, until the black line can be found again.
On the other hand, when the three sensors are reading a LOW, the car stops moving altogether. These equations are the logic for the basic line follower, and if we were to program it exactly in the same form, we obtain the configuration shown in the schematic above showing 3 logic gates in GreenPAK Design.
Step 3: Line FollowerConnect the GreenPAK outputs to Motor A and B of your robot and the inputs to your TCRT5000 reflective optical sensor. To power up the GreenPAK, you can connect it to the 5V pin of the LN298N and power the same using a 12V battery as seen in the above figure.
Using this setup, we can also add more features to this basic design, implementing PWM to regulate the speed in which the line follower is moving, and enable us to implement a reverse condition if needed.
For more complete details on how to implement a line follower control circuit, download our full Line Follower application note.
Comments
Please log in or sign up to comment.