PIKACHU ROBOT USING DC MOTORS AND BLUETOOTH MODULE
In this project you will be introduced to some hardware components that are essential to make moving Pikachu robot wireless using dc motors and Bluetooth module and there various pin configurations and connections.
- Arduino Uno
- USB cable
- Dc motors
- Motor driver IC
KIT: Junkbot Edu kit.
Code brick program:
The program can be depicted on the hardware as illustrated below.
How to test a dc motor:
- How to connect dc motor to Arduino Uno:
- Connect the positive wire (red wire) of the motor to the 5v pin and negative wire (black wire) of the motor to the GND pin (ground pin) of Arduino .
- Now the motor rotates in clockwise direction when you reverse the connections red wire to GND and black to 5v of Arduino motor rotates in anti-clockwise direction.
- Controlling motors with Bluetooth:
To control the directions of the motors we use motor driver IC and the connections are stated below.
- Connect the 5v and GND of Arduino Uno to Vcc and GND pins of motor driver IC.
- Connect the 8,9,10 and 11 pins of Arduino to A-1A, A-1B, B-1A and B-1A of motor driver IC respectively.
- Connect the RXD and TXD of Bluetooth to pin 0(RX) and pin1 (TX) of Arduino Uno.
- Connect Vcc and GND of Bluetooth to VIN and GND of Arduino.
- Set pins 8 and 10 of Arduino to HIGH and connect the positive (red wire) of right motor and left motor respectively.
- Set pins 9 and 11 of Arduino to LOW and connect the negative (black wire) of right motor and left motor respectively.
- How to write code using the code bricks:
- Open the code bricks software.
- Click on the events and drag and change the control of key according to your preference so when press the key the robot moves.
- Click on the events and drag and change the control of key according to your preference so when key is released the robot stops moving.
- Click on robots block and drag and to make the right motor rotating in forward direction.
- Same procedure to left motor drag and to make the left motor rotating in forward direction.
- Now to make your robot moving the forward direction connect all the the blocks above as shown and change the control key from space to W.
- So when you press W the robot will move forward when you release the W it stops.
- Reverse direction of robot can be done by using the same blocks but by just changing the HIGH and LOW options and changed the control key to S.
- So when you press S the robot will move reverse when you release the S it stops.
- To turn right the right motor should go in reverse direction and the left in forward direction as illustrated and changed the control of key to D.
- So when press you D the robot will move right when you release the D it stops.
- To turn left the left motor should go in reverse direction and the right motor in forward direction as illustrated and change the control of key to A.
- So when you press A the robot will move left when you release the A it stops.
- To stop both the motors when space key is pressed.
NOTE: You can change the control keys on your keyboard as per your requirement.
- Establishing Bluetooth connection:
- Even though you connected Arduino to your computer, it won’t start communicating with codebricks until you connect them manually.
- This is represented in codebricks, with dot to show status.
- If the color of dot is red (as illustrated below), it means the communication is not started yet.
- Click connect
- Select the corresponding serial port.
- Go to CONNECT and select the USB port and wait until it says serial port connected.
- The dot will turn from red to green, representing the connection established.
- Connect the USB cable to Arduino and laptop.
- Go to BOARDS and select Arduino Uno
- Once port is connected upgrade the firmware and wait until it upload is finish .
NOTE: Upgrading the firmware is not possible when Bluetooth Module is connected to Arduino.
After upgrading the firmware is finished connect the Bluetooth Module. Disconnect the serial port (USB cable) and connect a power bank to Arduino as source of supply and the connect Bluetooth module.
- Lectures 0
- Quizzes 0
- Duration 50 hours
- Skill level All level
- Language English
- Students 7
- Certificate No
- Assessments Self
Build your own Robot
Build your own Robot