This is the revision A of the Midimotor1e module.
The Midimotor1e module is designed to drive a medium (aka midi) sized motor with a maximum current of 3.5 Amperes per motor. The logic circuitry is separated from the motor H-bridges via optoisolators. There is an additional 5-pin connector that can be connected to a quadrature encoder or potentiometer. Also, there is a 2-pin connector that can be used to connect to one or more normally open limit switches.
This module is controlled via two registers files -- a 24-bit signed integer register file and an 8-bit register file.
The 24-bit register file is described in the table below:
The PID algorithms has three constants, Kp,, Ki, and Kd. These three constants are computed from D, Np, Ni, and Nd as follows:*In quadrature mode, the Position register can be written, but increments and decrements will still happen as quadrature wheel turns.
Index Name Read/Write `Default Description 0 Position Read Only* 0 The current position of the system 1 Target Read/Write 0 The desired position of the system 2 D Read/Write -1 [D]enominator (shared) for PID feedback constants 3 Np Read/Write 1 [N]umerator for [p]roportoional feedback 4 Ni Read/Write 0 [N]umerator for [i]ntegeral feedback 5 Nd Read/Write 0 [N]umerator for [d]erivative feedback 6 AD0 Value Read Only 0 Analog to Digital Channel 0 7 AD1 Value Read Only 0 Analog to Digital Channel 1 8 AD0 Limit Read Only 0 Maximum AD0 value before stopping 9 AD1 Limit Read Only 0 Maximum AD1 value before stopping
The 8-bit register file is described in the table below:
The Configuration register is used to specify motor driection, position direction, and whether quadrature or a potentiometer is used for position measurement. The Status register specifies what is going on inside of the module. Speed is the current speed. The Speed register is a signed 8-bit quantity that ranges from -128 to +127, where +127 corresponds to a 100% pulse width modulation ration and 0 corresponds to motor off. If the module is not seeking a position, the motor will go that speed. The Errors register counts how many quadrature state transition errors have occured. The Deadband, Idle, and Limit registers are used to control when position seeking turns off.
Index Name Read/Write Default Description 0 Configure Read/Write 0 Configuration for motor direction, quadrature vs. potentiometer, position direction control, etc. 1 Status Read Only 0 Status of what is going on inside the module: Seeking to a target, limit switch trip, etc. 2 Speed Read/Write 0 Actual motor speed 3 Errors Read/Write 0 Number of errors detected. 4 Deadband Read/Write 4 Distance to target at which to stop seeking 5 Minimum Read/Write 0 Minimum PWM speed required to get motor to move. 6 Maximum Read/Write 20 The maximum motor PWM speed. 7 Index24 Read/Write 0 Index into 24-bit register
Configuration Bits Bit Name Description 0 Motor Dir. 0=>"notmal" 1=>"reversed" 1 Quadrature Dir. 0=>"normal" 1=>"reversed" 2 Pot vs. Quad 0=>quadrature 1=>potentiometer 3 Quad A Input 0=>quad. input, 1=>A/D input 4 Quad B Input 0=>quad. input, 1=>A/D input
The N2 connector is used for various motor feedback pins, either digital quadrature or analog. With N2 on top, pin 1 is to the right.
When a potentiometer is used to sense overall position, it is fead into AN2.
N2 Pins Pin No Name Description 1 GND GrouND (0 Volts) 2 INDEX/AN2 quad INDEX pulse or ANalog input 2 3 QUADA/AN1 QUAD phase A or ANalog input 1 4 PWR PoWeR (regulated +5 Volts) 5 QUADB/AN0 QUAD phase B or ANalog input 2
N4 is is used for a limit switch or potentiometer read. With N4 on top, pin 1 is to the right.
N4 Pins Pin No Name Description 1 GND GrouND (0 Volts) 2 LIMIT Limit switch input
The module is operated by writing values into the two register files. To set up the module, the following is done:
In order to seek to a position, the Target register is loaded, this register can be updated even if a position seek is in progress. Indeed, the Target register can even be pointed to a location that will cause the motor to immediately reverse directions. The Position register can be read to see where the current position is.
The programming table lists all of the commands.
The hardware consists of a circuit schematic and a printed circuit board.
There is a separate parts list file.
The logic section of the Midimotor1e module is shown below:
The logic power and CAN signals come in from N4 pins 3 through 8. The CAN signals are connected to the MCP2551 CAN physical layer IC, U5. The transmit and receive pins of the microctroller, (U4 pins 5 and 6) are connected to the other side of U5. Lastly, the RC0 through RC3 are used to drive the quad optoislator, U3, through current limiting resistors R5 through R7.
Please note that U3 optoisolator shows up in both schematics. There is only one optoisolator, it is just easier to understand what is going on if the optoisolator is present in both schematics. There is no shared ground between the two sides of the optoisolator.
The power section of the Midimotor1e module is shown below:
Each L298 (U1 and U2) is a dual H-bridge in a Multiwatt-15 package. As per recommended practice, the two H-bridges are ganged together to form a single H-bridge with 3.5 Amp capacity. Power comes in on N3. The dedicated regulator VR1 provides 5 volts for the logic ciruitry. The H-bridge circuitry is always enabled. The Schottky diodes (D1-D8) are used to clamp out unwanted voltage spikes that occur as a result of switching. Each H-bridge is connected to two optoisolators in U3 to allow independent switching of the H-bridge.
The printed circuit board files are listed below:
The following files are available:
Any issues will be listed here.