Line Following Robot in Verilog
Line Following Robot in Verilog
1. The design and application of peripheral circuitry for sensor and motor
2. FPGA-based logic design
3. The algorithm of control mode
Abstraction ............................. 1
Content .................................. 2
Reference Design Overview .. 3
Demo Setup ......................... 10
Rebuild Project .................... 11
Terasic A-Cute car is designed to following the black lines with the
implementation of Register Transfer Level (RTL).
The 7 sets of reflective IR sensors equipped are used to track the black lines.
The left and right motors are controlled and turned by the DE0-Nano according
to the data collected from the IR sensors. The control algorithm and data
processing are implemented in Verilog, including the conversion of 8- channel
ADC, where 7 of them handle the conversion of sensors from analog to digital
and the last channel monitors the battery voltage. It also includes IR remote
and manual controlling, as well as the dual motor PWM rotation speed and
steering process. All the functions are implemented on DE0-Nano board
Use anti-glare black tape with approximately 18mm width to setup a circleon a
board or on the floor, where white background is most recommended, as
shown in Figure 2
When the A-Cute car gets close to the black tape, the infrared rays
emitted from the sensors will be absorbed by the black tape and will not
be reflected back to the receiver of the sensors. This is represented by “1”
in digital logic. If the A-Cute car is moving away from the black tape, the
logic would be in “0”. The readings from 6 sensors will be discerned
according to the orientation of the A-Cute car as impartial, small bias to
the right, large bias to the right, small bias to the left, large bias to the left,
and completely off the line.
Figure 9 shows the control block diagram of Terasic A-Cute car. It includes
seven modules to achieve functions implemented on FPGA.The following
sections will illustrate how each module works.
ADC_CH_OUT
This module acquires ADC data from 7-channel IR sensor and 1-channel
battery power detection. The working frequency is 50MHz It reads data
from 8-channel LTC2308 of SCD in 12-bit through 4-wire SPI interface.
Each cycle takes approximately 33us to read the ADC data of each channel.
IR_CTL
There is acomponent on SCD for receiving IrDa signal. When the IRremote
controller sends out signal, the module will decode the signal received
from the component and execute corresponding actions. The only
buttons used from the IR remote control here are Up, Down, Left, Right,
Return, Manual, and Play.
MANUAL_CTL
SELT_TEST
When the A-cute car is powered up, the module will light up the LED on
DE0-Nano to indicate the FPGA is configured successfully.
SOUND_GEN/BLINK_GEN
TRACE_SENSOR_MOTOR
AUTO_TRACE_ON
Key Control:
1. Press “KEY0” button and the motors will move wheel forward or
backward,depending on the status of SW0. When the SW0 is set to
“0”, the wheel will move forward. The wheel will move backward
when SW0 becomes “1”.
2. When “KEY1” buttonis pressed, the two lamps on the SCD will
twinkle and there will be a “Beep” sound from the speaker at the
same time.
3. Press and hold “KEY0” button for two seconds and the LED6~4 will
be blinking. Three seconds later, the A-Cute car will start circling
clockwise for five seconds before circling anti-clockwise for another
five seconds. It’ll take total of ten seconds to complete this
demonstration and it can be stopped at any time by pressing“KEY0”
button.
4. Press and hold “KEY1” for 2 secondsand the LED6~4 will be blinking.
Three seconds later, the A-Cute car will move toward the black line.
The mode can be stopped by pressing “KEY1” button.
Perform IR Remote Control
Figure 10 shows the IR remote control used to interact with the A-Cute car
wirelessly.
Rebuild Project
The project is built in Quartus IIv15.1. Its source code is located underthe
folder : A-Cute system cd/DE0_NANO_CAR_RTL
Open the Quartus project file DE0_NANO_CAR_RTL.qpf and click the menu
item “ProcessingStart Compilation” to start the compilation. Whenthe
compilation is complete, an output file namedDE0_NANO_CAR_RTL.sof will be
generated under the output_files folder.