DC motor closed-loop control software

DC motor closed-loop control software

youmagine

 This program uses an Arduino for a closed-loop control of a DC-motor.    Motor motion is detected by a quadrature encoder.   Two inputs named STEP and DIR allow changing the target position.   Serial port prints current position and target position every second.   Serial input can be used to feed a new location for the servo (no CR LF).    Pins used:   Digital inputs 2 & 8 are connected to the two encoder signals (AB).   Digital input 3 is the STEP input.   Analog input 0 is the DIR input.   Digital outputs 5 & 6 control the PWM outputs for the motor (I am using half L298 here).   Please note PID gains kp, ki, kd need to be tuned to each different setup. Motor's specs : http://www.mabuchi-motor.co.jp/en_US/cat_files/rs_385sh.pdfUpdate: I have just added a new version of the firmware that using an additional interrupt on pin change will allow 4x encoder resolution. PWM output frequency has been raised outside of the audible range too (31Khz) but output pins have been changed, so check the comments in the code.Update2:  I have uploaded the capture of an analyzer showing the signals from the encoder, the step and dir pins and the PWM outputs of an ongoing print operation. The saleae software can be downloaded to browse through the capture (use latest beta). https://www.saleae.com/Downloads Update3: I have added a much more elaborate version of the controller code now with EEPROM support and serial port setting of PID values https://github.com/misan/dcservo/blob/master/dcservo.ino

Download Model from youmagine

With this file you will be able to print DC motor closed-loop control software with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on DC motor closed-loop control software.