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.
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值小)
Schematic and PCB diagram links
在编辑器中打开
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)淘宝购买
The table is required to purchase both SMT and ordinary blank boards.BOM_莱洛三角V2
can be imported directly from the Lichuang mall BOM import.SMT Note:
EDA页面
exported in - Lello Triangle PCB - Manufacturing - (Bill of Materials BOM and coordinate files).也可以删除AO3400这样可以便宜15元
(the cost is only about 90 yuan for 5 posts and 2 )BOM_SMT购买专用_莱洛三角V2
, which is also imported from Lichuang Mall BOM.BOM_SMT购买专用_莱洛三角V2
The MOS tube given in replaces AO3400 with AP2300illustrate | 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 |
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)
Open arduino.exe in the decompressed arduino folder, navigate to File-Open. Select main.ino in v2\main
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.
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.
If you need to modify parameters, long press the Like touch pad to turn on wifi and stop the motor.
Open main.exe python_gui
in this project and connect to WIFI: ESP32. Click Settings to start adjusting parameters.可执行文件_main
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.
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.
If you cannot swing upright, the recommended parameters to adjust are TA, SA, and SV.
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.
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.
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.
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
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.
The GUI host computer can continue to be used in other wifi projects, and it is very convenient to adjust parameters.
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet