I am looking into replacing the stepper motors on my motion control head with PID controlled DC motors. This should allow me to make improvements in terms of noise produced by the steppers, and speed. I have previously done some experimenting with PID loops with the Arduino mega and found that although I could get the system working, the board is only really fast enough to run only the PID loop, and not the full firmware.
Therefore I am designing a small custom board which can run one or two axes and be controlled either by I2C or by Step/Dir pins. This should allow the board to be used with other Arduinos, generic 3D printer controllers, most CAM controllers, or by the MiniE motion control engine.
- This project uses an atmega328p (the same chip from in the arduino uno) for closed-loop control of a pair of DC-motor.
- Motor motion is detected by a quadrature encoder for each axis.
- Encoder counting is managed by single purpose IC (LS7366R).
- Two inputs named STEP and DIR allow changing the target position for each motor.
- I2C port allows target position to be changed for both axes.
- Serial port prints current position and target position every second.
- Change PID values using serial port.
- All unused pins broken out to provide expandable functionality.
- Motor driver can control up to two DC motors at a constant current of 1.2A (3.2A peak).
- Built-in thermal shut-down circuit and low voltage detecting circuit
- Power supply voltage: VM=15V max
- Count frequency: 40MHz
I did a quick test and got a working PID closed loop controller working. Although as you can see in the videos it is clearly unstable and needs to be tuned.
While doing this I worked out a couple of tricks, most importantly that you need to manually alter the pwm frequency of the arduino to operate at a higher frequency too avoid an audible ‘pwm buzz’ from the motor casings.
Did a quick schematic in DipTrace and have most of the components placed although there are still a couple more things to iron out.
- Scalable to allow for more OSDs
- Only 2 wire
- Faster than serial
- OSD cannot be master and slave SPI at same time.
- fastest system, allows many loops of PID
- Already supported by counter ICs
[ ]Connector for I2C in.
[ ]Connector for serial coms.
[ ]Sharing clock for all ICs, good idea?
[ ]Change ICSP connector to correct header
[ ]Step direction inputs to mirror miniE
[ ]scaling pot?
More to come!