Actuators: The robot uses DC motors with built-in worm gears. Each motor uses a rotary potentiometer to get feedback. The motors are rated as 6V, 6RPM.
Printed Parts: The blue plastic parts were designed in FreeCAD and 3D printed.
Misc. Electronics: The motors are driven by L298N h-bridges. The h-bridges are connected to an Adafruit Servo Bonnet, which is connected to a Raspberry Pi Zero W. An ADC (MCP3008) is used to get readings from the potentiometers.
Software: I couldn't find software to control this robot, so I wrote my own using Python. The software can only draw straight lines. It breaks the line into segments; the robot adjusts its motor speeds after drawing each segment. To draw each segment, it uses the following steps:
- Use the potentiometers (and the ADC) to get the robot's current position. Communication with the ADC uses bit-banged SPI (because I couldn't figure out how to use the hardware SPI without my code having GPL infection).
- Calculate the potentiometer readings at the desired position.
- Calculate the PWM duty cycles for each motor, so that each motor reaches the desired position at the same time.
- As the motors move, repeatedly get potentiometer readings. When a motor has reached the desired position, stop its movement.
- Once all motors have stopped, proceed to the next line segment.
I wrote a gcode parser, but since the resolution is so poor I decided not to spend the time integrating the parser into the rest of my code.
Problems: The resolution is surprisingly poor. I think this is because of looseness in the worm gears. I can freely rotate the motor shaft several degrees before engaging the gears. There is also room for improvement in the software, but I think this is less of an issue than the loose motor shafts.
A Note About Pi CNCs: It is often argued that it is impossible to build a Pi CNC without writing a real-time operating system. This is usually because of concern that the Pi can't provide high-precision pulses for stepper motors. (There is some evidence that the Pi is probably fine for hobby-level stepper CNCs, but that's beside the point).
I attempted to circumvent these difficulties by replacing steppers with DC motors, and controlling them using a PWM Bonnet. The Pi must regularly check the potentiometer readings, but this is probably less demanding than sending stepper pulses.
While I was not successful enough to conclusively show that a Pi can control a closed-loop CNC, I still believe that the circuitry would work if the motors and software are of sufficient quality.
HI