One of the bigger problems with any CNC machine or 3D printer is the issue of missed steps when moving the toolhead. If a stepper motor misses a step, the entire layer of the print – and every layer thereafter – will be off by just a tiny bit. Miss a few more steps, and that print will eventually make its way into the garbage. [Misan] has the solution to this: closed loop control of DC motors for a 3D printer.
Most printer firmwares use an open loop control system for moving their motors around. Step a few times in one direction, and you know where the nozzle of a 3D printer will be. Missed steps confound the problem, and there’s no way for the firmware to know if the nozzle is where it should be at any one time.
[Misan]’s solution to this was a DC motor coupled to an optical encoder. Both the motor and the encoder are connected to an Arduino Pro Mini which receives step and direction commands from the printer controller. The controller takes care of telling the motor where to go, the Arduino takes care of making sure it gets there.
The entire build is heavily derived from ServoStrap, but [Misan] has a very cool demo of his hardware: during a print, he can force the X and Y axes to either side, and the Arduino in each motor will move the print head back to where it needs to be. You can check that out below.
Continue reading “Closed Loop Control For 3D Printers”
Optical encoders are nothing new; they can be found in everything from mice to printers. They’re great for allowing DC motors to know their exact position and even current direction. If this is sounding like old hat, it’s because we’ve shown you rotational versions before.
[Chris] uses the same concept, but produced a linear optical encoder instead of rotational. His setup is much like whats used in non stepper-motor CNC and RepRap mills, allowing ordinary DC motors to know their position within a plane. It’s a quick tutorial, but we liked the detail and it reminded us we need to finish that DC motor based mill thats still a pile of parts in the closet. Check out a video of [Chris’] in action after the break. Continue reading “Linear Optical Encoder”
[hw640] has put together a well written and detail packed explanation of how to interface with a digital rotary switch. These digital opto encoders have just two outputs with four possible logic levels (00, 10, 11, 01). The relative position of the switch is insignificant but the direction of rotation is what matters.
The short and dirty: Each of the switch’s 2 output pins is attached to a pin change interrupt on the microcontroller. Every time the switch moves it generates either a rising edge or a falling edge on one of the two pins; both edges cause an interrupt. By checking which pin caused the interrupt, then comparing the logic levels of the two pins after that interrupt, we can determine the direction the switch was rotated.
Although this explanation uses a PIC and code written in PicBasic Pro the concepts are discussed in the abstract and would easily be adapted to an AVR or another microcontroller of your choice.