The Sharpie Dotifier

The Theory
           First I'll give a rough run through of the theory behind the two types of motors being used and then we'll take a look at how the system should work when its 100% complete. Specifically, we'll look at the command structure, break it up and understand how things are working. This system is very complex to understand, especially if you're knew to robotics, so take a look at the additional reference links I give to help with your understanding.

Servo Motor Theory
           The Servo Motor, is actually a DC motor with some intelligent circuitry built in that allow us to position the motor at a certain place and apply a torque. There is a specific standard for how they operate and as long as we follow that standard, they will do exactly as told.


           Here's the quick crash course on servo motor theory. To control the servo's current position, you need to create a pulse that looks like the one seen above. The pulse's period is 20mS, so 50Hz frequency, and the positive +5v portion of the pulse varies from 1ms to 2ms. Each specific variance between 1ms and 2ms will tell the servo to move to a specific location. A 1mS +5v pulse will be the furthest location the servo can move to on one side and a 2ms +5v pulse will move the servo to the furthest location on the other side. Typically servo motors are limited to a 90°-180° range of movement. For more information on servo motors please see my tutorial: Servo Motor Control, it explains single and multiple servo control methods and theory.

Stepper Motor Theory

           The graphic above illustrates the basic idea of how a stepper motor works. There are coils inside that induce a magnetic force on the stepper motor, once that force is great enough it pushes the motor a tiny amount. If a full cycle with all coils is performed, the movement is called a step and all stepper motors will have a rating for how far each step is (the motor used for the dotified has 1.8° per step motion). This means, if we perform full stepping cycles, we can track and control the movement of the motor very precisely. If you want to learn more about stepper motors, methods of controlling them and their theory, please see my tutorial: L298 Stepper Motor Control, it shows you example circuits for controlling these types of motors.

System Flow Theory

           The basic command structure for telling servo motors and stepper motors where to move/how far to move is seen above. Since servos are limited to moving to specific locations, I split the timing up and made it so a servo can move from 0-500 (see above example, servo 1 moves to location 250). This is more than accurate enough for what the dotifier will be needing.
           Stepper motors use a similar command, however since it will just perform steps, I built the command so that if you send "M0011", M -> Stepper Motor, 001 -> Distance (1 360° spin), 1 -> Counter-Clock-wise direction. Additionally, I built into the firmware a "MHOME" command which tells the stepper motor to move the stage away from the motor until the home limit switch is triggered (this connects the RC0 pin to ground and tells the stepper motor to stop).



;