Showing posts with label PWM. Show all posts
Showing posts with label PWM. Show all posts

PID control for DC motor with optical encoder

 Posted by:   Posted on:    No comments

In the previous post I gathered information about a cartridge slide unit taken from an old inkjet printer. As I found out, the printer used a common DC motor to move the cartridges on X axis, however with the addition of an optical encoder with strip, the cartridges could perform precise movements. So, I want to interface this to Arduino. Original printer electronics such as motor drivers were of no use (proprietary ICs without public datasheets).

I had to drive the motor with a L298N H-bridge module and for the encoder I built a PCB which replaced the original one used in printer. The software is not as simple as you may think. I just can't turn on motor until the reading of encoder equals the desired position. Suddenly stopping the motor will not result in a sudden stop of the sliding block. Due to inertia, it continues to move a bit, even with the motor electrically shorted. The proper approach requires a PID (proportional-integral-derivative) control algorithm which adjusts motor speed using PWM.

The motor with optical encoder wired to Arduino

The motor with optical encoder wired to Arduino

DC Motor Controller for PCB Drill

 Posted by:   Posted on:    No comments
This is a simple circuit that can be use to vary the speed of a DC motor. It is very useful for controlling a PCB drill, but it can be used for whatever applications you want. The speed can vary from full to complete stop. The circuit is versatile and can be used with motors of different currents and voltages.

This circuit is widespread on the internet. Here is an example. The PWM signal is generated by a 555 chip. The chip drives a MOS-FET transistor that will switch the motor on and off. The 555 is powered from a 7805 regulator. Therefore, the motor DC voltage can be between 8 and 35 V (the circuit can be powered by AC 7...26 V). The maximum current is limited by MOS-FET.
The circuit shown here is designed to be AC powered by a mains transformer. But you can power it from a DC adapter, battery or even a computer power supply if you remove the diode bridge and connect the power lines straight to ground and positive pads, where the output pins of the bridge would otherwise fit.
DC Motor Controller for PCB Drill 555