Merge branch 'master' of github.com:m5stack/m5-docs

This commit is contained in:
ali-admin
2020-09-11 15:38:22 +08:00
10 changed files with 224 additions and 284 deletions
+8 -8
View File
@@ -12,14 +12,14 @@
## Product Features
- Specification:
- 2x M2-32
- 2x M2-25
- 2x M2-18
- 2x M2-12
- 2x M2-22
- 2x M2-28
- 2x M2-35
- 2x M2-16
- 2x M3-32
- 2x M3-25
- 2x M3-18
- 2x M3-12
- 2x M3-22
- 2x M3-28
- 2x M3-35
- 2x M3-16
## Specification
+83 -57
View File
@@ -1,13 +1,16 @@
# BALA2
<div class="badge badge-pill badge-primary product_sku_tag">SKU:K014</div>
<div class="badge badge-pill badge-primary product_sku_tag">SKU:K014-C</div>
<div class="product_pic"><img src="assets/img/product_pics/app/bala_1.webp"> <img src="assets/img/product_pics/app/bala_5.webp"></div>
<div class="product_pic"><img src="assets/img/product_pics/app/Bala2/bala2.webp"></div>
## Description
**BALA2** is short for 'Balance', like its namesake, it's the second generation product. **BALA2** is a Self Balancing Robot consist of a M5Stack Gray and two wheels(DC motors).The base uses STM32F030C8T6 as the main control, two-way encoding motor drive, built-in 1200mAh battery.This application product comes with preloaded software, a self-balance robot application.
This Self Balancing Robot is a Two-wheeled Robot that balances vertically using a closed-loop algorithm. You can control it to walk freely through programming, or you can combine WiFi and Bluetooth to develop remote control functions. This Robot is controllable by a Smartphone device or a Transmitter. The BALA2 base contains a wealth of interfaces. In addition to the conventional PortB and PortC, it also supports 8-channel servos, of which 4 channels can be directly connected, and the remaining 4 channels need to be connected from the inside of the base. Even if you have never been in contact with the balance car program, you can quickly complete the programming and control it through UIFlow. Self Balancing robot uses data from the Accelerometer and Gyroscope to correct its orientation and position.The 2 DC driver module communicates with M5Stack Gray through I2C bus.
**BALA2** is short for 'Balance', as its name suggests, it is the second generation of M5Stacks balancing robot series. **BALA2** is a Self Balancing Robot consisting of am M5Stack Gray and two wheels(DC motors).The base uses STM32F030C8T6 as the main control and has a two-way encoding motor driver and built-in 1200mAh battery.
This robotics product comes with preloaded software. A self-balancing robot application which balances the robot vertically using a closed-loop algorithm. You can program it to automatically move around through programming, or you can combine WiFi and Bluetooth to develop remote control functions.
This Robot is controllable by a Smartphone device or a Transmitter. The BALA2 base contains a wealth of interfaces. In addition to the conventional PortB and PortC, it also supports 8-channel servos, of which 4 channels can be directly connected, and the remaining 4 channels need to be connected from the inside of the base. Even if you have never attempted such a balancing robot program, you can quickly get the hang of it and control it through UIFlow. The self balancing robot uses data from the Accelerometer and Gyroscope to correct its orientation and position.The 2 DC driver module communicates with M5Stack Gray through I2C(0x3A).
## Product Features
@@ -18,31 +21,28 @@ This Self Balancing Robot is a Two-wheeled Robot that balances vertically using
- Support WiFi/Bluetooth, programmable
- Built-in speaker
- TF Card Support
- Compatible LEGO
- LEGO™ Compatible
- Programming Support
+ Python
+ UIFlow (Blockly)
+ Arduino
## Include
- 1x M5Stack Gray + BALA2
- 2x Wheel conncetor
- 4x Connector
- 4x Wheel conncetor
- 2x HY2.0-4P Cables(20cm)
- 2x Bricks
- 1x Hex wrench
- Type-C USB Cable
- Type-C USB Cable(120cm)
## Applications
- Balancing car
<img src="assets/img/product_pics/app/bala_2.webp" width="250" height="250">
## Usage and Sensor calibration
## Sensor calibration
NOTE: Calibration required for first usePress and hold the right C key to start the machine, and release the key after hearing the "drip" sound. The sensor will enter the calibration setting, and keep the host horizontal and still. After 3 seconds, the sensor calibration is completed, and it will automatically enter the balance mode after the calibration is completed.If you found that Bala cannot keep balance during use, it can be solved by trying to calibrate the sensor.
Note: BALA2 has been calibrated , and it can automatically maintain its balance after turning it on. For manual calibration, please refer to [Quick Start](#/en/quick_start/bala2/bala2_quick_start.md)
## Specification
@@ -77,7 +77,7 @@ NOTE: Calibration required for first usePress and hold the right C key to sta
</tr>
<tr>
<td>Base Controller</td>
<td>STM32F030</td>
<td>STM32F030C8T6</td>
</tr>
<tr>
<td>Ports</td>
@@ -89,19 +89,19 @@ NOTE: Calibration required for first usePress and hold the right C key to sta
</tr>
<tr>
<td>Net Weight</td>
<td>g</td>
<td>157g</td>
</tr>
<tr>
<td>Gross Weight</td>
<td>g</td>
<td>337g</td>
</tr>
<tr>
<td>Product Size</td>
<td>54 x 54 x 21 mm</td>
<td>54*54*65*mm</td>
</tr>
<tr>
<td>Package dimensions</td>
<td>185*108*81mm</td>
<td>100*100*100mm</td>
</tr>
<tr>
<td>Case Material</td>
@@ -111,61 +111,87 @@ NOTE: Calibration required for first usePress and hold the right C key to sta
## EasyLoader
<img src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/EasyLoader_logo.webp" width="100px" style="margin-top:20px">
>EasyLoader is a concise and fast program writer, which has a built-in case program related to the product. It can be burned to the main control by simple steps to perform a series of function verification. Please install the corresponding driver according to the device type. M5Core host [Please click here to view the CP210X driver installation tutorial](en/arduino/arduino_development), M5StickC/V/T/ATOM series can be used without driver)
### IMU 6050
<a href="https://m5stack.oss-cn-shenzhen.aliyuncs.com/EasyLoader/Application/BALA/EasyLoader_APP_BALA.exe"><el-button type="primary">download EasyLoader</el-button></a>
<div class="easyloader-box">
<div style="background-color:white;">
<div><img src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/easyloader_intro.webp"></div>
<div class="easyloader-btn">
<a href="https://m5stack.oss-cn-shenzhen.aliyuncs.com/EasyLoader/Windows/APPLICATION/EasyLoader_BALA2_APPICATION.exe">Windows</a>
<a href="https://m5stack.oss-cn-shenzhen.aliyuncs.com/EasyLoader/MacOS/APPLICATION/EasyLoader_BALA2.dmg">MacOS</a>
</div>
</div>
<div>
<video id="example_video" controls>
<source src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Product_example_video/App/BALA2.mp4" type="video/mp4">
</video>
<div class="easyloader-mask">
<a>
<svg id="play-btn" t="1583228776634" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4152" width="75" height="75"><path d="M512 0C229.216 0 0 229.216 0 512s229.216 512 512 512 512-229.216 512-512S794.784 0 512 0z m0 928C282.24 928 96 741.76 96 512S282.24 96 512 96s416 186.24 416 416-186.24 416-416 416zM384 288l384 224-384 224z" p-id="4153" fill="#007aff"></path></svg></a>
<p>Description:</p>
<p>Start and run, press button B + left power button to enter calibration mode, a / C adjustment, B key to save</p>
</div>
</div>
</div>
### MPU 6886
<a href="https://m5stack.oss-cn-shenzhen.aliyuncs.com/EasyLoader/Application/BALA/EasyLoader_APP_BALA_MPU6886.exe"><el-button type="primary">download EasyLoader</el-button></a>
>1.EasyLoader is a simple and fast program burner. Every product page in EasyLoader provides a product-related case program. It can be burned to the master through simple steps, and a series of function verification can be performed.(**Currently EasyLoader is only available for Windows OS**)
>2.After downloading the software, double-click to run the application, connect the M5 device to the computer via the data cable, select the port parameters, and click **"Burn"** to start burning.
## Schematic
?>3.The CP210X (USB driver) needs to be installed before the EasyLoader is burned. [Click here to view the driver installation tutorial](en/related_documents/M5Burner#install-usb-driver),This program is only available for devices that use the MPU9250/MPU6886. (SH200Q is not supported).
<div class="product_pic"><img src="assets/img/product_pics/app/Bala2/Bala2_sch.webp"></div>
## PARAMETER
## PinMap
Model | M5Stack Gray
---|---
ESP32 | 240MHz dual core, 600 DMIPS, 520KB SRAM, Wi-Fi, dual mode Bluetooth
Flash | 16MB Flash + 4MB PSRAM
Input | 5V @ 500mA
Interface | TypeC x 1, CONNEXT(I2C+I/0+UART), Pogo Pin x 1
LCD | 2 inch, 320x240 Colorful TFT LCD, ILI9341
Speaker | 1W-0928
Microphone | MEMS Analog BSE3729 Microphone
MEMS | BMM150+MPU6886
Op.Temp. | 32°F to 104°F ( 0°C to 40°C )
Size | 54 x 54 x 21 mm
C.A.S.E | Plastic ( PC )
**GROVE Port A & B & C**
<table class="table-1">
<thead>
<th>ESP32 Chip</th>
<th>GPIO22</th>
<th>GPIO21</th>
<th>GPIO26</th>
<th>GPIO36</th>
<th>GPIO16</th>
<th>GPIO17</th>
</thead>
<tbody>
<tr>
<td>PORT A</td>
<td>SCL</td>
<td>SDA</td>
</tr>
<tr>
<td>PORT B</td>
<td></td>
<td></td>
<td>DAC</td>
<td>ADC</td>
<td></td>
<td></td>
</tr>
<tr>
<td>PORT C</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>RX</td>
<td>TX</td>
</tr>
</tbody>
</table>
## Example
### 1. Arduino IDE
To get complete code, please click[click](https://github.com/m5stack/M5Stack/tree/master/examples/Modules/BALA)
## PinMap
**Mega328 ISP**Download interface Pin foot definition
<img src="assets\img\product_pics\app\mega328_isp.webp" width="30%" height="30%">
## Video
**BALA Case**
<video width="500" height="315" controls>
<source src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Blog/Twitch201812/M5BALA%20.mp4" type="video/mp4">
</video>
To get complete code, please click[click](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Application/Bala2)
<script>
var purchase_link = 'https://m5stack.com/collections/m5-application/products/bala-esp32-development-mini-self-balancing-car';
var purchase_link = '';
var quickstart_link = 'https://docs.m5stack.com/#/en/quick_start/bala/bala_quick_start';
var quickstart_link = '#/en/quick_start/bala2/bala2_quick_start.md';
anchor_search(purchase_link,quickstart_link);
scrollFunc();
+21 -105
View File
@@ -1,130 +1,46 @@
# BALA2 Quick Start {docsify-ignore-all}
?>To program M5Bala2, you will need M5Stack Gray as main controller.
?>M5Bala2 has been calibrated , if you need to recalibrate, follow the steps below.
<img src="assets/img/product_pics/app/bala_4.webp" width="250" height="250">
1. Place BALA2 on a horizontal desktop and keep it turned off.
## Prepare Install serial port driver
2. Press and hold the middle key (ButtonB) and the red button on the left at the same time, and let go immediately after the screen lights up. At this time, IMU data will be obtained. Please do not touch them during this time.
### For Windows
3. After the data acquisition is completed, it will automatically enter the calibration mode interface. Press the left/right(ButtonA/ButtonC) key to increase or decrease the correction value. When the value is adjusted to a satisfactory value, press the B key to save the parameter.
>Unzip the downloaded CP210X driver compression package, select the installation program corresponding to your operating system, and double-click to install.
<img src="assets/img/getting_started_pics/how_to_burn_firmware/M5Burner/CP210X_WIN.webp">
### For Mac
>Unzip the downloaded CP210X driver compression package, install the program, and double-click the image file to start the installation.
<img src="assets/img/getting_started_pics/how_to_burn_firmware/M5Burner/CP210X_MAC.webp">
4. Restart, BALA2 will run the saved parameters.
## Development Environment
1. [UIFlow](#UIFlow)
2. [Arduino IDE](#Arduino-IDE)
## UIFlow
1.
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_pogopin.webp" width="50%" height="50%">
1. Press the Red button on side of M5Core (double click for shutdown).
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_power_switch.webp" width="50%" height="50%">
1. Press the button on side of M5Bala bottom to power on (double click for shutdown).
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_bala_power_switch.webp" width="50%" height="50%">
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_indicator.webp" width="50%" height="50%">
6. Open [UIFlow](http://flow.m5stack.com/) website, and switch programming language from `Blockly` to `Python`.
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_uiflow_01.webp">
7. Copy the following code to UIFlow and then click `Download`.
```python
from m5stack import *
from m5ui import *
from m5bala import M5Bala
import i2c_bus
clear_bg(0x111111)
m5bala = M5Bala(i2c_bus.get(i2c_bus.M_BUS))
btnA = M5Button(name="ButtonA", text="ButtonA", visibility=False)
btnB = M5Button(name="ButtonB", text="ButtonB", visibility=False)
btnC = M5Button(name="ButtonC", text="ButtonC", visibility=False)
title0 = M5Title(title="Title", fgcolor=0xFFFFFF, bgcolor=0x0000FF)
title0.setTitle('calirate start')
wait(2)
sampleCount = 2000
gyroXSum = 0
gyroYSum = 0
gyroZSum = 0
for _ in range(sampleCount):
gyroXYZ = m5bala.imu.gyro
gyroXSum += gyroXYZ[0] # X
gyroYSum += gyroXYZ[1] # Y
gyroZSum += gyroXYZ[2] # Z
gyroXMean = gyroXSum / sampleCount
gyroYMean = gyroYSum / sampleCount
gyroZMean = gyroZSum / sampleCount
m5bala.imu.setGyroOffsets(gyroXMean, gyroYMean, gyroZMean)
title0.setTitle('balance start')
while True:
m5bala.balance()
wait(0.001)
```
[Arduino IDE](#Arduino-IDE)
## Arduino IDE
1. Setting Arduino development environment - [Establish Serail Connection](https://docs.m5stack.com/#/en/related_documents/establish_serial_connection) - [Get Started with Ardino IDE](https://docs.m5stack.com/#/en/quick_start/m5core/m5stack_core_quick_start)
1. [Mac]Refer to this tutorial to configure Arduino IDE(#/zh_CN/arduino/arduino_development.md)
[Windows]Refer to this tutorial to configure Arduino IDE(#/zh_CN/arduino/arduino_development.md)
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_18.webp">
2. [Download the Example program](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Application/Bala2)
2. Install `m5stack` library in `Library Manager`.
3. Open the example code in Arduino
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_19.webp">
4. Make sure that BALA2 has connected to PC, then click `Tools` -> `Port` for selecting the corresponding serial port on Arduino IDE..
3. Install `NeoPixelBus` library in `Library Manager`.
5. click `Tools` -> `Board: ` to select `M5Stack-Core-ESP32`.
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_20.webp">
6. Compile and upload.
4. Install `MPU6050_tockn` library in `Library Manager`.
## Use of servo
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_21.webp">
**Bala::SetServoAngle(uint8_t pos, uint8_t angle)**
5. Make sure that M5Core has connected to PC, then click `Tools` -> `Port` for selecting the corresponding serial port on Arduino IDE.
uint8_t pos servo number(1 - 8),Among them, No. 5 - 8 servos are inside the BALA2 base
6. click `Tools` -> `Board: ` to select `M5Stack-Core-ESP32` or `M5Stack-Fire`.
uint8_t angle servo angle
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_22.webp">
**Bala::SetServoPulse(uint8_t pos, uint16_t width)**
7. Clone **[M5Bala](https://github.com/m5stack/M5Bala.git)** by shell command. *If you dont't have Git installed yet, click [here](https://git-scm.com/download/win) and install it.*
uint8_t pos servo number(1 - 8)Among them, No. 5 - 8 servos are inside the BALA2 base
```shell
git clone --recursive https://github.com/m5stack/M5Bala.git
```
uint16_t width pulse width
8. Click `Sketch` -> `Include Library` -> `Add .ZIP Library...` . select `M5Bala` you just cloned from github.
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_14.webp">
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_15.webp">
9. Open a bala example: Click `File` -> `Examples` -> `M5Bala` -> `Basic`.
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_16.webp">
10. Compile and upload.
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_23.webp">
<img src="assets/img/product_pics/app/bala_3.webp" width="500" height="500">
**For the use of M5Stack, please refer to [M5Stack GRAY](https://docs.m5stack.com/#/zh_CN/core/gray)**
+1 -1
View File
@@ -22,7 +22,7 @@
## Include
- 1x Barometric Pressure Unit
- 1x Grove Cable(5cm)
- 1x Grove Cable (5cm)
## Application
+1 -1
View File
@@ -20,7 +20,7 @@
## Include
- 1x 6-Axis IMU Unit
- 1x Grove 线(5cm)
- 1x Grove Cable (5cm)
## Application
+2 -1
View File
@@ -208,7 +208,8 @@
const application_list = [
//Application
{a:"/#/en/app/bala", img:"https://static-cdn.m5stack.com/image/m5-docs_homepage/app/app_bala_01.webp", p:"BALA", sku:"K014" ,kw:"ROBOT", category:"Application"},
{a:"/#/en/app/bala2", img:"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_homepage/app/bala2.webp", p:"BALA2", sku:"K014-C" ,kw:"BALA2 ROBOT", category:"Application"},
{a:"/#/en/app/bala", img:"https://static-cdn.m5stack.com/image/m5-docs_homepage/app/app_bala_01.webp", p:"BALA", sku:"K014" ,kw:"ROBOT"},
{a:"/#/en/app/lidarbot", img:"https://static-cdn.m5stack.com/image/m5-docs_homepage/app/app_lidarbot_01.webp", p:"LidarBOT", sku:"K017" ,kw:"ROBOT"},
{a:"/#/en/app/piano", img:"https://static-cdn.m5stack.com/image/m5-docs_homepage/app/app_piano_01.webp", p:"PIANO", sku:"A047" ,kw:"MUSIC"},
{a:"/#/en/app/flir", img:"https://static-cdn.m5stack.com/image/m5-docs_homepage/app/app_flir_01.webp", p:"FLIR", sku:"K021" ,kw:"FLIR3.0"},
+2 -1
View File
@@ -208,7 +208,8 @@
const application_list = [
//Application
{a:"/#/zh_CN/app/bala", img:"https://static-cdn.m5stack.com/image/m5-docs_homepage/app/app_bala_01.webp", p:"BALA", sku:"K014" ,kw:"ROBOT", category:"Application"},
{a:"/#/zh_CN/app/bala2", img:"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_homepage/app/bala2.webp", p:"BALA2", sku:"K014-C" ,kw:"BALA2 ROBOT", category:"Application"},
{a:"/#/zh_CN/app/bala", img:"https://static-cdn.m5stack.com/image/m5-docs_homepage/app/app_bala_01.webp", p:"BALA", sku:"K014" ,kw:"ROBOT"},
{a:"/#/zh_CN/app/lidarbot", img:"https://static-cdn.m5stack.com/image/m5-docs_homepage/app/app_lidarbot_01.webp", p:"LidarBOT", sku:"K017" ,kw:"ROBOT"},
{a:"/#/zh_CN/app/piano", img:"https://static-cdn.m5stack.com/image/m5-docs_homepage/app/app_piano_01.webp", p:"PIANO", sku:"A047" ,kw:"MUSIC"},
{a:"/#/zh_CN/app/flir", img:"https://static-cdn.m5stack.com/image/m5-docs_homepage/app/app_flir_01.webp", p:"FLIR", sku:"K021" ,kw:"FLIR3.0"},
+8 -8
View File
@@ -11,14 +11,14 @@
### 产品特性
- 规格:
- 2x M2-32
- 2x M2-25
- 2x M2-18
- 2x M2-12
- 2x M2-22
- 2x M2-28
- 2x M2-35
- 2x M2-16
- 2x M3-32
- 2x M3-25
- 2x M3-18
- 2x M3-12
- 2x M3-22
- 2x M3-28
- 2x M3-35
- 2x M3-16
## 规格参数
+72 -35
View File
@@ -1,27 +1,27 @@
# BALA2
<div class="badge badge-pill badge-primary product_sku_tag">SKU:K014</div>
<div class="badge badge-pill badge-primary product_sku_tag">SKU:K014-C</div>
<div class="product_pic"><img src="assets/img/product_pics/app/bala_1.webp"> <img src="assets/img/product_pics/app/bala_5.webp"></div>
<div class="product_pic"><img src="assets/img/product_pics/app/Bala2/bala2.webp"></div>
## 描述
**BALA2** 是一款平衡车应用.该产品是由[M5Stack Gray](/zh_CN/core/gray) 与 BALA2电机底座组合而成的一款自平衡机器人,底座采用STM32F030C8T6作为主控,由两路N20编码减速电机提供动力,内置1200mAh电池,其"BALA"名称的由来出自"Balance"一词的缩写,目前为第二代产品。BALA2底座包含了丰富的接口,除了常规的PortB、PortC外还支持8路舵机,其中4路接口可直接连接,其余4路需从底座内部引出。您可以通过编程控制它自由行走,也可以结合WiFi和蓝牙开发遥控功能。即使您从来没有接触过平衡车程序,您也可以通过UIFlow快速完成编程对它进行控制。
默认预装平衡车应用程序,在运行时使用PID闭环算法保持垂直平衡,利用加速度计与陀螺仪姿态数据来校正其方向和位置。
出厂默认预装平衡车应用程序,在运行时使用PID闭环算法保持垂直平衡,利用加速度计与陀螺仪姿态数据来校正其方向和位置。
底座通过I2C总线与M5Stack Gray通信.默认I2C地址为**0x56**
底座通过I2C总线与M5Stack Gray通信.I2C地址为**0x3A**
## 产品特性
- 9轴姿态传感器
- 双轮驱动,PID控制平衡
- Grove扩展接口
- Grove扩展接口PORTB/PORTC)
- 8路舵机驱动,4路外接,4路内置
- 支持WiFi蓝牙,可编程
- 内置扬声器
- 支持 TF 卡拓展
- 兼容 LEGO
- 支持TF卡拓展
- 兼容LEGO
- 开发平台
+ MicroPython
+ UIFlow
@@ -30,15 +30,19 @@
## 包含
- 1x M5Stack Gray + BALA2
- 2x 轮毂连接器
- 4x 连接
- 2x HY2.0-4P 连接线(20cm)
- 4x 轮毂连接
- 2x 乐高臂
- 1x 内六角扳手
- 1x Type-C USB 数据线
- 1x Type-C USB 数据线(120cm)
## 传感器进行校准
## 应用
注意:首次使用务必先进行校准!按住最右侧C键开机,听到"滴"声后松开按键,传感器会进入校准设置,保持主机水平静止放置,3秒后传感器校准完成,校准完成后会自动进入平衡模式。如果在使用过程中发现BALA无法保持平衡,可通过尝试校准传感器进行解决。
- Balancing car
## 使用和校准
注意:出厂时BALA2已经进行校准,开机即可自动保持平衡,如需手动进行校准请参考[快速上手](#/zh_CN/quick_start/bala2/bala2_quick_start.md)
## 规格参数
@@ -85,19 +89,19 @@
</tr>
<tr>
<td>净重</td>
<td>130g</td>
<td>157g</td>
</tr>
<tr>
<td>毛重</td>
<td>247g</td>
<td>337g</td>
</tr>
<tr>
<td>产品尺寸</td>
<td>90*54*61mm</td>
<td>54*54*65mm</td>
</tr>
<tr>
<td>包装尺寸</td>
<td>185*108*81mm</td>
<td>100*100*100mm</td>
</tr>
<tr>
<td>外壳材质</td>
@@ -113,46 +117,79 @@
<div style="background-color:white;">
<div><img src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/easyloader_intro.webp"></div>
<div class="easyloader-btn">
<a href="">Windows</a>
<a href="">MacOS</a>
<a href="https://m5stack.oss-cn-shenzhen.aliyuncs.com/EasyLoader/Windows/APPLICATION/EasyLoader_BALA2_APPICATION.exe">Windows</a>
<a href="https://m5stack.oss-cn-shenzhen.aliyuncs.com/EasyLoader/MacOS/APPLICATION/EasyLoader_BALA2.dmg">MacOS</a>
</div>
</div>
<div>
<video id="example_video" controls>
<source src="" type="video/mp4">
<source src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Product_example_video/App/BALA2.mp4" type="video/mp4">
</video>
<div class="easyloader-mask">
<a>
<svg id="play-btn" t="1583228776634" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4152" width="75" height="75"><path d="M512 0C229.216 0 0 229.216 0 512s229.216 512 512 512 512-229.216 512-512S794.784 0 512 0z m0 928C282.24 928 96 741.76 96 512S282.24 96 512 96s416 186.24 416 416-186.24 416-416 416zM384 288l384 224-384 224z" p-id="4153" fill="#007aff"></path></svg></a>
<p>案例描述:</p>
<p></p>
<p>开机运行,按住ButtonB+左侧开机键进入校准模式,A/C调整,B键保存</p>
</div>
</div>
</div>
## 原理图
<div class="product_pic"><img src="assets/img/product_pics/app/Bala2/Bala2_sch.webp"></div>
## 管脚映射
**GROVE Port A & B & C**
<table class="table-1">
<thead>
<th>ESP32 Chip</th>
<th>GPIO22</th>
<th>GPIO21</th>
<th>GPIO26</th>
<th>GPIO36</th>
<th>GPIO16</th>
<th>GPIO17</th>
</thead>
<tbody>
<tr>
<td>PORT A</td>
<td>SCL</td>
<td>SDA</td>
</tr>
<tr>
<td>PORT B</td>
<td></td>
<td></td>
<td>DAC</td>
<td>ADC</td>
<td></td>
<td></td>
</tr>
<tr>
<td>PORT C</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>RX</td>
<td>TX</td>
</tr>
</tbody>
</table>
## 案例程序
### 1. Arduino IDE
*下载完整代码 [点击此处](https://github.com/m5stack/M5Stack/tree/master/examples/Modules/BALA).*
## 管脚映射
## 相关视频
**BALA 的演示**
<video class="video_size" controls>
<source src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Blog/Twitch201812/M5BALA%20.mp4" type="video/mp4">
</video>
**下载完整代码 [点击此处](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Application/Bala2)**
<script>
var purchase_link = 'https://m5stack.com/collections/m5-application/products/bala-esp32-development-mini-self-balancing-car';
var purchase_link = '';
var quickstart_link = 'https://docs.m5stack.com/#/en/quick_start/bala/bala_quick_start';
var quickstart_link = '#/zh_CN/quick_start/bala2/bala2_quick_start.md';
anchor_search(purchase_link,quickstart_link);
scrollFunc();
@@ -1,87 +1,46 @@
# BALA2 上手指南 {docsify-ignore-all}
?>为了使用M5Bala2,需要M5Stack Gray
?>M5Bala2在出厂时已做校准,如需重新校准按以下步骤进行
<img src="assets/img/product_pics/app/bala_4.webp" width="250" height="250">
1. 将BALA2放置水平桌面,保持关机状态。
2. 同时按住中间按键(ButtonB)和左侧红色按键,待屏幕亮起后立刻松手,此时会获取IMU数据,期间请勿触碰。
3. 数据获取完毕后自动进入校准模式界面,按下A/C键可对修正值增加或减小,当调整至满意值时,按下B键保存参数。
4. 重新开机,BALA2将已保存的参数运行。
## 开发环境
1. [UIFlow编辑](#UIFlow编辑)
2. [Arduino IDE编辑](#Arduino-IDE编辑)
## UIFlow编辑
1. [安装驱动并烧录 UIFlow 固件](https://docs.m5stack.com/#/en/quick_start/m5core/m5stack_core_get_started_MicroPython)参考此教程烧录固件
2. 单击M5Core侧边的红色按键开机(快速双击为关机).
3. 访问 [UIFlow](http://flow.m5stack.com/) , 将编程模式`Blockly` 切换至 `Python`.
4. 复制粘贴以下代码,并执行程序.
```python
from m5stack import *
from m5ui import *
from m5bala import M5Bala
import i2c_bus
clear_bg(0x111111)
m5bala = M5Bala(i2c_bus.get(i2c_bus.M_BUS))
btnA = M5Button(name="ButtonA", text="ButtonA", visibility=False)
btnB = M5Button(name="ButtonB", text="ButtonB", visibility=False)
btnC = M5Button(name="ButtonC", text="ButtonC", visibility=False)
title0 = M5Title(title="Title", fgcolor=0xFFFFFF, bgcolor=0x0000FF)
title0.setTitle('calirate start')
wait(2)
sampleCount = 2000
gyroXSum = 0
gyroYSum = 0
gyroZSum = 0
for _ in range(sampleCount):
gyroXYZ = m5bala.imu.gyro
gyroXSum += gyroXYZ[0] # X
gyroYSum += gyroXYZ[1] # Y
gyroZSum += gyroXYZ[2] # Z
gyroXMean = gyroXSum / sampleCount
gyroYMean = gyroYSum / sampleCount
gyroZMean = gyroZSum / sampleCount
m5bala.imu.setGyroOffsets(gyroXMean, gyroYMean, gyroZMean)
title0.setTitle('balance start')
while True:
m5bala.balance()
wait(0.001)
```
[Arduino IDE编辑](#Arduino-IDE编辑)
## Arduino IDE编辑
1. [Mac用户]参考此教程配置Arduino IDE(#/zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_MacOS.md)
[Windows用户]参考此教程配置Arduino IDE(#/en/quick_start/m5core/m5stack_core_get_started_Arduino_MacOS.md)
1. [Mac用户]参考此教程配置Arduino IDE(#/zh_CN/arduino/arduino_development.md)
[Windows用户]参考此教程配置Arduino IDE(#/zh_CN/arduino/arduino_development.md)
2. 在Arduino中
2. [下载示例程序](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Application/Bala2)
7. 使用Shell命令下载 **[M5Bala案例程序](https://github.com/m5stack/M5Bala.git)** . *如果你还未安装Git, [请点击此处](https://git-scm.com/download/win) 进行下载.*
3. 在Arduino中打开示例程序
```shell
git clone --recursive https://github.com/m5stack/M5Bala.git
```
3. 将BALA2连接至电脑.点击`Tools`->`Port`中选择设备使用的串行端口
8. 点击 `Sketch` -> `Include Library` -> `Add .ZIP Library...` . 选择下载好的 `M5Bala` 的文件
4. 开发板`Board`选项选择`M5Stack-Core-ESP32`
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_14.webp">
5. 对代码编译上传
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_15.webp">
## 舵机使用
9. 打开 BALA 程序案例: 点击 `File` -> `Examples` -> `M5Bala` -> `Basic`.
**Bala::SetServoAngle(uint8_t pos, uint8_t angle)**
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_16.webp">
uint8_t pos 舵机序号(1 - 8),其中5 - 8号舵机在BALA底座内部
10. 编译并上传程序.
uint8_t angle 舵机角度
<img src="assets/img/getting_started_pics/m5bala/bala_quick_start_23.webp">
**Bala::SetServoPulse(uint8_t pos, uint16_t width)**
<img src="assets/img/product_pics/app/bala_3.webp" width="500" height="500">
uint8_t pos 舵机序号(1 - 8),其中5 - 8号舵机在BALA底座内部
uint16_t width 脉冲宽度
**关于M5Stack的使用请参考[M5Stack GRAY](https://docs.m5stack.com/#/zh_CN/core/gray)**