Arduino UNO and Simple FOC Shield - arsi-apli/BLDC_Klipper_doc GitHub Wiki

Attention! A BLDC motor at the voltage specified by the manufacturer tends to reach high temperatures quickly. Therefore, it is necessary to use a regulated power supply or a regulated DC/DC voltage converter and start testing the motor from a much lower voltage. My motor is rated for 14.4V and I started from 5V.

Due to the fact that the timer used for PWM on some pins of the processor is used by Klipper it is necessary to modify the HW configuration of Simple FOC Shield. The pins are hardcoded in the MCU firmware.

After this change the following pins are used:

Signal Arduino PIN Klipper
PWM A D3 PD3 27
PWM B D5 PD5 29
PWM C D6 PD6 30
ENABLE D8 PB0 8

printer.cfg

[stepper_x] or [stepper_y] or [stepper_z] or [extruder] or [manual_stepper]

enable_pin: PB0

step_pin: PD3 #The value is ignored

dir_pin: PD5 #The value is ignored

full_steps_per_rotation: 2520 #for 12N14P, (14/2)*360=2520

microsteps: 1

[mcu]

serial: /dev/ttyACM0

baud: 250000

restart_method: command

How to build the firmware

If the firmware has BLDC support enabled, the MCU can only drive BLDC motor because the code for the stepper motor is replaced by version that generates the BLDC PWM signals.

git clone https://github.com/arsi-apli/klipper.git

git checkout bldc_stepper

make menuconfig

make

make flash FLASH_DEVICE=/dev/ttyACM0