SP7021 SimpleFOC
1.FOC (field-oriented control)
FOC is a field-oriented control, also known as vector control, which is a technology that uses a frequency converter (VFD) to control a three-phase AC motor. size and angle to control the output of the motor. FOC precisely controls the size and direction of the magnetic field, making the motor stable torque, low noise, high efficiency, and has a high-speed dynamic response. Since the three-phase output current and voltage are represented as vectors during processing, it is called vector control.
FOC is currently the best choice for efficient control of brushless DC motors (BLDC) and permanent magnet synchronous motors (PMSM).
reference
Simplefoc : https://docs.simplefoc.com/
Simplefoc studio : https://github.com/JorgeMaker/SimpleFOCStudio
SimpleFOCShield: https://github.com/simplefoc/Arduino-SimpleFOCShield
2. hardware
SimpleFOCShield: The power supply voltage of the driver board is 12V
SimpleFOCShield: The motors can be controlled separately through different jumpers on the back, so that the two driver boards can be placed on top of each other and use the same 12V power supply. (easy to connect to arduino board)
simplefoc shield
Signal | Pwm A | Pwm B | Pwm C | Enable |
Board #1 | 9 | 6 | 5 | 8 |
Board #2 | 10 | 11 | 3 | 7 |
The three phase wires of the motor are connected to the three ports of the SimpleFOCShield board TB_M1. There is no need to distinguish the three phase wires, and they can be connected to the terminals arbitrarily.
3. software
nonos code (arm926) compile
Unzip the following compressed package and synchronize it to the nonos/Bchi-nonos-os of the SP7021 project
and run make nonos. get the rom file in nonos/Bchi-nonos-os/bin
kernel
Because the motor needs a lot of pins to control, the dts of the kernel, all unnecessary devices need to be turned off to avoid pin conflicts.
4. Build the operating environment
SDcard write Raspberry Pi image
Copy the boot files of SP7021 to sdcard
Rom: A926 nonos bin
UImage: kernel image
ISPBOOOT.BIN : xboot image
u-boot.img: uboot and dtb image
uEnv.txt: sdcard boot environment script
boot the system, enter the console and execute the sdcard resize action to expand the size of the root partition
and do the reboot .
connected to the Internet, and download the required toolkit through python for Simplefoc studio
-->pyqtgraph : pip3 install pyqtgraph==0.11.1
--> pyserial: pip3 install pyserial==3.5
--> numpy: pip3 install Numpy
-->Pyside2: sudo apt-get install python3-pyside2.qtcharts python3-pyside2.qtconcurrent python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qthelp python3-pyside2.qtlocation python3-pyside2.qtmultimedia python3-pyside2.qtmultimediawidgets python3-pyside2.qtnetwork python3-pyside2.qtopengl python3-pyside2.qtpositioning python3-pyside2.qtprintsupport python3-pyside2.qtqml python3-pyside2.qtquick python3-pyside2.qtquickwidgets python3-pyside2.qtscript python3-pyside2.qtscripttools python3-pyside2.qtsensors python3-pyside2.qtsql python3-pyside2.qtsvg python3-pyside2.qttest python3-pyside2.qttexttospeech python3-pyside2.qtuitools python3-pyside2.qtwebchannel python3-pyside2.qtwebsockets python3-pyside2.qtwidgets python3-pyside2.qtx11extras python3-pyside2.qtxml python3-pyside2.qtxmlpatterns python3-pyside2uic
Copy SimplefocStudio.tar.gz to rootfs and decompress
execture sudo python3 /usr/share/SimpleFOCStudio/simpleFOCStudio.py to Verify that the python environment is ok.
If everything is OK, the UI below will be displayed
5. Operating flow
boot the arm926
Copy the rom file to /lib/firmware, and then execute the command to start the A926 program
--> sudo cp /boot/rom /lib/firmware/
-->echo rom > /sys/class/remoteproc/remoteproc0/firmware
-->urn on the 12V power connected to the motor
-->echo start > /sys/class/remoteproc/remoteproc0/ state
This completes the startup and operation of the arm926 motor program.
control motor by Simplefoc studio
-->connect the motor by serial
-->control motor