runger1101001 / Arduino-FOC-dcmotor

MIT License
3 stars 13 forks source link

Additional testing: Encoder not working #6

Open ator1811 opened 12 months ago

ator1811 commented 12 months ago

Hi, after a while I thaugt I will do some tests with the latest version of the DCmotor Repo. I use a ATMEGA 2560 Some findings:

  1. The example script of the dc-open-loop does not compile. Refs to library and the motor class is wrong

    #include "SimpleFOCDCMotor.h"
    // DCDriver object - this is the only thing needed for open-loop control.
    // There are different types to choose from, please select the correct one
    // that matches your motor driver hardware.
    DCDriverSpeedDir driver = DCDriverSpeedDir(2, 3);
  2. I tested with a rotary encoder into the dc-position and dc-velocity example scripts. It does compile. After entering a value the motor start spinning until it reaches the max voltage. In the monitoring output the 2 column on the right remains zero. I tested the encoders with another scripts and they are working fine. Also the callibration is skipped. Debug output:

    MOT: Init
    MOT: Enable driver.
    MOT: Monitor enabled!

    (no calibration)

Monitoring output (target 5,0)

5.0000  3.3387  0.0000  0.0000
5.0000  3.3455  0.0000  0.0000
5.0000  3.3524  0.0000  0.0000
5.0000  3.3593  0.0000  0.0000
5.0000  3.3661  0.0000  0.0000
  1. Is the code in loop(): motor.loopFOC(); missing in the example scripts? I see it with the BLDC examples

If you have any questions please let me know Regards