Manual of Robot
Manual of Robot
Precautions
This manual contains crucial information including the precautions that must be taken
seriously to insure trouble free operation of Qu-Bot robot as well as prevent damage
for the users and others. Please read the manual carefully before starting assembly
and programming of Qu-Bot.
Page 1 of 52
Page 2 of 52
Page 3 of 52
Page 4 of 52
Page 5 of 52
1
2
5
7
7
13
15
15
18
20
20
20
21
24
26
26
26
27
27
28
28
28
28
28
29
29
29
29
29
29
30
30
31
31
31
31
32
32
32
Page 6 of 52
32
33
34
34
34
34
34
34
35
36
36
36
36
38
39
39
40
41
41
41
41
41
43
43
44
45
45
46
47
48
49
50
51
52
Castor, motor clamps, cable ties and different screws and nuts included in kit.
Page 7 of 52
Insert 3 long screws in the castor wheels 3 holes keeping plastic washers in-between
as shown in picture.
Step 2
Insert castor wheel with screws to the Qu-Bot PCB allocating the 3 holes. After
inserting place 3 more plastic washers on the top and lock the castor wheel to PCB
with nuts.
Page 8 of 52
Place the battery in the center of Qu-Bot between 6 holes. Secure the battery to PCB
with help of 3 cable ties included in the kit as shown above. Cut the extra portion of
cable ties with paper cutter or nipper.
Step 4
Place the clamp on the 2 holes on the back part of robot. Clamp it with PCB with 2
small screws and nuts. The placement is very critical. If the clamp is not parallel to
PCB edge the motor will not be straight and robot will now move in a straight line. A
good idea is to align the clamp to PCB track while assembly.
Page 9 of 52
After securing a castor, battery and 2 clamps the robot now looks as above from back
side.
Step 6
Now attach motor to the clamp as shown above. Put the screws inside the holes in
motors through clamps and tighten nuts on them as shown in above picture.
Page 10 of 52
After screwing 2 motors, connect the motors and battery to the board. Take care
while plugging in the connectors. All the connectors are polarized so they cannot be
inserted wrongly but still do not try to force them in different configuration. This may
damage the board permanently.
Step 8
Now place 2 wheels over the motor shaft, press them properly and secure them with
a metal washer and screw as shown in picture.
Page 11 of 52
Insert the LCD on the top. Now the Qu-Bot is ready to use. Its advisable to charge the
battery before using it. The Qu-Bot can also get charged or run directly on USB power
but its advisable to use AC charger for fast charging. When the charge led will glow
the charging is complete.
When Qu-Bot is connected to PC using USB it gets powered up irrespective of the
state of power switch. When AC charger is connected the Qu-Bot will be
disconnected from battery and charger but if USB cable is connected to PC the robot
will be working and battery will get charged through AC power.
Charging battery though USB may take up to 12-15 hours. Disconnect LCD and switch
off sensors (See Section 1.2, Component 17) to save power and charge faster through
USB.
Page 12 of 52
Component
1. Power & Charge LEDs
Usage
Indicate whether the Qu-Bot has been powered
up. Charge LED will glow once battery is
charged through AC charger.
Lights up through software
Page 13 of 52
10.
11.
12.
13.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
Page 14 of 52
After starting the setup the above window appears. Qu-Bot uses PL2303 chip for USB
communication. This is the driver for the same.
Page 15 of 52
Page 16 of 52
This finishes the installation. Press finish to close the window. Now the driver is
installed.
Inserting the USB cable from Qu-Bot should now automatically detect the device and
give connect device sound. It will also show balloon from the task bar as shown in
above picture.
In case of any problem to verify that driver is installed correctly you can check Control
Panel-System-Device Manager Ports. There should be a device called Prolific USBto-Serial Comm Port (Port number).
Page 17 of 52
On ready to install page it shows location where the files will be installed. Click next
to start setup.
Page 18 of 52
Now the software is installed. Press finish to exit installer. The QBVLab icon now
appears on desktop as well as start menu. Run it to start the software.
Page 19 of 52
Page 20 of 52
3.1.2.1.1. New Code (Ctrl+N): Creates a new blank file. Click the New button on
quick menu bar or File-> New Code.
3.1.2.1.2. Open (Ctrl+O): Opens a previously saved file. Click Open button on
quick menu bar or File-> Open. Then select .QBF file and click open.
Page 21 of 52
3.1.2.1.4. Save As (Shift+F2): Similar to Save. Saves file in different name Click
File-> Save As.
3.1.2.1.5. Exit (Ctrl+X): Exit from QBVLab.
3.1.2.2. Tools
Page 22 of 52
Page 23 of 52
Page 24 of 52
Page 25 of 52
Page 26 of 52
Page 27 of 52
Page 28 of 52
Page 29 of 52
Page 30 of 52
Page 31 of 52
Page 32 of 52
Page 33 of 52
Page 34 of 52
Page 35 of 52
Once you drag IF(Condition) block the code flow window will look like left image. If
you do not want ELSE block you can right click on the block and select delete (See
3.2.4). Then your code flow will look as shown in center image.
*If you delete ELSE from any IF structure you will not be able to restore it.
ELSE IF(Condition) can be put between IF and ELSE Block. If there is no ELSE block it
can be put anywhere in between IF(Condition) and ENDIF blocks. There can be
multiple ELSE IF(Condition) blocks as shown in right figure. To add ELSE IF(Condition)
block drag the block on IF(Condition) block.
6.1.2. Condition Building, Operands and Operators
Left click on IF(Condition) block to see attributes of this block. Click on Condition
Value block in attribute explorer. You will see a condition builder window as shown
below.
Page 36 of 52
6.1.1.1. Operand1
There are four columns in the condition builder block. First of all click on Variable
blank box to see drop down menu. Here you will see all sensor input variables.
Also there are general purpose variables available which can be compared through
this block. Check section 7.2.
Eight variables represent 3X line sensors, 3X Obstacle sensors and 2X Motor
counter (Encoder) Values.
LDR Value variable represents ambient light value.
Switch1, Switch2 & Switch3 variables represent switch press status.
All the above variables fetch latest input from the system when they are used.
IR Input & UART Input variables also can be compared but they will need different
structure. Please check section 7.3.1.
6.1.1.2. Operator
Second column in condition builder is used to select operator.
==
Checks equality
!=
Checks inequality
<
Less Than
>
Greater Than
Page 37 of 52
Page 38 of 52
There are two programs written for glowing LEDs on Qu-Bot depending upon the
switch press.
IF blocks are used within an infinite loop.
From first sight it looks that both the programs are same. But there is functional
difference. Find out what is the difference?
Hint: Press more than one switch and release only switch.
6.2. Other IF blocks
Right side program in section 6.1.4 can also be written through IF(Switch) block as
shown in above figure. Also it will be much faster.
*In all IF() blocks you can add ELSE IF(Condition) block.
Page 39 of 52
Page 40 of 52
Page 41 of 52
Please check simple program and output of the same on UART console.
7.3.1.2. IR Input
IR Remote Sends signals every 114ms. Hence we cannot have data instantaneously
like other sensors which provide data in 1-2uS. Hence the program flow waits for
IR signal for around 200ms. Input is taken by Variable block just like in above case.
If no IR input is received within this time IR Input variable will be 255 or you will
receive different IR code for each key on remote in IR Input variable.
Page 42 of 52
Above program waits until it receives IR remote code and displays the code on
LCD.
7.4. Variable Operator Block
This block is used to do mathematical operations like +, -, * and /. Left click on the
Variable Operator block in code flow and check attribute explorer
Page 43 of 52
The delay can be specified in Microseconds, Milliseconds and Seconds. Choose Unit
from dropdown box. Write Timer Value in the box. The above attribute explorer
shows the delay value is set to 100 Milliseconds.
7.6. Counter Block
This block increments or decrements CNT1 to CNT10 variables. This block is normally
used in loops for counting purpose.
Choose Counter number from the drop down box and select operation to be
performed. As per above image CNT5 will be decremented.
Page 44 of 52
This sample code shows the basic application of sensors and buzzer.
When any of the front sensors senses an object the buzzer goes on for infinite
time.
Page 45 of 52
This sample code shows how Qu-Bot can be programmed to make an obstacle
avoider robot.
LCD is initialized to show status of robot.
The robot starts moving when switch 1 is pressed because there is a while
conditional loop on top.
By default robot keeps moving forward at speed 7
When front sensor senses obstacle the robot moves backwards for 500 ms and
takes a left turn for 200 ms at speed 10
When left or right sensor senses an obstacle the robot stops opposite side motor
to take turn in reverse direction.
Page 46 of 52
If the robot is kept on a table surface with this code programmed, the robot moves
forward by default whenever it senses edge (Bottom sensors doesnt sense table
surface) it takes actions accordingly.
By default the robot moves forward.
If the bottom center sensor doesnt detect table surface (moves out of edge) robot
moves backward and takes a turn
If bottom left or right sensor moves out of edge the robot takes turn in opposite
direction.
Be careful when using robot with this code programmed. Sometimes there is a
chance of robot falling down. Keep alertness to grab the robot if it falls down.
Page 47 of 52
This sample code shows how to move robot for specific distance using encoder
sensors mounted near wheels. This code is made to move robot forward for
approximately 1 meter.
The diameter of the Qu-Bot wheel measures 66.3 mm. So the periphery of the
wheel becomes 208.182 mm (D = 66.3 x 3.14 ).
The wheel has 8 holes in it so it gives 16 counts (8 on + 8 off) when it rotates 1
revolution. In one revolution it moves forward to 208.182 mm distance (periphery
of wheel). So at each count we get distance of 208.182 / 16 = 13 mm. This is also
the accuracy which we get when the robot moves on motor count.
If we want robot to move forward to 1 meter robot has to go forward until it gets
77(1000/13) motor counts on motor counter.
So this is how it works. When switch1 is pressed robot starts moving forward. The
right motor counter is already initialized at code start.
The while condition checks until the motor count reaches 76. We need 77 counts
but there is some inertia when the motors are stopped, so the robot moves a little
forward when motors stop, and we get approximately 1 meter move.
Page 48 of 52
This code uses only one sensor to follow a dark color line on light colored floor.
In the start robot starts running left motor. Right motor is stopped. So the robot
takes a long right turn.
When it gets the line under the bottom sensor it continues to take right turn until
it crosses it completely.
After a small delay of 50ms the left motor stops and right motor starts moving so
robot takes a left turn.
Again it continues taking the left turn until it crosses the line. After a 50 ms delay
the procedure repeats because of infinite loop.
Page 49 of 52
This code uses 3 bottom sensors to make Qu-Bot follow a dark color line on light
color surface.
When the bottom center sensor is on the dark line the value is 0. This means the
robot is on the line. It will move forward in this condition.
If the bottom center sensor goes off, either left or right sensor will encounter the
line. If left sensor senses the line, left motor stops and right motor runs at full
speed so robot takes a left turn and comes back on line.
If Right sensor encounters line right motor stops and left goes on full speed so
robot takes right turn and comes back on line.
Page 50 of 52
Programming this code into Qu-Bot makes it a manual remote controlled robot.
When any switch is pressed on IR remote, it transmits a RC5 code. In the remote
included with this kit the code is from 1 to 127.
There are 4 big arrow keys on the center of remote. This code uses them for
moving robot.
Any key of the remote can be used to create any action on robot. The 4 arrow keys
have IR codes of 32(Up), 33(Down), 17(Left) & 16(Right).
The key codes of other keys can be recognized by printing the IR Input variable to
LCD or serial Terminal on PC.
For manual control robot there is a simple loop. For any input of IR out of 4 keys
the robot gives specific action.
Page 51 of 52
Qu-Bot has a facility to communicate with PC through USB. Connecting the USB cable
creates a Virtual Serial Port on PC. Through this port serial communication can be
done with PC. This communication is called UART (Universal Asynchronous Receiver
Transmitter). There are different terminal softwares available for serial
communication like HyperTerminal and brays terminal. The QBVLab software itself
includes a terminal. In advanced applications its possible to control Qu-Bot from the
inputs of mouse, keyboard, webcam, internet or any other source available on PC.
However this needs a high level of programming and hardware knowledge on PC but
this sample code gives a demo on how to move Qu-Bot on commands taken from
keyboard.
In an infinite loop the robot seeks for UART input. When a key from A, S, D and W
is pressed terminal sends the characters to robot and it takes appropriate action
by moving itself to left, back, right or forward.
Page 52 of 52