Вы находитесь на странице: 1из 27

RBT FORM 3

REKA BENTUK MEKANTRONIK


TEORI KERETA KAWALAN JAUH ARDUINO
AGENDA PART 1
ARDUINO BASIC RC CAR SETUP
◦ Components
◦ How they connect? (Schematics)
◦ How they function?
 Input and Output
 The logic behind Car Movement
◦ Coding Interpretation

The Setup is for BASIC Car Movement such as


Forward, Backward, Right Turn and Left Turn.
BASIC COMPONENTS
Bluetooth HC-05/HC-06
- Communication Device
- To receive Bluetooth signal from the
Android App and pass to the
microcontroller through UNO Board
Pin 2 (RX) and Pin 3 (TX)

L293D Motor Driver


- Receive the input signal from the
Arduino Pin 5, 6, 10 and 11 so as to
alter the current supplied to the
right and left motor
- The result is that the right and left
motor can move at different speed
and direction
BASIC COMPONENTS – UNO BOARD

INPUT – Bluetooth
signal received from
Digital Pin 2 (RX) and
Pin 3 (TX)

OUTPUT – Voltage
output sent to the
L293D motor driver
from Pin 5, Pin 6 (For
left motor) and Pin 10,
Pin 11( for right
motor)
SCHEMATIC FOR SETTING UP RC CAR
DC Motor Right

Top
Bluetooth HC-06

DCCDuino Board Bottom

Top

H-Bridge L293D Bottom


DC Motor Left
Motor Driver

CONNECTION:
BT TX → D2 (RX)
BT RX → D3 (TX)
IN1 →D11
IN2 →D10
IN3 →D6
IN4 →D5

Battery
HOW ARDUINO RC CAR FUNCTIONS?

Bluetooth HC-06
1. Android App sending 2. Pass signal
wireless signal to to UNO
Bluetooth HC06 controller
connected to UNO thru Pin 2/3
board
INPUT

4. Motor Driver 3. Controller


alters current sending
sent to the H-Bridge L293D
Motor Driver output signal
motors for to motor
speed and driver thru
direction control Pin 5/6/10/11

DCCDuino Board
Right and Left DC Motor
OUTPUT
 THE LOGIC BEHIND CAR MOVEMENT
◦ FORWARD
◦ BACKWARD
◦ TURNING RIGHT
◦ TURNING LEFT
VOLTAGE/CURRENT FLOW VS MOTOR TURNING DIRECTION

+ve Motor RT = 5V
Motor RB = 0V
-ve

*In case of right motor, when pin RT (pin 11) supplies


5V and RB (pin 10) supplies 0V, right motor turn in
one direction. Same principle applies in left motor.

-ve
Motor RT = 0V
+ve Motor RB = 5V

*In case of right motor, when pin RT (pin 11) supplies


0V and RB (pin 10) supplies 5V, right motor turn in
opposite direction. Same principle applies in left
motor.
IN FULL STOP
SITUATION
Speed vel =150

Speed 0 LT(Pin5) RT(Pin11) Speed 0


Speed 0 LB(Pin6) RB(Pin10) Speed 0

ZERO voltage to all


motor pins, thus fully
STOP
IN FORWARD
SITUATION
Speed vel =150

Speed 0 LT(Pin5) RT(Pin11) Speed 0


Speed vel LB(Pin6) RB(Pin10) Speed vel

Both Motors move at


the same speed and
same direction
IN BACKWARD
SITUATION
Speed vel =150

Speed vel LT(Pin5) RT(Pin11) Speed vel


Speed 0 LB(Pin6) RB(Pin10) Speed 0

Both Motors move at


the same speed and
OPPOSITE direction
IN RIGHT TURN
SITUATION
Speed vel =150

Speed 0 LT(Pin5) RT(Pin11) Speed 0


Speed vel LB(Pin6) RB(Pin10) Speed 100

Left Motor moves faster


then Right Motor and the
car turns to right direction
IN LEFT TURN
SITUATION
Speed vel =150

Speed 0 LT(Pin5) RT(Pin11) Speed 0


Speed 100 LB(Pin6) RB(Pin10) Speed vel

Right Motor moves faster


then Left Motor and the
car turns to left direction
CODING INTERPRETATION

Set Pin 2 and 3 to be blue tooth serial communication port

Naming UNO Pin Number corresponded


to DC motor position

Set motor speed to 150 (0-255)

Declare Pin 5, 6, 10 and 11 to be


output Pin
CODING INTERPRETATION
F

L
R

The function here is to read the data


received from the android app to be
in CASE of ‘F’ (forward), ‘B’
(backward), ‘R’(right turn) and ‘L’ (left
turn) or ‘S’ (fully stop).

And for each CASE, the program


would execute different commands
accordingly.
CODING INTERPRETATION

Case of ‘F’ – Car Forwarding

Case of ‘B’ – Car In Reverse

Case of ‘L’ – Car Turning Left


CODING INTERPRETATION

Case of ‘R’ – Car Turning Right

Case of ‘S’ – Car Fully Stop


AGENDA PART II
ARDUINO RC CAR UPGRADE
◦ Upgrade Package
◦ Components
◦ How they connect? (Schematics)
◦ How they function?
 Input and Output
◦ Change of Coding
UPGRADE PACKAGE
1. LDR Module with LED Front Lamp - When the
environment is dark, the LED front lamp would
turn on

2. Back Lamp with Buzzer – When the car is


reversing, the back lamp and buzzer would turn
on to alert people
UPGRADE COMPONENTS

LDR Sensor Module (INPUT)


- LDR Value varies with light received

- LDR Module can be (i) set as analog


input which provides an analog value to
the controller or (ii) a digital input device
to feedback ‘0’ and ‘1’ to the controller

- In our case, we use digital method where


a state condition (0 or 1) to be fed to
the controller. We control the threshold/
sensitivity with the potentiometer on
board
UPGRADE COMPONENTS

LED and Buzzer (OUTPUT)


- LED and Buzzer would get turned
LEDs and jumpers are used to on after certain condition set in the
construct car lamps program reach
- We use LEDs to construct front
lamp and back lamp for the RC car

Buzzer Type
SCHEMATIC OF UPGRADE KIT
CONNECTION:
Head light D12 > LED Y1> LED Y2> GND
Back light D4 > LED R1> LED R2> GND
anode anode
D12 D4
D13
cathode cathode
GND

GND

anode anode
GND
5V
cathode cathode
D7

LDR Sensor Module


HOW UPGRADE KIT FUNCTIONS
INPUT OUTPUT

Provide Turn on LED


LDR if LDR turn
State 0/1 from ‘0’ to ‘1’

LDR Sensor
Turn on LED and
buzzer when car in
reverse direction
CHANGE OF CODING NO #1

Adding naming of LDR module, LED and


Buzzer in the coding

Set initial LDR State to be 0

Declare (1) Pin 7 LDR pin as input pin


(II) Pin 4, 12, 13 as output pin
CHANGE OF CODING NO #2

Read the state of LDR module

If it is dark enough, the


LDR status would change
to “1” and light would
turn on accordingly
CHANGE OF CODING NO #3

Turn on back light and a


small buzzer program
when car reversing

Turn OFF all back lights and the


buzzer when car in stop
CHANGE OF CODING NO #4

Small buzzer beeping function

Вам также может понравиться