I am new to SimpleFOCLibrary and would need help on this issue.
I am currently following the step-by-step guide on the motor driver test: Getting started | Arduino-FOC
Hardware that I am using:
- Arduino Uno Rev 3
- L298N motor driver
- Nema 17 Stepper motor (soon to be attach)
My issue is that one phase side of the L298N is not working, where it will be at 0 V (around 20 mV). While the other side is 6 V.
I tried different cases by switching the pwm pins at digital pins and analog pins but it seems to be not working. (Note: I changed the pins in the code according to the cases.)
The code and the cases which I have tried are shown below.
-------------------------------------------------------------Code-------------------------------------------------------------
// Stepper driver standalone example
#include <SimpleFOC.h>
// Stepper driver instance
// StepperDriver4PWM(ph1A, ph1B, ph2A, ph2B, (en1, en2 optional))
StepperDriver4PWM driver = StepperDriver4PWM(5, 6, 9, 10);
void setup() {
// pwm frequency to be used [Hz]
// for atmega328 fixed to 32kHz
// esp32/stm32/teensy configurable
driver.pwm_frequency = 32000;
// power supply voltage [V]
driver.voltage_power_supply = 12;
// Max DC voltage allowed - default voltage_power_supply
driver.voltage_limit = 12;
// driver init
driver.init();
// enable driver
driver.enable();
_delay(1000);
}
void loop() {
// setting pwm
// phase A: 3V
// phase B: 6V
driver.setPwm(3,6);
}
I hope someone can help.