Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Learning Outcome
This project gives the user a hands-on experience on how to use ezCircuit Designer (ezCD),
CoreChart and the eLab16m to design, build, document and program a “Line Following
Robot”.
The aim is to encourage the user to design other PIC microcontroller electronic projects.
A typical example: a team of Secondary students used ezCircuit Designer (ezCD), CoreChart
and eLab16m to design, build, document and program a touch pad device for autistic children
to communicate through an i-pod.
Software
• Microsoft .NET Framework V2 ( Required to run ezCircuit Designer )
• ezCircuit Designer
• CoreChart
• Microsoft Word
Hardware
• eLab16m Controller Board
• eLabtronics USBP Programmer with USB Cable
The Line Following Robot is developed using the eLab16m board. The PIC16F819 chip on
the board will be programmed by the user to form the brain of the robot.
figure 1.1
Step 2: Create Documents
figure 2.1
2 Project 5: LDR Line Following Robot
b. Fill in “Introduction”, “Functional Requirement” and “Requirements Specification
Rationale” as follows:
a. Select the “Light Dependant Resistor (LDR)” icon in the “Circuit Groups”.
b. Ensure “Active High” in “Circuit Typess” sub-menu is selected and then click on pin
17 (A0) of the chip diagram.
c. Right click “LDR17” box and click Rename. Change “LDR17” to “LightSensor”.
figure 3.1
figure 3.2
It is important to get familiar with the concept of Active High and Active Low circuits.
To return from the circuit diagram to the main screen, go to the top right corner and click the
drop menu to find “Main” to return to the main page.
figure 3.3
In the template the “Motor Drivers” are connected to pin 10, 11, 15 & 16.
a. Rename the Motor Drivers” as shown in Table 1 and figure 4.1. This will make
programming easier to follow.
figure 4.1
b. Go to the ezCircuit Designer “File” menu and click “Save as…”. Save the template
name as “LineFollower”.
c. Generate CoreChart test program to test the hardware. Click on “Options” and then
click “Send to CoreChart”.
Alternatively click on the CoreChart icon in the ezCircuit Designer menu bar.
figure 4.2
Note: This project uses the battery power source from the robot base, not the battery pack
that comes with the eLab16m.
a. Plug the white 3 pin power connector that comes from the robot base into the white
socket labeled “BAT” on the eLab16m.
b. Plug in the two 2 pin motor connectors as shown in figure 5.1.
c. Note that the first column of “header” pins next to the “labels” are connected to the
“negative rail”, the middle column of pins are connected to the “positive rail” and the
inner most column of pins are the “signal” pins as shown in the “KEY”.
KEY
Connect the Light Dependant Resistor (LDR) sensor as shown below. Use heat-shrink to
cover the edges of the LDR to vary the sensitivity of the LDR.
The LDR Circuit Diagram is available from ezCircuit Designer. Right click on the LDR box
connected to the PIC chip, then click on “View Circuit Diagram”. To return to the Main
page, click on the “Backward” arrow on the top right corner.
figure 5.2
figure 6.1
b. Plug in the USB cable to the computer. Connect the USBP programmer to the
eLab16m. Turn on the eLab16m power. Send the CoreChart test program to the chip.
The test program will test all the outputs on the project.
c. When the program is successfully downloaded to the chip, unplug the USBP
programmer from the eLab16m.
d. Press and release the reset push button switch on the eLab16m to start the program.
e. One of the motors will spin clockwise for few seconds and the other will spin in a
counter clockwise direction.
• A “Decision” icon CANNOT be placed before a “LABEL” icon e.g. the “Again”
icon. It must be placed BEFORE an “instruction” icon.
REASON:
The reason is that if the “Decision” is a “YES” before a “LABEL” icon the
program will skip the “LABEL” because it is NOT an instruction. If the
“Decision” is a “NO” then the program will also skip to the icon after the
“LABEL”. This is a logical error because the “Decision” cannot make a decision.
• CoreChart also does not allow two “Decision” icons to be placed one after the
other because this will create a logical error between YES or NO decisions in the
two “Decision” icons.
figure
9 8.1 Project 5: LDR Line Following Robot
Step 9: Build Line Following Program
a. Replace the “YellowLED” icons with the new subroutines as in figure 9.1 and save
program.
The robot travels along a line or the edge of a piece of paper by the following process:
The robot moves right when the LightSensor is OFF and moves left when the LightSensor is
ON.
figure 9.1
a. Double click on the subroutine “LEFT” and add icons as shown in figure 10.1.
b. Repeat for subroutine “RIGHT” and add icons as shown in figure 10.1.
The “LEFT” subroutine makes the robot turn left and the “RIGHT” subroutine makes the
robot turn right.
figure 10.1
d. Press the reset push button switch on the eLab16m board to start the program.
e. Take a piece of white paper and place it on a dark surface. Then place the robot on
the edge of the paper. Finally, position the light sensor to face the floor. The robot
follows the “line” or the edge of the paper.