Simple FOC for esp32 in arduino with 東哥
Here is the thing I purchased in Taobao
it's a modified version of simple FOC with esp32,It comes with info on git:
and a chinese colone of git: https://gitee.com/ream_d/Deng-s-foc-controller
the programing is based on:
Arduino IDE 1.8.13
SimpleFOC Library 2.1.1
ESP32 Arduino Libiary 1.0.4
Dong also provide a zip file for the set: https://github.com/ToanTech/Deng-s-foc-controller/tree/master/Arduino%20IDE%20for%20Deng%20FOC
but I think it's better to install yourself.
Dong also provided schematic, but in Json format, it's a format supported by easyEDA
The schematic:
U2 is a esp32: ESP32开发板 lolin32 lite
base on the schematic
IIC pins for encoder: SCL0:18 SDA_0: 19
SCL1:5 SDA_1: 23
Pins for motor drive L6234:
motor0:
M0_EN :22
M0_IN1 :32
M0_IN2 :33
M0_IN3 :25
motor1:
M1_EN :12
M1_IN1 :26
M1_IN2 :27
M1_IN3 :14
pins for current sensing INA240:
M0_OUT1 => M0_OUT1_CS : VN
M0_OUT2 => M0_OUT2_CS : VP
M1_OUT1 => M1_OUT1_CS : 35
M1_OUT2 => M1_OUT2_CS : 34
These pins need to be updated in simpleFOC example.
And the 3.3V for sensor pins, are from on board regulator, I read not thing with only USB powered.
I have attacched2 AS5600 on the 2 iic bus of ESP32, the due iic sensor did not work at first shot. Since:
1. the pin out : on the Dong board I have to use this to make the example works:
Wire.begin(19,18,400000);// for IIC0
Wire1.begin(23,5,400000);// for IIC1
2. 12V power needed to be applied, otherwise the sensor power won't have 3.3V even yuo plug USB on ESP32.
I start to attach motor:
BLDCDriver3PWM driver = BLDCDriver3PWM(32, 33, 25, 22);// for motor0
BLDCDriver3PWM driver = BLDCDriver3PWM(32, 33, 25, 12);// for motor0
1
留言
張貼留言