Skip to content
/ espFoC Public

A Permament Magnet / BLDC Motor type Field Oriented Control Library for ESP32 SoCs

License

Notifications You must be signed in to change notification settings

uLipe/espFoC

Repository files navigation

espFoC: Vector FoC controller for PMSM motors for ESP32 SoCs

Build License: MIT

espFoC is a simple implementation of voltage mode, vector controller intended to be used with permanent-magnet synchronous motors (PMSM), and general brushless motors. This component was developed to be used with the ESP-IDF espressif framework.

Features:

  • Voltage mode control, control a PMSM like a DC motor!;
  • Position and Speed closed-loop control;
  • Single-precision Floating point implementation;
  • Sample inverter driver based on esp32 LEDC PWM (easy to wire!);
  • Sample rotor position driver based on as5600 encoder (very popular!);
  • FoC engine runs sychronized at inverter PWM rate;
  • Scope function for debugging using Better Serial Plot

Limitations:

  • Support for esp32 and esp32s3 only;
  • Requires and rotor position sensor, for example, incremental encoder.

Getting started:

  • Just clone this project on most convenient folder;
  • Inside of your IDF project CMakeLists.txt set or add the path of this component to EXTRA_COMPONENT_DIRS for example: set(EXTRA_COMPONENT_DIRS "path/to/this/component/")
  • For batteries included getting started, refer the examples folder.
  • Inside of any of examples just build: $ idf.py build flash

Typical wiring:

  • espFoC is intended to run on ESP32 board plus a motor driver;
  • The current driver supports 3-PWM output suited to: L6230, DRV83xx and others;
  • The suggested wiring for quick get started is shown below: Wiring

Debug with Better Serial Plot:

  • Install Better Serial Plot from here: https://hackaday.io/project/181686-better-serial-plotter
  • In menuconfing enable the option: CONFIG_ESP_FOC_SCOPE
  • Download the firmware for your target board;
  • Open the Better Serial Port and select the port and baud rate of your board;
  • The data should arrive automatically.

Support:

If you find some trouble, open an issue, and if you are enjoying the project give it a star or submir a PR. Also, you can try reaching me at: [email protected]

About

A Permament Magnet / BLDC Motor type Field Oriented Control Library for ESP32 SoCs

Resources

License

Stars

Watchers

Forks

Packages

No packages published