First Progress on 3D Printer Project
It finally moves!
And this is not a trivial result!
In order to make it move controlled by an Arduino UNO, few steps were required.
Reverse-engineer the connections
This has been already explained in the project description, lots of effort was needed to be put to reverse-engineer the existing electronics present in the machine.
This was a work that took more than a month, but let me understand the signals required in order to make the motors move, read their encoders value, and use other I/O data.
Having done that, I moved onto the coding side of the project.
Being that these motors would have to be controlled by a 3D printer controller,
and I conveniently had already at home a RAMPS 1.4 with Arduino MEGA from an old
high-school project, the target was to use the step-dir
signal provided by the
Arduino MEGA, as a reference for the low-level motor controller.
This was done by taking inspiration by the repo misan/dcservo.
This used a low-level interrupt (using ISR
) from Arduino UNO to read the encoder data, and another interrupt line to read the step
signal.
The challenge then was to make it work in an Arduino UNO with two motors, requiring in total 4 interrupts, and this was achieved by using low level interfaces, trying to split each signal in one of the four Arduino pin ports, in order to prevent overlap as much as possible between each one.
The link then between step-dir
inputs, encoders readings, and output, is done by two simple PIDs.
Right now a logging part is missing, and it would be extremely useful for tuning purpose, but the Arduino program is not maintained anymore, as it is being entirely moved to an STM32G4 program, in order to exploit proper interrupts and timers, have a proper FPU, and being in general faster and more stable.