Ks0193 keyestudio Self-balancing Car: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
 
(92 intermediate revisions by the same user not shown)
Line 4: Line 4:
<br>
<br>
==Overview ==
==Overview ==
How to DIY a mini balance car on your own? This balance car kit is based on Arduino development platform. We mainly use UNO R3 as core and balance shield with built-in MPU-6050 as drive board to test the car body posture. <br>
How to DIY a mini balance car on your own? This balance car kit is based on Arduino development platform. We mainly use REV4 as core and balance shield with built-in MPU-6050 as drive board to test the car body posture. <br>
The balance shield comes with a Bluetooth interface, fully compatible with the Bluetooth XBee module (only compatible with Andriod system).<br>
The balance shield comes with a Bluetooth interface, fully compatible with the Bluetooth XBee module (only compatible with Android system).<br>
When connecting to Bluetooth, you can easily control the moving direction of balance car with Bluetooth APP, making a variety of unique postures.<br>
When connecting to Bluetooth, you can easily control the moving direction of balance car with Bluetooth APP, making a variety of unique postures.<br>
To facilitate the operation control, Bluetooth APP has both key and gravity control modes. <br>
To facilitate the operation control, Bluetooth APP has both key and gravity control modes. <br>
Moreover, it adds the function of adjusting the balance angle and PID parameters as well, so you can perfectly adjust and control the balance car. <br>
Moreover, it adds the function of adjusting the balance angle and PID parameters as well, so you can perfectly adjust and control the balance car. <br>
No need to worry how to play it. We can provide you with all assembly components, as well as the corresponding installation, debugging method and program.<br>
No need to worry how to play it. We can provide you with all assembly components, as well as the corresponding installation, debugging method and program.<br>
<br>[[File:UNO R3--.png|400px|frameless|thumb]]<br>
 


<br>
<br>
== Operation Principle ==  
== Operation Principle ==  
The self-balancing car uses the power of the car body to maintain the relative balance, which is a process of dynamic balance. <br>
The self-balancing car uses the power of the car body to maintain the relative balance, which is a process of dynamic balance. <br>
Line 30: Line 31:
<br>  
<br>  
* 1.Motor parameters:
* 1.Motor parameters:
[[File:KS0193-图片4.png|400px|frameless|thumb]]<br>  [[image:KS0193-图片5.png|thumb|300px|right|Motor]]   
[[File:KS0193-图片4.png|400px|frameless|thumb]]<br>   
[[image:KS0193-图片5.png|thumb|300px|right|Motor]] <br>  
* 2.Working voltage: DC 9-12V
* 2.Working voltage: DC 9-12V
* 3.Motor drive chip: TB6612FNG
* 3.Motor drive chip: TB6612FNG
Line 148: Line 150:
|-
|-
| align="center" | 19
| align="center" | 19
| align="center" | Keyestudio UNO R3 main board
| align="center" | Keyestudio REV4 main board
| align="center" | 1
| align="center" | 1
| align="center" | <br>[[File:UNO R3--.png|150px|frameless|thumb]]<br>
| align="center" | <br>[[File:KS0470-1-1(2).jpg|150px|frameless|thumb]]<br>
|-
|-
| align="center" | 20
| align="center" | 20
Line 176: Line 178:


<br>
<br>
== Resources ==
'''All Info.Download:'''  <br>
https://1drv.ms/u/s!ArhgRvK6-RyJhGZP5VY85WVtDBhL?e=BLmybl
<br>
== Assembly Steps ==
== Assembly Steps ==


(1) Prepare all the components shown below. <br>
(1) Prepare all the components shown below. <br>
<br>[[File:KS0193-图片26.png|500px|frameless|thumb]]<br>
<br>[[File:193-1.jpg|500px|frameless|thumb]]<br>


<br>
<br>
Line 233: Line 245:
(4) The final step is to install the control board and the top Acrylic plate. <br>
(4) The final step is to install the control board and the top Acrylic plate. <br>
* Top Acrylic plate
* Top Acrylic plate
* UNO R3 control board
* REV4 control board
* keyestudio balance shield
* keyestudio balance shield
* Bluetooth XBee module HC-06  
* Bluetooth XBee module HC-06  
Line 240: Line 252:
* M3*8MM round-head screw x 8pcs
* M3*8MM round-head screw x 8pcs
* 6pin 30CM connector wire x 2pcs
* 6pin 30CM connector wire x 2pcs
<br>[[File:KS0193-图片37.png|500px|frameless|thumb]]<br>   
<br>[[File:193.jpg|500px|frameless|thumb]]<br>   
<br>
<br>
Go to screw the UNO R3 control board onto the 4pcs M3*10MM copper pillars mounted on the Acrylic plate with 3pcs M3*6MM round-head screws.   
Go to screw the REV4 control board onto the 4pcs M3*10MM copper pillars mounted on the Acrylic plate with 3pcs M3*6MM round-head screws.   
<br>[[File:KS0193-图片38.png|500px|frameless|thumb]]<br>   
<br>[[File:193-2.jpg|500px|frameless|thumb]]<br>   


Then stack the keyestudio balance shield onto UNO R3 control board. And plug the Bluetooth XBee module HC-06 into the balance shield.
Then stack the keyestudio balance shield onto REV4 control board. And plug the Bluetooth XBee module HC-06 into the balance shield.
<br>[[File:KS0193-图片39.png|500px|frameless|thumb]]<br>   
<br>[[File:-.png|500px|frameless|thumb]]<br>   


Go to connect the motor to the balance shield using 6pin PH2.0 30CM connector wire. Simply connect the motor to the nearest motor connector.  
Go to connect the motor to the balance shield using 6pin PH2.0 30CM connector wire. Simply connect the motor to the nearest motor connector.  
<br>[[File:KS0193-图片40.png|500px|frameless|thumb]]<br>   
<br>[[File:KS0193-图片40.png|500px|frameless|thumb]]<br>   


After that, screw the 4pcs M3*45MM copper pillars on the Acrylic plate with 4pcs M3*8MM round head screws. And connect well the battery plug to DC black jack of UNO R3.
After that, screw the 4pcs M3*45MM copper pillars on the Acrylic plate with 4pcs M3*8MM round head screws. And connect well the battery plug to DC black jack of REV4.
<br>[[File:KS0193-图片41.png|500px|frameless|thumb]]<br>   
<br>[[File:KS0193-图片41.png|500px|frameless|thumb]]<br>   


Line 264: Line 276:


<br>
<br>
== Project 1: Getting Started with Main Board and ARDUINO ==
== Project 1: Getting Started with Main Board and ARDUINO ==


=== The UNO Control Board ===
=== The REV4 Control Board ===
<br>
 
When it comes to using the UNO R3 as core of our robot, the UNO is the best board to get started with electronics and coding. If this is your first experience tinkering with the platform, the UNO is the most robust board you can start playing with.  <br>
<br>[[image:KS0470-1-1(2).jpg|600px|]]<br>
[[image:UNO R3--.png|thumb|300px|right]]
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.  <br>
 
<br>
<br>
Well, let's at first have a look at this UNO R3 board.  
Well, let's at first have a look at this REV4 board.  
<br>[[Image:UNO.png|800px|frameless]]<br>
<br>[[Image:KS0341 引脚标图.jpg|800px|frameless]]<br>


{| width="80%" cellspacing="0" border="1"
{| width="80%" cellspacing="0" border="1"
Line 313: Line 327:
| align="center" | [[Image:KS0313 5.1-11.png|500px|frameless]]
| align="center" | [[Image:KS0313 5.1-11.png|500px|frameless]]
| align="light" | '''Analog Pins'''
| align="light" | '''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)
Arduino REV4 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)
|-
|-


Line 340: Line 354:
| align="center" | [[Image:KS0313 5.1-16.png|500px|frameless]]
| align="center" | [[Image:KS0313 5.1-16.png|500px|frameless]]
| align="light" | '''Digital I/O'''
| align="light" | '''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.  
Arduino REV4 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.  
|-
|-


Line 350: Line 364:


<br>
<br>
=== The Balance Car Shield ===  
=== The Balance Car Shield ===  
<br>[[File:KS0193-图片6.png|400px|frameless|thumb]]<br>
<br>[[File:KS0193-图片6.png|400px|frameless|thumb]]<br>
The balance shield is an important part for this balance car. With it, you can DIY the balance car more simple.
The balance shield is an important part for this balance car. With it, you can DIY the balance car more simple.
It is fully compatible with UNO R3 board; just stack it onto the control board. <br>
It is fully compatible with REV4 board; just stack it onto the control board. <br>
The balance shield comes with a 6612FNG chip for driving two DC motors; two white connectors for connecting DC motor; a DC power jack for powering on the shield and UNO R3; <br>
The balance shield comes with a 6612FNG chip for driving two DC motors; two white connectors for connecting DC motor; a DC power jack for powering on the shield and REV4; <br>
Also comes with a large slide switch for controlling the power switch; a MPU-6050 for testing the posture; a XBEE Bluetooth interface for connecting Bluetooth module to communicate with Andriod devices; a small slide switch for controlling Bluetooth module’s communication; also comes with a button and an active buzzer. <br>
Also comes with a large slide switch for controlling the power switch; a MPU-6050 for testing the posture; a XBEE Bluetooth interface for connecting Bluetooth module to communicate with Android devices; a small slide switch for controlling Bluetooth module’s communication; also comes with a button and an active buzzer. <br>
The control pins of UNO R3 are all brought out as female header on the shield; the serial port and I2C communication pins are brought out as pin headers.<br>
The control pins of REV4 are all brought out as female header on the shield; the serial port and I2C communication pins are brought out as pin headers.<br>
<span style=color:red> Note: connect the motor to the motor’s connector on the shield. </span> <br>
<span style=color:red> Note: connect the motor to the motor’s connector on the shield. </span> <br>
<br>[[File:KS0193-图片1.png|500px|frameless|thumb]]<br>
<br>[[File:KS0193-图片1.png|500px|frameless|thumb]]<br>
Line 366: Line 381:


===Installing Arduino IDE===
===Installing Arduino IDE===
When you get the UNO development board, first you should install the software and driver of Arduino. You can see all the Arduino software versions from the link below: <br>
When you get the REV4 development board, first you should install the software and driver of Arduino. You can see all the Arduino software versions from the link below: <br>
https://www.arduino.cc/en/Main/OldSoftwareReleases#1.5.x    <br>
https://www.arduino.cc/en/Main/OldSoftwareReleases#1.5.x    <br>
Or you can browse the ARDUINO website at this link, https://www.arduino.cc, pop up the following interface.
Or you can browse the ARDUINO website at this link, https://www.arduino.cc, pop up the following interface.
Line 409: Line 424:


Double-click the icon of Arduino to enter the desired development environment shown as below.
Double-click the icon of Arduino to enter the desired development environment shown as below.
<br>[[Image:717.png|600px|frameless]]<br>
<br>[[Image:Ks0436-9.png|600px|frameless]]<br>


<br>
<br>
===Installing Driver===
===Installing Driver===
Next, we will introduce the driver installation of UNO R3 development board. The driver installation may have slight differences in different computer systems. So in the following let’s move on to the driver installation in the WIN 7 system. <br>
Next, we will introduce the driver installation of REV4 development board. The driver installation may have slight differences in different computer systems. So in the following let’s move on to the driver installation in the WIN 7 system. <br>
The Arduino folder contains both the Arduino program itself and the drivers that allow the Arduino to be connected to your computer by a USB cable. Before we launch the Arduino software, you are going to install the USB drivers.<br>
The Arduino folder contains both the Arduino program itself and the drivers that allow the Arduino to be connected to your computer by a USB cable. Before we launch the Arduino software, you are going to install the USB drivers.<br>
Plug one end of your USB cable into the Arduino and the other into a USB socket on your computer.<br>
Plug one end of your USB cable into the Arduino and the other into a USB socket on your computer.<br>
When you connect UNO board to your computer at the first time, right click the icon of your “Computer” —>for “Properties”—> click the “Device manager”, under “Other Devices”, you should see an icon for“Unknown device” with a little yellow warning triangle next to it. This is your Arduino.<br>
When you connect REV4 board to your computer at the first time, right click the icon of your “Computer” —>for “Properties”—> click the “Device manager”, under “Other Devices”, you should see an icon for“Unknown device” with a little yellow warning triangle next to it. This is your Arduino.<br>
<br>[[Image:Driver 1.png|600px|frameless]]<br>
<br>[[Image:Driver 1.png|600px|frameless]]<br>


Line 422: Line 438:
<br>[[Image:Driver 2.png|600px|frameless]]<br>
<br>[[Image:Driver 2.png|600px|frameless]]<br>


It will then be prompted to either “Search Automatically for updated driversoftware” or “Browse my computer for driver software”. Shown as below. In this page, select “Browse my computer for driver software”.
It will then be prompted to either “Search Automatically for updated driver software” or “Browse my computer for driver software”. Shown as below. In this page, select “Browse my computer for driver software”.
<br>[[Image:Driver 3.png|600px|frameless]]<br>
<br>[[Image:Driver 3.png|600px|frameless]]<br>


After that, select the option to browseand navigate to the “drivers” folder of Arduino installation.  
After that, select the option to browse and navigate to the “drivers” folder of Arduino installation.  
<br>[[Image:KS0286-4.png|800px|frameless]]<br>
<br>[[Image:KS0286-4.png|800px|frameless]]<br>


Line 442: Line 458:


'''STEP 1: Open Arduino'''<br>
'''STEP 1: Open Arduino'''<br>
In the previous, we have introduced the driver installation of UNO R3 development board. So this time let’s first have basic understanding of the development environment of ARDUINO. After that, you will learn how to upload the program to Arduino board.  <br>
In the previous, we have introduced the driver installation of REV4 development board. So this time let’s first have basic understanding of the development environment of ARDUINO. After that, you will learn how to upload the program to Arduino board.  <br>
First of all, open the unzipped folder of ARDUINO development software and click icon of ARDUINO to open the software, as the figure shown below.   
First of all, open the unzipped folder of ARDUINO development software and click icon of ARDUINO to open the software, as the figure shown below.   
<br>[[Image:Arduino folder.png|600px|frameless]]<br>
<br>[[Image:Arduino folder.png|600px|frameless]]<br>
Line 460: Line 476:
<br>
<br>
'''STEP 3: Select Arduino Board'''<br>
'''STEP 3: Select Arduino Board'''<br>
On the Arduino software, you should click Tools→Board , select the correct board. Here in our tutorial we should select Arduino Uno. Shown as below.
On the Arduino software, you should click Tools→Board , select the correct board. Here in our tutorial we should select Arduino UNO. Shown as below.
<br>[[Image:Arduino 1-8-5 board.png|500px|frameless]]<br>
<br>[[Image:Arduino 1-8-5 board.png|500px|frameless]]<br>


Line 507: Line 523:
Want to try it? Great. This project let’s get started with a basic program to enter the programming world of arduino.<br>
Want to try it? Great. This project let’s get started with a basic program to enter the programming world of arduino.<br>


The keyestudio balance car shield comes with a button KEY_13 and an active buzzer. To be specific, button is controlled by pin D13 on UNO R3; active buzzer is controlled by pin D11 on UNO R3. <br>
The keyestudio balance car shield comes with a button KEY_13 and an active buzzer. To be specific, button is controlled by pin D13 on REV4; active buzzer is controlled by pin D11 on REV4. <br>
<br>[[File:KS0193-图片6.png|400px|frameless|thumb]]<br>
<br>[[File:KS0193-图片6.png|400px|frameless|thumb]]<br>
In the experiment, we get down to controlling the buzzer with button. When press the button, the buzzer will sound. <br>
In the experiment, we get down to controlling the buzzer with button. When press the button, the buzzer will sound. <br>
Line 574: Line 590:
'''Description:''' <br>
'''Description:''' <br>
We have tested the balance shield’s button and buzzer. Now, we are going to mainly test the motor driving ability. <br>
We have tested the balance shield’s button and buzzer. Now, we are going to mainly test the motor driving ability. <br>
In the project, we control the right motor’s direction by pin D8 D12 on UNO R3; speed is controlled by pin D10. The left motor’s direction by pin D7 D6