CPM4  Description.     December 2003.   Carl Pisaturo


PHYSICAL DIMENSIONS: 
        Panel:        
1.625" W x 4.3" H,   #4 screw mounting hole pattern  1.375" x 4.050"
        Depth:        3.65" (note: wiring projects out back and requires more depth)
        Weight:        151g

-------------------------------------------------------------------------------------------------------------------------------------------

The CPM4 module allows easy control of small and medium (up to 3A, 24V) DC motors.  Although designed around the needs of the kinetic sculptor, the module can be used for a wide variety of motorization needs.   Flexibility, simplicity, maintainability  and reliability were the key design goals...

FLEXIBILITY:  A CPM4 can throttle a motor in a variety of ways:
        a) 1-3 logic lines :  Direction and 2  Power control lines.  This allows for 4 speeds (Stop, settable "Slow",settable "Med", 100%)
        b) Futaba radio receiver , Unidirectional  (0-100% power @ logic set dir)
        c) Futaba radio receiver , Bi-directional  (-100%-100% power)
        d) DC voltage.  0-5V gives 0-100% power or PWM 0-100% @ flexible frequency gives 0-100% power.

There is also an Auto-Reverse Mode which can switch direction when at a limit, and variable ramping of power changes.   A current monitor output allows torque control strategies.  The idea is to have ONE MODULE with lots of capability so that the control strategy of a multi-motor sculpture can evolve without hardware changes. 

SIMPLICITY:   The CPM4 does the low level work so that very simple control strategies can be used.   The variable power ramping rates can give smooth accelerations with just one control line.     

MAINTAINABILITY:  The CPM4 helps you keep a complex motorized system operating for the long term.  By giving the user full system information and several easily controllable parameters on the front panel, problems that  may crop up in the physical system (e.g. wiring faults, excessive friction, motor failure) can be quickly identified and addressed.  Program development / debug / modification is greatly simplified by the display and controls.

RELIABILITY:  Several features of the CPM4 protect both the physical system and the CPM4 itself from User errors, electrical spikes, and mechanical wear and tear.  First, there is built-in support  for limit switches to shut-down power at extremes of axis movement; second, there is settable current limit to protect against jams or unexpected problems.  Electrically, there is an overheat alarm, reverse polarity protection and  protection on all the inputs and outputs.   The ramping functionality greatly reduces physical slamming - for example reversing direction at full power ramps to zero, flips direction then ramps back up.  

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
WHY CPM4?…TO DIVIDE AND CONQUER: Complex webs of inputs, logic and outputs are hard to design, harder to debug and near impossible to maintain in the long term.  Double a project's sensors and motors for example, and the result is not 2 times  as complex, but rather 2 squared (4), or even 2 cubed (8) times more complex.  Why this happens is hard to explain, but it  is true, as evidenced by a lot of "spaghetti code" and "rat's nest wiring";  the possibilities which must be dealt with simply seem to grow geometrically with the number of elements.  In the making of complex things,  be they software or robotics, the need for modules has become evident.  Modules are testable and understandable from the standpoint of their inputs and outputs.  Once they are perfected and "sealed up", the true complexity inside is hidden and no longer of interest.   With the intelligent use of modules, we can tame a 3-D web of trouble into an orderly organizational chart.  In this spirit the CPM4 was made.  By handling the low level jobs of PWM, ramping, current limiting and end-of-travel halting, the CPM4 frees the designer to make the bigger plans.  This allows the  building, debugging and maintenance of much more  complex gizmos than would otherwise be practical.         
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONTINUOUS VS NON-CONTINUOUS MOTION:   The CPM4 can be used  for either continuous motion axes (such as a wheel) or non-continuous axes (such as an elbow joint).  A non-continuous joint can (and typically should) take advantage of the CPM4's  limit switch inputs which tell the CPM4 to ramp-down power when hit.  This protects the physical and electrical systems from stress and  prevents power wasting.  The limit switches can be the traditional mechanical type or can be optical or other types, and they can be mounted inboard from the physical joint stop to take advantage of the settable "Halt Rate" - giving a graceful halt at joint extremes.  Logic output signals representing  the limit switch status are provided so the controlling  system may act on them (e.g. a basic stamp program holds until a particular joint reaches it's limit).   

IS IT OPEN OR CLOSED LOOP?  It's somewhere in between.  In the traditional sense,  the CPM4 is Open-Loop, that is it does not control motor velocity or position, but rather power (the effective voltage going to the motor).  However, the CPM4 does perform closed loop current limiting (with maximum current set by  panel pot), and  can  halt based on limit switches.  The CPM4 is suitable for service as a block in a true closed loop system, provided the ThrotRate is set far right (no ramping).  Control would be from CV and Dir in this case, and the CPM4 would supply the muscle and limit-protection, as well as offering a display of useful info;  a separate block would read the feedback and perform the control loop.

FRONT PANEL FEATURES:
What's Happening With:
        A) The CPM4: 
                "AtMax" - Orange LED Lights if motor current is at set maximum (it is being limited)
                "Ramping" - Orange LED Lights if ramping happening
                "Dir" - Yellow LED Lights if dir = Forward.  Note: may lag control dir because of ramping.
        B) Incoming Control Lines .  Note: Direction Input not brought to panel.  The Mode pair and the Power pair of logic control lines go to 4
                LEDs each for a more obvious display…
                MODE= "Radio Bi-directional" -   Yellow LED, S1=1, S0=1.  Futaba lever controls dir and throttle
                MODE= "Radio Uni-directional" - Yellow LED, S1=1, S0=0.  Futaba lever controls throttle.
                MODE= "PW / Analog"              - Yellow LED, S1=0, S0=1.  CV controls throttle.
                MODE= "LOGIC"                      - Yellow LED, S1=0, S0=0.  P1,P0 controls throttle.
                POWER= "Max" - Green LED, P1=1, P0=1.  (Relevant if Mode=Logic) 100% throttle
                POWER= "Med" - Green LED, P1=1, P0=0.   (Relevant if Mode=Logic) Throttle from "Med" pot.
                POWER= "Slow" - Green LED, P1=0, P0=1.   (Relevant if Mode=Logic) Throttle from "Slow" pot..
                POWER= "Stop" - Red     LED, P1=0, P0=0.   (Relevant if Mode=Logic) 0% throttle.
         C) Motor Current - 10 element bar graph of motor current, can be 1A full scale or 3A full scale (switch)
         D) H-Bridge Chip
                "Hot" - Red LED Blinks and beeps if chip too hot.  This means the mosfet needs more airflow or bigger sink for this power level.
                The chip will shut itself off if it gets much hotter. 
        E) Limit Switches:
                "LimF" - Red LED - Lights if Forward limit switch triggers
                "LimB" - Red LED -Lights if Backward limit switch triggers
        F) Etc
                "PW" - Blue Variable Brightness LED -The PW (power to motor). Irrelevant if KILL Lit.
                "RadioSig" - Green flickering LED - 40Hz flicker means good sig. Brightness varies slightly
                "PW/Ana Sig" - Green Variable - CV (Relevant if MODE=PW/Ana)
                "KILL" - Red LED - Lights if KILL pulled low (overriding halt)
Control Of :
        A) Current Limit - POT, sets the maximum allowed motor current
        B) Limit Halt Ramp Rate - POT-  How fast ramping to zero occurs @ limits. (Left is gentle)
        C) Throttle Ramp Rate - POT- How fast ramping occurs between throttle values. (Left is gentle)
        D) "Medium" Power Setting. - POT. Use this setting for power in LOGIC MODE if P1=1,P0=0.
        E) "Slow" Power Setting.  - POT. Use this setting for power in LOGIC MODE if P1=0,P0=1.
        F) Auto-Reverse Switch


ELECTRICAL CONNECTIONS:
         MOTOR
                M1        Motor        (note: set up to correspond with limit switches - For hits For LimSw)
                M2        Motor
        POWER IN
                G        Ground
                +Vin        12-24VDC (this powers everything)
        LIMIT SWITCHES
                G        Ground
                FO'        Pull low tells MCU "forward switch activated" , float otherwise.          
                BK'        Pull low tells MCU "backward switch activated" , float otherwise.          
        MONITOR, Etc
                IM        Current monitor, DC, about 1.25V per motor Amp.
                @F        Logic High if forward limit switch activated (goes low)         
                @B        Logic High if backward limit switch activated (goes low)         
                 KILL        If pulled low (shorted to ground) motor halts immediately.

        CONTROL
                +5               +5 Volt regulated DC juice for external stuff.  If the 2 regulators burn fingers, too much draw.
                G        Ground
                S1,S0           These define the throttle source (Mode) as follows….
                        S1=1        S0=1   -    Mode = Radio Control, Bidrectional
                        S1=1        S0=0   -    Mode = Radio Control, Unidrectional
                        S1=0        S0=1   -    Mode = PW / Analog
                        S1=0        S0=0   -    Mode = Logic (see below)
                P1,P0    These define the Power (if in Logic Mode) as follows….
                        P1=1        P0=1   -    Power = Max        (100 % PWM)
                        P1=1        P0=0   -    Power = Med          (as set by "Med" pot on panel)
                        P1=0        P0=1   -    Power = Slow          (as set by "Slow" pot on panel)
                        P1=0        P0=0   -    Power = Stop          (zero % PWM)
                Dr           Direction command. 1 = Forward, 0=Backward.  Note: not active in RadioBiDir Mode. Note: not active in AutoRev Mode.
                        Note: ramping delays dir change.        
                CV         Control Voltage (0-5V) or 0-100% PWM at any freq over 150 Hz (gets RC filtered to 40Hz DC)
                        This value relevant if Mode=PW/Ana

THE RAMPING CONCEPT:  Commanding a big instantaneous change of motor power, say 10% to 90%, is, generally speaking, BAD:  it results in a massive current surge to the motor and mechanical shock loading.  All mechanical elements in the drive-line get stressed, structures oscillate, and power lines spike.  Instant reversal, say +90% to -90%, is even worse.  Much more desirable is to gradually change motor power…to ramp it up or down.  Prior to the CPM4, this was  complex and/or expensive.   With the CPM4 it is a no-brainer:  ramping is done automatically for you.  You just set the rate on the front panel from very gentle (left) to very sharp (right).  This means you can achieve graceful speed changes with almost no control system overhead  - just command the final throttle level.   There are in fact two ramp rate settings on the panel  - one "ThrotRate" for normal  throttle changes and one "HaltRate" for ramping to zero when limit switches are hit in a non-continuous axis.  Typically you would ramp to zero pretty fast at the limits, stopping of getting very slow before the physical hit.  However, If the limit switches are positioned such that they get triggered well before the physical stops are reached, , then a more gentle  HaltRate can be set and the axis will stop smoothly.    

AUTO-REVERSING:  In some cases it may be desirable to have a non-continuous joint go back and forth  over and over.  Unlike most systems that require a controller to detect that a limit has been reached and then reverse the direction command, the CPM4  handles this action on-board (if the slide switch is set "AutoRev").  When auto reverse is engaged, the direction input line doesn't do anything; you just control power, and direction switches by itself when limit switches activate.  NOTE: the motor polarity must be set up such that "forward" leads toward the "forward limit" , if it doesn't, simply reverse the 2 motor wires.

KILL-OVERRIDE:  The Kill input line instantly shuts off motor power when it goes logic low (ground).  This is intended as a safety mechanism for all motors in a system  - all kill lines would be tied together and that line tied to one or more kill switches : if any switches short the line to ground, all motors stop.  The kill line on an H_Brink interrupts the PWM going to the mosfet, and thus is independent of the microcontroller.  If KILLing is engaged, an LED lights on the panel.