3228

Lelo triangle V2-esp32-brushless driver EG2133

 
Overview

V2 Self-Balancing Lello Triangle Rechargeable RGB Edition

introduce

This version is produced on 2022/3/3. The brushless driver using EG2133 can successfully use the simplefoc driver of esp32-arduino. However, under special circumstances, the MOS tube may break down and smoke. Please use a protected lithium battery to prevent accidents.

(Updated on 2202/3/3) The Lichuang SMT version is in the middle, the Teppanyaki is on the left, and the air gun is on the right. Both can be rocked and balanced. When using the 2715 motor (four nuts are installed on each hole of the momentum wheel, a total of 48 nuts + 12 12mm long screws), the rocking balance effect is very good.

(Updated on March 15, 2022, the momentum wheel has added M5 screw holes. You can install only one M5 nut to replace the effect of 4 nuts on M3. You can choose the M3 or M5 momentum wheel by yourself when making the board, but the material list The ones given inside are for M5)

程序附件都在gitee https://gitee.com/coll45/foc Be sure to use the BOM under the gitee-V2 folder to place an order, which is divided into Taobao purchase and Lichuang purchase.

v2image.jpg

The middle of the picture shows the Lichuang SMT version. The one on the left is welded in one step using a heating soldering station, and the one on the right is welded in separate areas using a hot air gun. Both can swing and balance, using 2715 motor

  • All mos tubes can be replaced with AP2300 (cheaper), which is available at Lichuang Mall. After testing, it can achieve foc control.(原理图用AO3400只是因为它是SMT基础库)

  • The charging part of the cn3300 is designed to charge a cut-off voltage of 12.9V (taking into account the internal resistance of the battery, the final full voltage is 12.43V), a charging current of 0.5A, and an inductor current of 1.5A. Charging power is 7.5W(充电会电感部分会烫,但不至于烧毁电路)

  • The motor can be adapted to GB2204 and 2715 brushless motors(2715的平衡成功率高,因为KV值小)

1 Production instructions

Schematic and PCB diagram links

  1. In the Lichuang open source link, click to 在编辑器中打开enter the EDA page, double-click the corresponding PCB, and find - Manufacturing - PCB board making file (gerber) - Generate gerber - One-click PCB/SMT order in the upper navigation bar. (Be sure to enter the editor!!! I have encountered situations where the BOM of the open source link does not match the real BOM)
  2. Place an order for the corresponding PCB on the order page. If you need SMT (machine placement), you can choose SMT. If you don't choose SMT, you will get a blank PCB board (after receiving the SMT, you need to solder more than 30 components, and there are 181 blank PCB boards)
  3. 淘宝购买The table is required to purchase both SMT and ordinary blank boards.
  4. Ordinary blank boards BOM_莱洛三角V2can be imported directly from the Lichuang mall BOM import.
  5. You must need a meridional magnet, which is already given in the material list. Choose one of the two (magnetic rings are convenient but the postage is expensive, while cylindrical magnets are cheap and have free postage and need to be attached by yourself)
  6. Soldering is a basic skill, and it is best to try it with an air gun and a soldering iron.

SMT Note:

  • After selecting the SMT required to complete the order, enter the order interface. SMT split board positioning hole selection - Jialichuang added, BOM and coordinate list selection - use my own BOM and coordinates, export file selection - Jialichuang EDA.
  • The coordinate files and BOM that need to be uploaded are EDA页面exported in - Lello Triangle PCB - Manufacturing - (Bill of Materials BOM and coordinate files).
  • After entering the BOM matching, select the number of patches in the upper left corner - make 5 and 2 (because making a Lello triangle requires two PCB boards, one with components and an empty board), patch layer - only the top layer, product type - economical Type, coordinate file generation method - single board
  • It is strongly recommended to delete all extension libraries and recommended libraries before making a board 也可以删除AO3400这样可以便宜15元(the cost is only about 90 yuan for 5 posts and 2 )
  • After placing the SMT order, you only need to purchase it BOM_SMT购买专用_莱洛三角V2, which is also imported from Lichuang Mall BOM.
  • BOM_SMT购买专用_莱洛三角V2The MOS tube given in replaces AO3400 with AP2300

2 Hardware features

illustrate parameter
Lello Triangle Dimensions 100*100mm
Momentum wheel size 80*80mm
Battery*3 Thickness x length x width: 7.9mmx25mmx40mm, any specification is acceptable
Input voltage 3.7v lithium battery*3
Charging voltage 5V input from Type-C port
Charging chip CN3300 5V input, maximum 1.5A charging current
Balanced chip CM1010-A The battery starts to discharge after the voltage exceeds 4.25V
Master chip ESP-WROOM-32
Motor driver chip EG2133 Pins: 32, 33, 25
Voltage regulator chip TPS54331DR If the battery voltage is set to be lower than 9V, it will not work and the output will be 5.22V.
AS5600 encoder SDA-23 SCL-5 chip should be at least 2mm away from the magnet
MPU6050 six-axis sensor SDA-19 SCL-18
RGB light-WS2812 Control using GPIO16
LED indicator light Function
LED1 Serial port indicator light, it will light up when ESP32 sends serial port data
LED2 Charging complete indicator light lights up to indicate charging is complete. It may take 2-3 hours to charge until it lights up.
LED30 Charging indicator light, lights up to indicate charging
LED3 The 5V input indicator light of typec must be on when connected to typec
LED4 3.3v indicator light battery input 12v output 3.3V
LED5 Controlled by GPIO4, it flashes at a frequency of 1HZ when the battery voltage is lower than 9.5V.
LED27\28\29 The balance indicator light lights up to indicate that the battery voltage is higher than 4.25V and is being discharged through the 22 ohm resistor.
touch pad Function
Click duration More than 100ms
Long press duration 800ms or more
Like touch pad GPOI13-Touch4-click: switch RGB light; long press: switch wifi and motor
coin operated touch pad GPOI15-Touch3-click: increase RGB light brightness; long press: next RGB light effect
Favorite touchpad GPOI2-Touch2-click: reduce RGB light brightness; long press: previous RGB light effect

3 Instructions for use

  1. After downloading all the files in this git, open the arduino folder, decompress arduino.7z and double-click to run esp32_package_1.0.6.exe to install the esp32 library environment. Note: If you have installed Arduino before, please deleteC:\Users\用户名\AppData\Local\ the Arduino15 folder in the path and 此电脑\文档the Arduino in it ( you can also download Arduino yourself and install SimpleFOC ) (but the version may be incorrect and the motor will not move)

  2. Open arduino.exe in the decompressed arduino folder, navigate to File-Open. Select main.ino in v2\main

  3. Use the CH340 downloader, lead out the TXD\RXD\GND of the downloader with Dupont wires, and align them with the GND\RXD\TXD directly above the ESP32 on the PCB. The connection method is TXD-TXD\RXD-RXD\GND-GND.

  4. Burn the program to ESP32: Select Tools-Development Board-esp32 Arduino-ESP32 Dev module, then connect the USB port to select the corresponding COM port, compile and upload.

    1. If it cannot be compiled normally
      1. It may conflict with the original Arduino, please check the first item of the instructions for use.
      2. The folder path contains illegal characters. You can move Arduino to the root directory of the hard disk, such as D:\Arduino
  5. If you need to modify parameters, long press the Like touch pad to turn on wifi and stop the motor.

  6. Open main.exe python_guiin this project and connect to WIFI: ESP32. Click Settings to start adjusting parameters.可执行文件_main

  7. After the connection is successful, click disable, then turn the momentum wheel counterclockwise to check whether the V parameter in the host computer is a positive value. Notice! If the counterclockwise value is negative , then any two lines of the motor wires need to be interchanged.

  8. If the motor cannot run normally, click on the test section at the bottom of the host computer , open the voltage or speed test, and slide the slider to see if the motor can run normally. If it still doesn't work, please check the hardware circuit part.

  9. If you cannot swing upright, the recommended parameters to adjust are TA, SA, and SV.

  10. The K value can be adjusted with the slider. Dragging the slider will send parameter commands. However, after adjusting to the appropriate value, you need to modify it in the main of Arduino and then burn it again.

  11. Slider: The leftmost input box is the lower limit of the slider, and the right is the upper limit of the slider. The slider is divided into 200 equal parts. The command is a string . Slide the slider to send the string + value.

For example, if the balance angle is 90 degrees, enter: TA90, and it will be stored in the eeprom position 0. Note: The wifi command cannot be sent too fast , because it will be saved into the eeprom every time, and the K parameter is not saved into the EEPROM, so you can use the slider. Adjustment.

Parameter command illustrate
TA target_angle balance angle for example TA89.3 set balance angle 89.3
SV swing_up_voltage Swing voltage is a voltage that swings left and right. The larger it is, the faster it reaches equilibrium, but if it is too high, it will overshoot.
SA swing_up_angle When the swing angle is still a few degrees away from the balance angle, switch to self-balancing control
VP1 P of the PID of the speed loop, 1 is the P value before stabilizing at the equilibrium angle
VI1 The I of the PID of the speed loop, 1 is the I value before stabilizing at the equilibrium angle.
VP2 P of the PID of the speed loop, 2 is the stable P value
VI2 The I of the PID of the speed loop, 2 is the I value after stabilization
K is the LQR parameter 3 and 4 are before and after speed control stabilization
K3 1 Parameter 1 of LQR: Angle difference before stabilization
K3 2 Parameter 2 of LQR: left and right tilting acceleration before stabilization
K3 3 Parameter 3 of LQR: current speed before stabilization
K4 1 Parameter 1 of LQR: Angle difference after stabilization
K4 2 Parameter 2 of LQR: left and right tilting acceleration after stabilization
K4 3 Parameter 3 of LQR: current speed after stabilization

LQR algorithm explanation: When the triangle tilts toward ←, a force toward → needs to be generated to return it to the straight direction.

Under voltage control: the return force F is directly linked to the output voltage value and tilts to ←. The motor provides positive voltage V and the momentum wheel accelerates to the left , generating a rightward force F.

期望电压 = 角度差值x参数1 + 左右倾倒加速度x参数2 + 当前速度x参数3

Under speed control: the backing force F is related to the momentum wheel speed acceleration a, F = ma, tilting to ←, the motor needs to accelerate to the left to generate a force F to the right.

期望速度 = 角度差值x参数1 + 左右倾倒加速度x参数2 + 当前速度x参数3

The difference between the two: both voltage and speed control can achieve balance, but because simpleFOC is used to control the motor speed, it cannot accelerate infinitely. The maximum speed of this motor in the experiment is 180 rpm, and the voltage reaches the upper limit of 12v.

When using voltage control, you will encounter that the motor reaches the upper speed limit all of a sudden and cannot provide a stable force F, making it difficult to adjust the parameters.

Speed ​​control can generate a maximum voltage of 12v according to the desired speed when the deviation becomes larger, and will not exceed the maximum speed of the motor.

4 Hardware design

Use Lichuang EDA to draw the circuit schematic diagram, and LaserMaker to draw the Lello triangle and momentum wheel (there is a laser cutting machine that can cut the structure in advance as a reference). Import the drawn graphics into Lichuang EDA and use it as the outer frame of the PCB. The silk screen patterns are Gawr Gura and ouro kronii helicopter .

The plt drawn by LaserMaker is in the Lello triangle structure folder. You can use it if you need to redraw the circuit diagram.

Thanks to Jialichuang's PCB board manufacturing, DIY circuit production has become very convenient. Click on the hyperlink below to go to Jialichuang for PCB board manufacturing.

Lello Triangle V2PCB

5 Ctrl+C +V (reference)

The control algorithm on Arduino is the original author's LQR, and the brushless driver is Lichuang's open source EG2133 solution.

Python's GUI is based on SimpleFOC's SimpleFOCStudio, adding wifi functionality.

The charging circuit of V2 is a 3-string lithium battery modified based on the "CN3300 4-string battery pack board" open source solution from Lichuang Plaza.

PCB and schematic technical support——muyan

Author of wifi effect and key surface repair code——muyan

  1. Original author: Self-balancing Lello triangle BV19v411n7mN based on LQR controller
  2. muyan Lichuang link https://oshwhub.com/muyan2020?tab=project&page=1
  3. muyan git link https://gitee.com/muyan3000
  4. EG2133 driver reference https://oshwhub.com/acmetech-lceda/minifoc
  5. Deng Ge’s open source FOC https://gitee.com/ream_d/Deng-s-foc-controller
  6. CN3300 4-string battery pack board https://oshwhub.com/583703056a/dian-chi-zu-ban_copy_copy
  7. Arduino environment provider https://github.com/kaliCYH

6 useful places

  1. The command.h and command.cpp in the Arduino program can support arbitrary string input. It can also be used in other projects, whether it is string data received by wifi or string data from the serial port.

  2. The GUI host computer can continue to be used in other wifi projects, and it is very convenient to adjust parameters.

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-09 07:18:21

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号