Lecture Slide 4.1.4 Smartphone Controlled Robot Programming
Lecture Slide 4.1.4 Smartphone Controlled Robot Programming
Robot
Smartphone Controlled Robot
• In a smartphone-controlled robot, the motion
of the robot is controlled using the inputs of a
smartphone app – Dabble. We will use the
gamepad module to control the robot.
2
Logic Control
3
Dabble App
• Download the Dabble app from here:
4
Gamepad Module
• The GamePad Module is one of the input
modules, using which user can give
commands to the device using buttons.
• The digital mode is the default mode
when the module opens. It has 10 digital
buttons whose data is sent to the device
when they are pressed or released.
5
Gamepad Module
Actions to be performed by the Robot:
• Up – Go forward
• Down – Go backward
• Left – Turn left
• Right – Turn right
• No button pressed - Brake
6
Forward
7
Backward
8
Left
9
Right
10
Brake
11
Programming
12
Select Board
• Select evive as Board
13
Go Straight
• Go to the Data&Blocks palette and create
a block named Go Straight.
• Go to the Actuators extension and drag
and drop the run motor () in direction
() with speed () block below the Go
Straight definition hat block; set the
motor as 1, the direction as forward, and
speed as 100 %.
• Repeat Step 2; this time set the motor
as 2.
14
Go Backward
• Go to the Data&Blocks palette and create
a block named Go Backward.
• Go to the Actuators extension and drag
and drop the run motor () in direction
() with speed () block below the Go
Backward definition hat block; set the
motor as 1, the direction as reverse, and
speed as 100 %.
• Repeat Step 2; this time set the motor
as 2 & direction as reverse.
15
Turn Left
• Go to the Data&Blocks palette and create
a block named Turn Left.
• Go to the Actuators extension and drag
and drop the run motor () in direction
() with speed () block below the Turn
Left definition hat block; set the motor
as 1, the direction as reverse, and speed
as 100 %.
• Repeat Step 2; this time set the motor
as 2 & direction as forward.
16
Turn Right
• Go to the Data&Blocks palette and create
a block named Turn Right.
• Go to the Actuators extension and drag
and drop the run motor () in direction
() with speed () block below the Turn
Right definition hat block; set the motor
as 1, the direction as forward, and speed
as 100 %.
• Repeat Step 2; this time set the motor
as 2 & direction as reverse.
17
Brake
• Go to the Data&Blocks palette and create
a block named Brake.
• Go to the Actuators extension and drag
and the drop the () motor () block below
the Brake definition hat block and set the
motor as 1 and condition lock.
• Repeat Step 2; this time set the motor
as 2.
18
Setting up loop
• Drag and drop when evive
starts up block from evive
extension.
• Snap forever block from
control palette below
when evive starts up
block.
• Snap if then block from
control palette inside the
forever block.
19
Is () pressed on gamepad?
• Is () pressed on gamepad? block
reports whether the selected button is
pressed or not?
• If the block is pressed, then it return 1,
else 0.
20
Main Program
21
Uploading the code
• Select the mode a Upload Mode.
22
Uploading the code
• Connect evive to computer and choose
the appropriate COM port.
23
Uploading the code
• Click on upload code button.
24
Controlling Robot
25
Connect the Bluetooth (HC 05)
26
Connecting to smartphone
• Turn on evive.
• Click on connect icon on
top right corner of dabble.
27
Connecting to smartphone
• List of available devices
will come.
• Select the appropriate
Bluetooth module from
the list.
28
Debugging the
Robot
29
Debugging
If on clicking the up button, robot is not going
forward, then follow the steps:
• Ensure that left motor is connected to M1
and right to M2.
• Click on up button and identify, which
wheel is moving in reverse direction.
• If left motor is moving in reverse direction,
take the motor cable out and connect it
reverse manner.
• If right motor is moving in reverse
direction, take the motor cable out and
30
connect it reverse manner.
31