KS0470 Keyestudio 4WD BT Robot Car V2.0 Kit for Arduino

From Keyestudio Wiki
Revision as of 10:57, 27 August 2020 by Keyestudio (talk | contribs) (→‎Component List)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


KS0470 Keyestudio 4WD BT Robot Car V2.0 Kit for Arduino


Description

The popularity of Maker Education has resulted in a variety of Maker products, some of which are combinations of electronic components and modules, and some are novel and innovative products.
The 4WD multifunctional smart car newly upgraded by the Keyestudio Group is one of the most popular categories: programming robots.
It is not only beautiful in appearance, but also powerful in function.Except for the commonly used functions of tracking, obstacle avoidance, remote control, etc.,a facial expression is added too, you can DIY your own cute expression, amazing! If you think it’s not enough, you can add other sensors to complete your exploration journey.



Parameters

  • Motor control is driven by L298P expansion board, built-in power control switch.
  • Ultrasonic module is used to detect whether there is front obstacles and the distance between the obstacle and the 4WD BT Robot Car. The 4WD BT Robot Car obstacle avoidance system is formed.
  • Motor’s Parameters: 5V 200 rpm/ min
  • Provide graphical programming test code and support Mixly.
  • Bluetooth wireless module can match with Bluetooth on mobile phone to remotely control the 4WD BT Robot Car, and supports Android and IOS system.
  • Can access to the external voltage 7~12V, and can carry various sensor modules, achieve all kinds of functions according to your imagination.
  • IR receiver module matches with IR remote control to control 4WD BT Robot Car

Component List

No Name QTY Picture
1 Keyestudio Arduino REV4 Board 1 KS0470-1-1(2).jpg
2 Keyestudio quick connectors motor driver shield V2 1 0470-2.png
3 Keyestudio HM-10 Bluetooth-4.0 V3 compatible HC-06 pin 1 0470-3-1.png
4 HC-SR04 ultrasonic sensor 1 0470-3-2.png
5 Keyestudio quick connectors line tracking sensor 1 0470-3-3.png
7 Keyestudio 8X16 LED light board with DuPont line 1 0428图片20.png
8 Keyestudio 9G 23*12.2*29mm black servo 180° with white mounts 1 0470-12.png
9 Keyestudio JMFP-4 17 button 86*40*6.5MM yellow eco-friendly(without battery) 1 0470-13.png
10 AM/BM clear blue OD:5.0 L=50cm eco-friendly 1 0470-14.png
11 18650 2-cell 15CM Dew line for DIY car+double headJST-PH2.0MM-2P wire(bus length115MM) 1 0470-15.png
12 6-cell AA with 15CM dew line + double head JST-PH2.0MM-2P cable (bus length 200MM) 1 0470-16.png
13 Pan tilt mount(black) kit 1 0470-17.png
14 Double head JST-PH2.0MM-5P 24AWG blue green yellow red black line 15CM 1 0470-18.png
15 Double head JST-PH2.0MM-3P 24AWG yellow red black line 8CM 1 0470-19.png
16 JST-PH2.0mm-4P to 2.54 DuPont female single 26AWG black red blue green line 1 0470-20.png
17 The front acrylic board of 4WD car LED screen 1 0470-21.png
18 Keyestudio 4WD smart car V2.0 Top PCB board 1 0470-22.png
19 Keyestudio 4WD smart car V2.0 bottom PCB 1 0470-23.png
20 Fixed parts 23*15*5MM 9MM pitch aluminum 4 0470-24.png
21 Wheel 68*26mm Shaft inner diameter: 5.3*3.6mm Wheel hub: yellow Tire: black 4 0470-25.png
22 M3*10MM dual-pass copper pillars 10 0470-26.png
23 M3*40MM dual-pass copper pillar 4 0470-27.png
24 M3*30MM round-head cross screw 8 0470-28.png
25 M3*6MM round-head screw 40 0470-29.png
26 M3 Nickel Plated Nut 16 0470-30.png
27 M2X8MM round-head screw 6 0470-31.png
28 M3*8MM round-head screw 4 0470-32.png
29 M2 Nickel Plated Nut 6 0470-33.png
31 5V 200/rpm gear motor (with welding wire) 4 0470-35.png
32 3*40MM screwdriver 1 0470-36.png
33 black Nylon cable 3*100MM 10 0470-37.png
34 Winding tube diameter 8MM black 1 0470-38.png


Resources

https://fs.keyestudio.com/KS0470


Getting Started with Mixly and ARDUINO

Installing Arduino IDE

We enter the ARDUINO official website: https://www.arduino.cc, we’ll see the following page,


0470-3.png

The software we’ll download is in the SOFTWARE section.


0470-4.png

Click the icon as below:


0470-5.png

We can find IDE software which is compatible with various versions and systems. We choose the 1.8.5 version of the IDE, you can choose other versions according to your personal preferences.


0470-39.png
The Windows version also has two options,for one option that we could directly click on “install” to download the file. Another choice is to download the file to the computer firstly, then extract the file, and open the program file of the ARDUINO icon to start.

1. Installing Driver


Following the previous method, we installed the Arduino IDE software. Before using it, we need to install the driver of the REV3 development board, otherwise it will not be used. The driver file can be used of the drivers file in the link, or the built-in drivers file can be used too after installing.

0470-40.png
There are some small differences for installing driver on different computer systems. Next, we introduce the method of installing the driver in the WIN 7 system. Firstly connect the development board to the computer, click on Computer--Properties--Device Manager to display the following figure.
15937.png

Click “Unknown device” to install the driver, as shown below.


15938.png

Enter this following page and choose:


15939.png

Find the drivers folder for the installation of Arduino.


0470-44.png

Click "Next" and click "Install this driver software anyway" t to start installing driver .


15941.png

Complete driver installation, click “Close” as shown below


15942.png

This drive is installed. Click on Computer--Properties--Device Manager, we can see the following figure.


15943.png

2. Getting started with Arduino IDE

Step 1: Open software In the previous lesson, we successfully installed the driver for the REV3 development board. In this lesson, let's learn how to use the Arduino IDE software. We open the folder with decompressed ARDUINO development software and click the ARDUINO icon to open the software.


0470-50.png

Step 2: Create project Once the software starts, you have two options: Create a new project. Open an existing project example. To create a new project, choose Flie→New please.



0470-51.png 0470-52.png

Open an existing project example, choose File→Example→Basics→Blink please.


0470-53.png

0470-54.png

Step 3: Select Arduino main board To avoid any errors when uploading the program to the board, you need to select the correct Arduino board. Go to Tools→Board and select your board.


0470-55.png

Here, we chose the Arduino UNO board according to our tutorial. Step 4: Select the serial port. Select the serial device of the Arduino board. Go to the Tools→Serial Port menu. We can find the corresponding COM port by clicking Computer--Property-Device Manager.


File:1594br3.png
0470-57.png

Step 5: Upload the program to your board

Before explaining how to upload our program to the board, we demonstrate the functionality of each symbol that appears in the Arduino IDE toolbar.

0470-58.png

A - for checking any compile error
B - for uploading programs to the Arduino board
C - for creating shortcut for a new sketch
D - for opening one of the sample sketches directly
E - for saving sketches
F - for receiving serial data from the board and sending serial data to the board of serial monitor

How to import library folder of Arduino IDE

Sometimes, when uploading the code, we need to add the corresponding library file. Firstly we open the folder with decompressed ARDUINO development software and find the libraries folder.
0470-59.png

Then place the corresponding folder with the library file in the libraries folder. This library file is installed.
Note: If the Arduino IDE software is already open when the library file is placed, need to close the Arduino IDE and re-open the Arduino IDE. The library file will take effect, otherwise the library file will be invalid. Specific methods you can refer to:

https://wiki.keyestudio.com/How_to_Install_Arduino_Library website.

Downloading Mixly Software

Next,we will learn about Mixly graphical programming software. Firstly we need to download a Mixly software. More info please check the link to download the Mixly blocks software.
https://fs.keyestudio.com/WINMixly
https://fs.keyestudio.com/MACMixly

Getting started with Mixly

Introduction for Mixly

Mixly is a free open-source graphical Arduino programming software, based on Google’s Blockly graphical programming framework, and developed by Mixly Team@ BNU. It is a free open-source graphical programming tool for creative electronic development; a complete support ecosystem for creative e-education; a stage for maker educators to realize their dreams.

Mixly functions

Through this interface, you can complete the code compile、upload、save and manage. It support four remove methods: drag it left out code window, or drag to Recycle Bin, delete key, or right-click to delete block. It supports four languages: English, Spanish, Chinese Simplified and Chinese Traditional.
3.1-1.png
Ks0446图片8.png

(1)In/Out Block
0470-63.png

(2)Control Block
0470-64.png

(3) Math Block
0470-77.png

(4) Text Block
0470-66.png

(5) List Block
0470-67.png

(6) Logic Block

0470-68.png


(7)Variable Block

0470-69.png


(8) SerialPort Block
0470-70.png

(9)Communicate Block
0470-71.png

(10) Sensor Block
0470-72.png

(11)Actuator Block

0470-73.png


(12)Monitor Block

0470-74.png


(13)Function Block
0470-75.png

How to import file on Mixly

To facilitate the car program process, we specially design a smart library file for this smart car. The import, export, and editing of library files are shown below:

0470-76.png

Click”import” to enter library folder, click 0470-78.png,the library file is imported successfully.

Getting Started with Hardware Projects for 4WD BT Robot Car

In this course, we will start testing the functions of various electronic components in the kit to ensure that each component is good.

Project 1: REV4 Control Board

KS0470-1-1(2).jpg
When it comes to using the REV4 as core of our robot, the REV4 is the best board to get started with electronics and coding.
If this is your first experience tinkering with the platform, the REV4 is the most robust board you can start playing with.
Well, let's at first have a look at this REV4 board.
KS0341 引脚标图.jpg

KS0001 5-1.png ICSP (In-Circuit Serial Programming) Header

In most case, ICSP is the AVR,an Arduino micro-program header consisting of MOSI, MISO, SCK, RESET, VCC, and GND. It is often called the SPI (serial peripheral interface) and can be considered an "extension" of the output. In fact, slave the output devices under the SPI bus host.
When connecting to PC, program the firmware to ATMEGA328P-PU.

KS0001 5-2.png Power LED Indicator

Powering the Arduino, LED on means that your circuit board is correctly powered on. If LED is off, connection is wrong.

KS0001 5-3.png Digital I/O

Arduino UNO has 14 digital input/output pins (of which 6 can be used as PWM outputs). These pins can be configured as digital input pin to read the logic value (0 or 1). Or used as digital output pin to drive different modules like LED, relay, etc. The pin labeled “〜” can be used to generate PWM.

KS0001 5-4.png GND ( Ground pin headers)

Used for circuit ground

KS0001 5-5.png AREF

Reference voltage (0-5V) for analog inputs. Used with analogReference().

KS0001 5-6.png SDA

IIC communication pin

KS0001 5-7.png SCL

IIC communication pin

KS0001 5-8.png ICSP (In-Circuit Serial Programming) Header

In most case, ICSP is the AVR,an Arduino micro-program header consisting of MOSI, MISO, SCK, RESET, VCC, and GND. Connected to ATMEGA 16U2-MU. When connecting to PC, program the firmware to ATMEGA 16U2-MU.

KS0001 5-9.png RESET Button

You can reset your Arduino board, for example, start the program from the initial status. You can use the RESET button.

KS0001 5-10.png D13 LED

There is a built-in LED driven by digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.

KS0001 5-11.png USB Connection

Arduino board can be powered via USB connector. All you needed to do is connecting the USB port to PC using a USB cable.

KS0001 5-12.png ATMEGA 16U2-MU

USB to serial chip, can convert the USB signal into serial port signal.

KS0001 5-13.png TX LED

Onboard you can find the label: TX (transmit) When Arduino board communicates via serial port, send the message, TX led flashes.

KS0001 5-14.png RX LED

Onboard you can find the label: RX(receive ) When Arduino board communicates via serial port, receive the message, RX led flashes.

KS0001 5-15.png Crystal Oscillator

Helping Arduino deal with time problems. How does Arduino calculate time? by using a crystal oscillator.
The number printed on the top of the Arduino crystal is 16.000H9H. It tells us that the frequency is 16,000,000 Hertz or 16MHz.

KS0001 5-16.png Voltage Regulator

To control the voltage provided to the Arduino board, as well as to stabilize the DC voltage used by the processor and other components.
Convert an external input DC7-12V voltage into DC 5V, then switch DC 5V to the processor and other components.

KS0001 5-17.png DC Power Jack

Arduino board can be supplied with an external power DC7-12V from the DC power jack.

KS0001 5-18.png IOREF

Used to configure the operating voltage of microcontrollers. Use it less.

KS0001 5-19.png RESET Header

Connect an external button to reset the board. The function is the same as reset button (labeled 9)

KS0001 5-20.png Power Pin 3V3

A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.

KS0001 5-21.png Power Pin 5V

Provides 5V output voltage

KS0001 5-22.png Vin

You can supply an external power input DC7-12V through this pin to Arduino board.

KS0001 5-23.png Analog Pins

Arduino UNO board has 6 analog inputs, labeled A0 through A5.
These pins can read the signal from analog sensors (such as humidity sensor or temperature sensor), and convert it into the digital value that can read by microcontrollers) Can also used as digital pins, A0=D14, A1=D15, A2=D16, A3=D17, A4=D18, A5=D19.

KS0001 5-24.png Microcontroller

Each Arduino board has its own microcontroller. You can regard it as the brain of your board.
The main IC (integrated circuit) on the Arduino is slightly different from the panel pair. Microcontrollers are usually from ATMEL. Before you load a new program on the Arduino IDE, you must know what IC is on your board. This information can be checked at the top of IC.


Project 2: Adjusting Servo Angle

Overview
Servo motor is a position control rotary actuator. It mainly consists of housing, circuit board, core-less motor, gear and position sensor.  Included with your servo motor you will find a variety of white motor mounts that connect to the shaft of your servo. You may choose to attach any mount you wish for the circuit. It will serve as a visual aid, making it easier to see the servo spin.

0464-pro8图1.png

Working principle:
The receiver or MCU outputs a signal to the servomotor. The motor has a built-in reference circuit that gives out reference signal, cycle of 20ms and width of 1.5ms. The motor compares the acquired DC bias voltage to the voltage of the potentiometer and outputs a voltage difference. Servo motor comes with many specifications. But all of them have three connection wires, distinguished by brown, red, orange colors (different brand may have different color). Brown one is for GND, red one for power positive, orange one for signal line.

The rotation angle of servo motor is controlled by regulating the duty cycle of PWM (Pulse-Width Modulation) signal. The standard cycle of PWM signal is 20ms (50Hz). Theoretically, the width is distributed between 1ms-2ms, but in fact, it's between 0.5ms-2.5ms. The width corresponds the rotation angle from 0° to 180°. But note that for different brand motor, the same signal may have different rotation angle. 

0470-82.png

We can directly set the output high and low level of the corresponding pin on Mixly to control the angle of servo; and we specially set library file of smart car via one code to control, which is easy and convenient.

Specifications:

  • Working voltage: DC 4.8V~6V
  • Operating angle range: About 180° (at 500 → 2500 μsec)
  • Pulse-width range: 500 → 2500 μsec
  • No-load speed: 0.12±0.01 sec/60 (DC 4.8V) 0.1±0.01 sec/60 (DC 6V)
  • No-load current: 200±20mA (DC 4.8V) 220±20mA (DC 6V)
  • Stop torque: 1.3±0.01kg·cm (DC 4.8V) 1.5±0.1kg·cm (DC 6V)
  • Stop current: ≦850mA (DC 4.8V) ≦1000mA (DC 6V)
  • Standby current: 3±1mA (DC 4.8V) 4±1mA (DC 6V)
  • Wire length: 250 ± 5 mm
  • Appearance size: 22.9*12.2*30mm
  • Weight: 9 ± 1 g (without servo horn)
  • Storage temperature: -20 ° C ~ 60 ° C
  • Operating temperature: -10 ° C ~ 50 ° C

Wiring Diagram

0470-83.png

Test Code

0470-84.png

Test Result
Upload the code on the REV4 board successfully, power on according to wiring diagram, the servo will swing back and forth in the range of 0° to 180°.

Little Knowledge
1)In the code, the default signal interface of library file is A3.
2)0470-85.png
represents variable i, i increases directly from 0 to 180, by 1 each time, 180 times in total.
3)0470-86.png represents variable i, i directly decreases from 180 to 0, by 1 each time, 180 times in total.
4)0470-87.png means the angle of servo, the range of this servo angle is 0-180 degree.

Extension Practice:
1)Increase angle of servo from 0° to 180°, increase by 2° each time, then gradually reduce from 180° to 0° , each time by 5°.
2)Set servo to 90°.

Project 3: Ultrasonic Detecting Obstacles

Overview:
In the process of smart car DIY, the ultrasonic module is a very commonly used sensor module. The module can detect whether there is obstacle ahead. We can also know about the distance between the smart car and the obstacle through calculation. The smart car is controlled by the the distance that the ultrasonic detects, so as to realize various functions, such as automatic avoiding, following, etc. In the experiment, we test the corresponded distance by detecting the ultrasonic module and the obstacle ahead, and display on the serial monitor.

  • Working Voltage: DC 5V
  • Working Current: 15mA
  • Working Frequency: 40KHz
  • Max Range: 2--3m
  • Min Range: 2cm
  • Measuring Angle: 15 degree
  • Trigger Input Signal: 10µS TTL pulse

Wiring Diagram
0470-88.png
Test Code
0470-89.png

Test Result
In the experiment, we use the USB cable to supply power, upload the test code, open the serial monitor and set the baud rate to 9600, we can see the distance between the ultrasonic module and the obstacle ahead ( cm), as shown below:
464图片46.png

Knowledge
1. Use 0470-91.pngto test distance, the wire interface can’t be changed at you will. The library file has been fixed to the wiring port, and the interface cannot be changed. 2. Click 0470-92.png,observe the C language code, you can find the corresponding interface and calculation formula in the code.

Extension Practice
We can test the data measured by the ultrasonic to control the angle of rotation of servo. For example, when the distance is less than 15cm, set servo to 60º; when the distance is greater than or equal to 15cm, set servo to 120º.

Project 4: LED Matrix Display Pattern

Overview
This is a smart car kit with built-in an 8x16 LED light board that can be used to display various states of the smart car. Firstly let's learn the next 8x16 LED board. The 8x16 LED board comes with 128 LEDs and an AIP1640 chip. We can use the MCU and this module for I2C communication. By controlling the AIP1640 chip,the on/off of the 128 LEDs on the module is controlled and the pattern you need is displayed on the dot matrix of the module. To facilitate wiring, we also provide a HX-2.54 4Pin wiring.

Specifications:

  • Working voltage: DC 3.3-5V
  • Power loss: 400mW
  • Oscillation frequency: 450KHz
  • Driver current: 200mA
  • Working temperature: -40~80°C
  • Communication method: I2C communication

Wiring Diagram

0470-93.png

Test Code
0470-94.png
Test Result

Upload the code on the REV4 board successfully, wire according to connection diagram, DIP switch is dialed to the right end. After power-on, 8X16 LED matrix circularly displays starts "V" pattern, forward pattern, backward pattern, leftward pattern, rightward pattern and stop pattern with a time interval of 2 seconds.

Knowledge
In the code, we have set the display state of the LED matrix in the library. 1.0470-95.pngcode is adjustable, it has 7 conditions 0470-95.png stands for clearing up display. 2. 0470-97.png is delay code,which stands for delay 2000ms,we can set the digits freely. Set the delay time to control the display frequency of LED matrix

Extension Practice
1.Set the code to make the LED matrix circularly display 7 states, the delay time of each state is 500ms.

Project 5: Line Tracking Sensor

Overview:
Ks0313-7(3.png
The tracking sensor is actually an infrared sensor. The component used here is the TCRT5000 infrared tube.
Its working principle is to use the different reflectivity of infrared light to the color, then convert the strength of the reflected signal into a current signal.
During the process of detection, black is active at HIGH level, but white is active at LOW level. The detection height is 0-3 cm.
The keyestudio 3-channel line tracking module has integrated 3 sets of TCRT5000 infrared tube on a single board, which is more convenient for wiring and control.
By rotating the adjustable potentiometer on the sensor, it can adjust the detection sensitivity of the sensor.


  • Operating Voltage: 3.3-5V (DC)
  • Interface: 5PIN
  • Output Signal: Digital signal
  • Detection Height: 0-3 cm

441图66.png


Special note: before testing, turn the potentiometer on the sensor to adjust the detection sensitivity. When adjust the LED at the threshold between ON and OFF, the sensitivity is the best.

Wiring Diagram
0470-100.png

Test Code

0470-101.png
0470-107.png

Test Result
Upload the code on the REV4 board successfully, wire according to connection diagram , after power-on, the dial switch is dialed to the "ON" end. When any TCRT5000 infrared tube of the module detects the white line, the 8X16 LED matrix starts displaying “V" pattern; otherwise, 8X16 LED panel does not display patterns.

Knowledge
In the code 0470-102.png,which stands for using library file to read High/Low level of left sensor(D6), its function is as same as 441图72.png. At same time,the signal end of middle sensor corresponds to D7,the signal end of right sensor corresponds to D8.

In the code 0428图片45.png, it means that if condition 1 is met, the result is A, otherwise the result is B. When using it, you only find it on Mixly 0470-105.png sentences,click blue gear icon, then drag0470-106.png to 0470-107.png block. Set successfully.
0470-108.png

In the experimentis 0470-109.pnglogic sentence, it is required to meet one of three requirements.

Extension Practice

  • Change the above code into the code without library file, the same function is required.
  • Set up the three control terminals of the tracking module. Control the servo to rotate at different angles.

Project 6: Infrared Receiver

There is no doubt that infrared remote control is commonly seen in our daily life. It's hard to imagine our world without it. In reality, an infrared remote control can be used to control a wide range of home appliances such as television, audio, video recorders and satellite signal receivers. Well, in the following let’s get a better understanding of the infrared remote control. Infrared remote control is composed of infrared transmitting and infrared receiving systems. That is, consist of an infrared remote control, an infrared receiver module and a microcontroller that can decode.

Ks0436-201.png

The 38K infrared carrier signal transmitted by an infrared remote controller is encoded by an encoding chip inside the remote controller. It is composed of a pilot code, user code, data code, and data inversion code. The time interval between pulses is used to distinguish whether it is a signal 0 or 1. (when the ratio of high level to low level is about 1:1, considered as signal 0.) And the encoding is just well composed of signal 0 and 1. The user code of the same button on remote controller is unchanged. Using difference data distinguish the key pressed on the remote control. When press down a button on the remote control, it will send out an infrared carrier signal. And when infrared receiver receives that signal, its program will decode the carrier signal, and through different data codes, thus can judge which key is pressed. The microcontroller is decoded by an received signal 0 or 1 to determine which key is pressed by the remote control. As for an infrared receiver module, it is mainly composed of an infrared receiving head. This device integrates with reception, amplification and demodulation. Its internal IC has been demodulated, able to complete all the work from infrared reception to output TTL level signal compatible. It outputs Digital signal. Suitable for IR remote control and infrared data transmission. The infrared receiver module has only three pins (Signal line, VCC, GND), very convenient to communicate with Arduino and other microcontrollers.

Parameters of IR Receiver:

  • Operating Voltage: 3.3-5V(DC)
  • Interface: PH2.0-3P
  • Output Signal: Digital signal

Wiring Diagram
0470-111.png
Test Code
0470-112.png

Test Result In the experiment, we use the USB cable to supply power, upload the test code, open the serial monitor, set the baud rate to 9600, take out the remote control which points to infrared receiving sensor to send the signal. The key value of the corresponding button is shown. If pressed for long time, error codes will appear, as shown below.
0470-113.png

If the forward value of the infrared remote control is received, the dot matrix displays the forward pattern. If the key value of infrared remote control is “OK”, pattern “STOP”appear. We made a remote control button value table through the obtained values, which is convenient for future use.
0470-114.png

Knowledge

1.In the code 0470-115.png, it represents that library file is used directly, The signal terminal of the infrared receiving module is A1, infrared receiver module receives the infrared signal, outputs the 16-bit code, and displays on the serial monitor (baud rate 9600). 2.Through the code we can measure the 16-bit code of all keys of the infrared remote control, you can refer to the above picture.

Extension Practice
1.We control the LED matrix by infrared remote control to display different patterns and control the servo to rotate at different angles.

Project 7: Motor Driving and Speed Control

Overview:
There are many ways to drive the motor. Our robot uses the most commonly used L298P solution. L298P is an excellent high-power motor driver IC produced by STMicroelectronics. It can directly drive DC motors, two-phase and four-phase stepping motors. The driving current up to 2A, and output terminal of motor adopts eight high-speed Schottky diodes as protection.

We have designed the motor driver shield V2 based on the L298P circuit. The stackable design can make it be plugged directly into the Arduino, reducing the technical difficulty of using and driving the motor. Direct stack the motor driver shield onto REV4 board, after the BAT is powered on, turn the Slide switch ON, to supply the power for both keyestudio motor driver shield V2 and REV4 board. For simple wiring, the motor driver shield comes with anti-reverse interfaces. When connecting the motor, power supply and sensor modules, you just need to plug in directly.

The Bluetooth interface on the motor driver shield is fully compatible with keyestudio HM-10 Bluetooth module. When connecting, just plug HM-10 Bluetooth module into the corresponding interface.

At the same time, the motor drive shield has brought out extra digital and analog ports in 2.54mm pin headers, so that you can continue to add other sensors for experiments extension. The motor drive shield can access to 4 DC motors, defaulted by jumper connection. The motor connector A and A1, connector B and B1 are separately in parallel.

The 8 jumpers can be applied to control the turning direction of 4 motors. For instance, if change the 2 jumpers near the motor A connector from horizontal connection to vertical connection, the turning direction of motor A is opposite to the original rotation direction.

Specifications:
Logic part input voltage: DC5V Driving part input voltage (limit): DC 6-18V Driving part input voltage (recommended): DC 7-12V Driving part input voltage: DC 7-12V Logic part working current: <36mA Driving part working current: <2A Maximum power dissipation: 25W (T=75℃) Working temperature: -25℃~+130℃

PIN Instructions:
0435英.png

Wiring Diagram
0470-117.png

Driving Motor
According to the wiring diagram, default the jumper connection method. Follow the table below to drive the 2 motors rotate by Digital, PWM pins, so as to control the robot car run. The PWM value is in the range of 0-255. The greater the value set, the faster the motors rotate.
0470-118.png


Test Code

0470-119.png

Test Result
Upload the code on the REV4 board successfully, wire according to the connection diagram, after power-on, the DIP dial switch is dialed to the "ON" end, the smart car forward for 2 seconds, back for 2 seconds, stop for 2 seconds, rotate to left for 2 seconds, turn right for 2 seconds, alternating cycles.

Knowledge
1)Driving robot car to run by the library files in the code, which is simple and convenient. The length of code is saved. 2) Click 0470-120.pngon Mixly, we can see the C code that is compatible with the Arduino IDE, so as to know how the smart car controls the rotation of the motor.


Extension Practice
Reset the movement track of robot car through the library,so as to drive running according to your requirements.

4WD BT Robot Car Assembly Guide

Follow the assembly steps to build your own robot car.

1. Fix 4 motors on the bottom PCB board with 8 M3*30MM round-head screws, 8 M3*6MM round-head screws, 8 M3 nickel plated nuts and 4 black holders.

0470-121.png

2.Install the Keyestudio quick connectors tracking sensor on the bottom PCB board with 2 M3*8MM round-head screws and 2 M3 nickel-plated nuts.
Fix 6 M3 *40MM double-pass copper pillars on the bottom PCB board with 6 M3*6MM round-head screws; at the same time, mount 4 wheels on the motor.
0470-122.png0470-123.png
3.Fix Keyestudio 8X16 LED matrix onto the LED matrix acrylic baffle in front of the 4WD car with 4 M2X8MM round-head screws and 4 M2 nickel-plated nuts, and then connect the HX-2.54 4P to DuPont(female) line on the acrylic board.
0470-124.png

4.Install the PTZ servo. Pay attention to set the servo to 90° before installation. When the ultrasonic module is facing directly in front, the steering angle is 90°. 0470-125.png0470-126.png
5. Mount the ultrasonic sensor on the pan/tilt by two Nylon cables, and connect the JST-PH2.0mm-4P 2.54 DuPont line (female) to the ultrasonic sensor. 0470-127.png 0470-128.png
6. Fix the control board on the bottom PCB board with 8 M3*6MM round-head screws and 4 M3*10MM double-pass copper pillars, and stack the motor drive boards on the control board.

QQ图片20191231131703.pngQQ图片20191231131715.png

7.Fix the PTZ servo on the top PCB board with 8 M3*6MM round-head screws and 4 M3*10MM double-pass copper pillars.

 0470-131.png

8.Install 6 AA battery cases (or 2 18650 battery cases) on the top PCB board with 2 M3*10MM flat screws and 2 M3 nickel plated nuts; mount the Keyestudio quick connectors infrared receiver sensor on the PCB board with 1 M3*8MM round-head screw and 1 M3 nickel-plated nut and connect the two-head JST-PH2.0MM-3P line to the sensor.

0470-132.png0470-133.png

9.Connect the double-ended JST-PH2.0MM-5P cable to the Keyestudio quick connectors tracking sensor.
0470-134.jpg

10.Install the accessories of step 9, 8, and 3 with 6 M3*6MM round-head screws.

0470-135.png

11.According to the wiring method,wire and correspond to the silk-screen on the acrylic board. There are M1 M2 M3 M4 interfaces on acrylic board correspond to 4 ports of motor on the drive board. As shown below.
0470-136.png 0470-137.png

12.The 8 jumper caps and the Keyestudio HM-10 Bluetooth-4.0 are plugged into the motor driving board and the installation is complete. Note: when uploading the test code, you need to remove the Keyestudio HM-10 Bluetooth-4.0, and then reconnect the code after successfully uploading, otherwise the upload code fails. 0470-138.png 0470-139.png

Getting Started with for 4WD BT Robot Car Projects

Project 8: Line Tracking Robot Car

Circuit Design In the above sections we already introduced the various sensors, modules, and expansion board and other hardware. In the project, we make the robot detect black line at the car bottom with line tracking sensor. Then control the 2 motors rotation by measured result, so as to drive the robot track black line.

Below is a specific logic table of line tracking robot car for your reference:
0470-144.png

Building Line Tracking Robot: We start making smart cars according to the design ideas. We need to design the corresponding wiring, test code, then upload code and run to ensure that the smart car can achieve the ideal function.

Wiring Diagram

0470-141.png
Test Code

0470-142.png

Test Result
Upload the code on the REV4 board successfully. Stack the expansion board on the REV4 board and wire it according to connection diagram. After power-on, the DIP switch will be dialed to the “ON” end, and the smart car can walk along the black line.

Project 9: Ultrasonic Follow Robot Car

Circuit Design
We combine the hardware knowledge -- various sensors, modules, motor drive, to build an ultrasonic follow robot car! In the circuit process, we can make use of ultrasonic sensor to detect the distance between robot car and front obstacles. Control the motor rotating by measured data, thus control the motion of robot car. The specific logic of ultrasonic follow robot car is as shown below:
0470-143.png

Building Ultrasonic Follow Car
After designing the smart car, we start making smart cars according to the design ideas. We need to design the corresponding wiring, test the code, and then wire and upload code to drive, ensuring that the smart car can achieve the ideal function.

Wiring Diagram


0470-145.png

Test Code


0470-146.png

Test Result
Upload the code on the REV4 board successfully, wire according to connection diagram wiring, after the DIP switch is dialed to the right end, the smart car can move with the movement of the obstacle ahead (only on one line, can not turn)

Project 10: Ultrasonic Avoiding Smart Car

Circuit Design
We combine the hardware knowledge -- LED matrix, motor drive, ultrasonic and servo, to build an ultrasonic avoiding robot! In the circuit process, we can make use of ultrasonic sensor to detect the distance between robot and front obstacles. Control the motor rotating by measured data, thus control the robot motion and show the running state by dot matrix. The ultrasonic avoiding capability is almost the same as the ultrasonic following function. We only need to change the source code.

The specific logic of ultrasonic avoiding smart car is as shown below:
0470-147.png

Building Ultrasonic Avoiding Smart Car
After designing the smart car, we start making smart cars according to the design ideas. We need to design the corresponding wiring, test the code, then wire and the upload code to drive, ensuring that the smart car can achieve the ideal function.

Wiring Diagram

0470-148.png
Test Code

0470-149.png

Test Result
After uploading the code on the REV4 board, wire according to connection diagram. After the DIP switch is dialed to the right end, the smart car can automatically avoid obstacles.

Project 11: IR Remote Control Smart Car

Circuit Design
We combine the hardware knowledge -- sensors, motor drive, and IR receiver, to build an infrared remote control robot car! In the IR receiver section, we’ve listed out each key value of remote control. In this circuit design, we can set the key value in the code to navigate the robot car movement. The corresponding state pattern is displayed on the 8X16 LED matrix.

The specific logic of infrared remote control robot car is shown below:


0470-150.png

Based on the circuit design, we can start building our own remote control robot.

Wiring Diagram


0470-151.png

Test Code


0470-152.png

Test Result
After uploading the code successfully on the REV4 board, wire according to the connection diagram, after DIP switch is dialed to the right end, we can use the infrared remote control to control the smart car movement. At the same time, the 8X16 LED light board displays the corresponding state pattern.

Project 12: Bluetooth Control Smart Car

Circuit Design
We are now ready to give the turtle robot capability -- Bluetooth remote control! For a control smart robot, there should be a control terminal and a controlled terminal. In the course, we use the mobile phone as the console (host), and the HM-10 Bluetooth module (slave) connected to the robot as the controlled terminal. When using it, we need to install an APP on the phone, and connect the HM-10 Bluetooth module, then we tap the buttons on the Bluetooth APP to navigate the various motion states of robot car.

Bluetooth Remote Control

Bluetooth technology is a wireless standard technology that enables short-distance data exchange between fixed devices, mobile devices, and building personal area networks (using UHF radio waves in the ISM band of 2.4 to 2.485 GHz).

The robot kit is equipped with the HM-10 Bluetooth module, which is a master-slave machine. When use as the Host, it can send commands to the slave actively; when use as the Slave, it can only receive commands from the host.

The HM-10 Bluetooth module supports the Bluetooth 4.0 protocol, which not only supports Android mobile, but also supports iOS system. In the experiment, we default use the HM-10 Bluetooth module as a Slave and the cellphone as a Host. We install the Bluetooth APP on the mobile phone, connecting the Bluetooth module; finally use the Bluetooth APP to control the robot car move, or to control the working status of other sensor modules on the robot car. We provide you with 2 types of mobile APP, for Android and iOS system. In the experiment, connect the Bluetooth module by mobile Bluetooth APP, tap the front button on the Bluetooth APP to control the LED matrix displaying front image; release the button, display the “STOP”.

Parameters of HM-10 Bluetooth Module:
Bluetooth protocol: Bluetooth Specification V4.0 BLE No byte limit in serial port Transceiving In open environment, realize 100m ultra-distance communication with iphone4s

  • USB protocol: USB V2.0
  • Working frequency: 2.4GHz ISM band
  • Modulation method: GFSK(Gaussian Frequency Shift Keying)
  • Transmission power: -23dbm, -6dbm, 0dbm, 6dbm, can be modified by AT command.
  • Sensitivity: ≤-84dBm at 0.1% BER
  • Transmission rate: Asynchronous: 6K bytes ; Synchronous: 6k Bytes
  • Security feature: Authentication and encryption
  • Supporting service: Central & Peripheral UUID FFE0, FFE1
  • Power consumption: Auto sleep mode, stand by current 400uA~800uA, 8.5mA during transmission.
  • Power supply: 5V DC
  • Working temperature: -5 to +65 Centigrade


Using Bluetooth APP

For Android system:
1.There is link for downloading in the file. Download and install directly, installed well, appear the icon below on your mobile phone:


0470-153.png

2.Click above icon to enter app, as shown below:


0470-154.png

3.Done uploading the code to REV4 board, connect the Bluetooth module, the LED on the Bluetooth module will flash. Click on APP 0470-155.pngicon,searching the Bluetooth.

4.Click to connect the Bluetooth. HMSoft connected, Bluetooth LED will turn on normally.


0470-156.png

Wiring Diagram


0470-158.png

Test Code
Special Note: Before uploading the test code, you need to remove the Bluetooth module, otherwise the test code will fail to upload. After the code is uploaded successful, then reconnect the Bluetooth module.

Test Result
After uploading the Test Code on the control board, wire according to connection diagram and install the Bluetooth app on your phone. After powering on the control board with USB cable, open the serial port monitor, set the baud rate to 9600, the Bluetooth indicator flashes, and enter the mobile APP to connect to Bluetooth. After successful connection, press the button of the Bluetooth APP, and the corresponding characters are displayed in the serial monitor. For more details, as shown below.


0470-159.png

Circuit Design
In the previous lesson we tested the control characters on the phone app. We only need use the buttons on the APP to control the sensor modules and driver board on the smart car, so as to control smart car via Bluetooth. Below is 4D Robot Car Bluetooth APP interface and we have listed out what function of each key does


0470-160.png

Circuit Design
After designing the smart car according to the previous ideas, we need to start making smart cars according to the design ideas. We need to design the corresponding wiring, test code, and then wire the upload code to run, to ensure that the smart car can achieve the desired function.

Wiring Diagram

0470-161.png
Test Code
0470-162.png

Test Result
Upload the code on the REV4 board successfully. Stack the expansion board on the REV4 board and wire it according to the connection diagram. After power-on, the DIP switch will be dialed to the “ON” end. After connecting Bluetooth successfully, we can use the mobile APP to control the smart car to move.

Project 13: Bluetooth Multifunctional Robot car

Circuit Design
How to build a multifunctional robot combined with all the functions we’ve learned? In this circuit, we use a complete code to program the smart car to switch different functions with Bluetooth APP, pretty simple and easy.

Wiring Diagram

 
0470-163.png

Test Code


0470-164.png


Test Result
Upload the code on the REV4 board successfully. Stack the expansion board on the REV4 board and wire it according to the connection diagram. After power-on, the DIP switch will be dialed to the “ON” end. After connecting to Bluetooth successfully, we can use the mobile APP to control the smart car to move. We can achieve the corresponding function by pressing the corresponding button.

Get One Now

  • [ Official Websie]