🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Unit_Roller and SimpleFOC.h

    Units
    1
    1
    145
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cepics
      last edited by

      Hi all

      I would like to play with Unit_Roller and SimpleFOC.h but I don't know how to setup the Motor configuration..

      is there an Arduino example for unit_roller using SimpleFOC.h?

      I'm using M5Nanoc6 as controller

      this code compile but doesn't produce any motor movement.

      #include "SimpleFOC.h"
      #include "unit_rolleri2c.hpp"
      #include <M5Unified.h>
      
      // Create a Unit Roller object
      UnitRollerI2C RollerI2C;
      
      // Motor configuration for SimpleFOC
      BLDCMotor motor = BLDCMotor(7);
      BLDCDriver3PWM driver = BLDCDriver3PWM(9, 10, 11, 8);
      
      void setup() {
          M5.begin();
      
          // Initialize the Unit Roller
          if (RollerI2C.begin(&Wire, 0x64, 2, 1, 400000)) {
              M5.Lcd.println("Roller initialized");
          }
      
          // Initialize the SimpleFOC driver
          driver.voltage_power_supply = 12;
          driver.init();
          motor.linkDriver(&driver);
      
          // Motor control mode
          motor.controller = MotionControlType::velocity;
      
          // Initialize the motor
          motor.init();
          motor.initFOC();
      }
      
      void loop() {
          // Motor control using SimpleFOC
          motor.loopFOC();
          motor.move(2);
      }
      

      any tips

      best regards

      1 Reply Last reply Reply Quote 0
      • First post
        Last post