Parts description
iBot controller board……………………………………………………….. 4
Line sensing module……………………………………………………….. 6
IR proximity sensor…………………………………………………………8
DC Power supply and battery……………………………………………… 10
With this kit the user shall have a hands-on experience of working with different sensors,
such as line sensing modules and IR proximity sensors, use of different actuators like DC
geared and stepper motors, their drivers, LCD interfacing and serial communication with the
PC.
iBot follows a modular approach throughout its construction, so the user can easily add new
features and behaviors from line following, obstacle avoiding to swarm robotics and a basic
micromouse. It can also be used as a generic embedded systems development platform.
We hope that building this autonomous robot will be an enriching experience and would
drive you to further pursue robotics seriously.
Features:
• Built around the popular 89V51RD2 microcontroller with ample of program memory
(64Kb)
• 8 channels of motor control, capable of driving 4 dc motors or 2 stepper motors at a
time.
• Onboard detachable 16x2 LCD for enhanced interaction.
• 8 digital input channels for sensor interfacing.
• Onboard RS232 level shifter for direct communication with a computer.
• 4 general purpose LEDs and Switches.
Parts identification:
Misc
Buzzer P0.3
Crystal (11.0592Mhz) Pin 18 and 19
Reset Switch Pin 9
The line sensing module is designed to detect a white line on a black surface from an ideal
distance of 10mm to 20mm. The module detects the line by measuring the intensity of
reflected Infrared (IR) light. The sensor can be tuned to detect various contrasts, say white
line on a green surface or a white line on a black surface.
The red indicator led lights up whenever in encounters a reflecting surface (white line)
Specifications
Input Voltage: 5Volts
Optimum detecting distance: 10mm
Step 1: Connect you module to one of the sensor port on the iBot controller. Refer the
adjoining figure for reference.
Specifications:
Operating Voltage: 5Volts
Current Consumption: xxmA
Detectable distance: 5cm to 15cm
NOTE: IR light is invisible to the human eye but digital cameras like webcams or cell-phone
cameras are capable of detecting it. Point your camera towards the IR emitter (while turned
on) and see for yourself! This is a very handy debugging tool.
Here’s what you need for your boards first test run:
Step 1:
Connect the LCD module to the iBot controller board as shown in the figure. The connector
would plug in with a small amount of force.
Step2:
Connect the power supply connector to the board. Turn on the power supply and then press
the power switch on the controller. The blue power LED will now light up and a welcome
message will appear on the LCD. Adjust the contrast pot for optimum text viewing.
Step 3:
Now, you shall see the program list, two at a time. Use the switches to scroll up and down the
menu and select the respective programs.
Switch 1: scroll up
Switch 2: scroll down
Switch 3: select
START
Welcome Screen
Program Selection
Reset
Note: All of the above programs are explained in detail in the programming section.
Ok so you have collected all the tools and are ready for some coding. I assume that you have
installed TRIC and Flash Magic on your PCs.
STEP 1
To create a new project file select from the TRIC menu Project – New Project…. This
opens a standard Windows dialog that asks you for the new project file name. You should
you use a separate folder for each project. You can simply use the icon Create New Folder
in this dialog to get a new empty folder.Select this folder and enter the file name for the new
project, i.e. Project1. TRIC creates a new project file with the name PROJECT1.trc. You
can see this name in the Project Window.
#include<p89v51rd2.h>
/*we include the necessary header file here which depends on the type of
microcontroller we use. There are separate header files for separate
microcontrollers in SDCC.*/
for(i=0;i<=1000;i++)
for(j=0;j<=dela;j++);
//turn it ON
Once you have created your source file you can add this file to your project. TRIC enables
you to add source files to a project from Project menu-----Add Main File. The option Add
Main Files opens the standard files dialog. Select the file EXAMPLE.C you have just
created. If your main file has more than one file then you add more files using the option
Add Sub File. The name of the added files can be seen in the Project workspace.
Now finally you can compile your project using the Project ----Compile option, which
displays errors and warnings if any in the source code otherwise generates the
EXAMPLE.ihx to
download the software into
an EPROM programmer
like FLASH.
Browse and select the HEX file that was created earlier. It can be located in the same folder
where you saved your project file. (in this case, the file would be itrix.hex and not led.hex)
STEP 7:
Connect the serial cable between the PC and your controller board and then plug in the power
supply (battery or separate). Turn ON the board.
STEP 8:
Click the start button on Flash Magic and wait till it programs the uC and displays a
‘finished’ sign at the bottom. Press the reset button on the board.
In this section we learned how to write a program in C and then run it on your iBOT
controller board. Now you can similarly load new programs of your own or try some of the
sample programs given in the accompanying iBOT CD.
Note: 89V51RD2 has an inbuilt ‘bootloader’ and therefore no separate hardware is required
to program it.
Step 2
Step 4
Step 6
Step 8
Step 10:
Step 12:
Step 14:
Step 16:
Step 18:
Step 20:
Step 22:
Step 24:
Step 26:
Now let’s see how we can put all of these things together in a C program.
void delay(unsigned int dela) //This a simple delay function using the
//nested ‘for loop’
{
unsigned int i,j;
for(i=0;i<=1000;i++)
for(j=0;j<=dela;j++);
}
We begin with including the header file for the microcontroller. Next we
write the delay() function using the nested for loop. Don’t worry about
the exact time of delay over here, you can experiment with different
values and see what difference it makes. For example, replacing delay(20)
with delay(60) will reduce the frequency while delay(10) would increase
the frequency. You could also try and use all the LEDs and generate
different patterns.
Lets see how a C program based on this algorithm would look like:
// Program using Switches and LEDs //
}
}
You will notice that we have written P3=0x3C at the very beginning of our
program. This is done to set PORT 3’s pin 2, 3, 4 and 5 as inputs since we
have connected our switches to them while pin 0, 1, 6 and 7 are the
outputs where LEDs are connected. (1 Input, 0 Output)
One IR proximity sensor is connected to PORT 1’s pin 0 and one motor is
connected to M4 (pin 0 and 1 of PORT 2)
Similarly, you can write a code to turn both the motors and use both
sensors together.
• LCD_INIT()
Initializes the LCD in 2 line 4 bit mode with blinking cursor.
• LCD_CHAR(‘T’)
Used to write any character T to the LCD.
• LCD_WRITE(“Xplore Robotics”)
Used to write a string on the LCD (max 16 characters in length)
• LCD_CMD(X)
To give commands to the LCD. X can be as follows
PUTLINE1 – Places cursor on line1
PUTLINE2 - Places cursor on line2
Note: LCD row 1 address starts at 0x00 and row 2 starts at 0x40
• LCD_CMD(LCD_CLEAR)
Clears LCD screen.
Here’s a sample program for using the LCD module with the help of the
above functions:
SBUF=dat;
DELAY(10);
if(TI==1)
{
TI=0; //Reset transmit data bit
}
}
After loading the program on to your iBOT controller, open the Hyper
Terminal on your PC.
You can find it in Start > Programs > Accessories > Communications > Hyper
Terminal
START
Initialize
Ports
NO
Is left line NO
sensor
active?
NO
Go straight
Is right line NO
sensor
active?
YES
Basically, the robot will always try to get the sensors on the line
alternately, thus moving in a ‘zig-zag’ path and eventually follow the
TRI Technosolutions Pvt. Ltd. www.triindia.co.in 44
line. The following code is written to follow a ‘black’ line on a ‘white’
surface but it can be easily modified to follow a ‘white’ line on a black
surface.
else
{
P2=forward; //else go forward
}
}
}
else
{
P2=forward; //else go forward
}
}
}
By changing the delay variable we can make the robot turn for some
specific degrees after it detects an obstacle. But the turns will not be
precise since they will change as the battery drains.
Note: In this particular case, the turning would be ‘in place’ i.e., while
turning, both the motors will run in opposite direction unlike the line
follower, where the turns were turning by ‘stopping’ either of th
8. Sumo Robot
In the previous two examples we
learned how to use the line sensing
modules as well as the IR proximity
modules. Now let’s see how we can
have a behavior that uses both of
these sensors together. A sumo
robot fits this bill perfectly.
Inspired from the tradition ‘human’
sumo competitions held in Japan,
robotics enthusiasts soon started
having robotics sumo. Sumo robotics
competitions are now held around
the world under various weight and
size ‘classes’ just like the real
ones.
In a typical sumo robotics
competition, two robots compete
against each other inside a sumo
ring. The ring is a made up of a
black surface with a white line
around its circumference as shown.
The idea is to push the opponent
out of the ring in the stipulated
time frame.
Initialize ports
Is the opponent
Turn left on the left and
me not on the
edge?
NO
YES
Is the opponent
Turn right on the right and
me on the edge?
NO
YES
Is the opponent
Go forward in front and me
not on the edge?
NO
YES
Turn backwards Is the right
then turn left line sensor
active?
NO
NO
Go forward
{
P2=turnright; //if detected, turn right
} //(i.e., towards the opponent)
{
P2=turnleft; //if detected, turn left
} //(i.e., towards the opponent)
else
{
P2=forward; //else go forward
}
}
}
The iBot can also be used as a learning tool for the 8051 family microcontrollers.
Some experiments include
• Using ports (Input output initialization and use)
• Interrupts
• Timers
• UART
• SPI
• LCD interfacing
• Stepper motor interface
Sensor Networks
This board can be used as node points in various sensor network applications. The two serial
communication points (SPI and UART) aids in such operations.
Some other minor projects/experiments that also can be implemented are as follows:
• Voting Machine
• Electronic Code Lock
• Vending Machine
• CNC Drill
• Burglar alarm
• Scrolling message display
• Motor Speed controller
• Frequency generator
• Frequency Counter
• Digital Clock
• Stop watch
• Serial to parallel converter
• Pulse width measurement
• Object counter
• Traffic signal controller
• Industrial automation and control
o Drive control
o Process automation
o Process Monitoring
2. www.robots-dreams.com
3. www.roboticsindia.com
4. www.seattlerobotics.org
5. www.robots.net
6. http://mobots.solarbotics.net
7. www.solarbotics.com
8. http://www.st.com/stonline/products/support/motor/tutorial/motor.swf
9. www.google.com
10. www.wikipedia.org