3.2.4. Connecting a Motoron controller for Raspberry Pi
This section explains how to connect motor power, motors, and a microcontroller to the Motoron M3H550, M3H256 and the M2H family, which are designed to be plugged into a Raspberry Pi.
Connecting terminal blocks
For the Motoron M3H550 and M3H256, we generally recommend using green 3.5mm-pitch terminal blocks for the motor power and motor connections. If you have an assembled version of the Motoron, these terminal blocks come soldered to the board. Otherwise, you will need to solder them yourself. They should be soldered to the larger through holes for board power and motor outputs (GND, VIN, M1A, M1B, M2A, …).
You can use blue 5mm-pitch terminal blocks if your current requirements are not too high and you can ensure that there is adequate spacing between any stacked boards in your system to prevent short circuits. This type of terminal block is included with the Motoron M3H550, M3H256 and M2H kit versions and come soldered to the fully assembled versions of the Motoron M2H controllers. The 5mm blue terminal blocks are rated for 16 A so for higher-current applications we recommend soldering thick wires directly to the board. If you decide to use the 5mm terminal blocks, we recommend using the tabs on the side of the terminal blocks to connect them together before soldering them to the Motoron (see our video about how to install terminal blocks for more information).
If you want to stack multiple Motorons using 5mm terminal blocks, should trim the terminal block leads on the bottom side of the board (e.g. using a flush cutter) and use hex nuts in addition to 11mm standoffs (both of which are provided with the assembled and kit versions) between each board to space them out.
Two Motoron M2H boards with terminal blocks can be stacked if you trim the leads on the terminal blocks and space out each board using hex nuts in addition to the 11mm standoffs.
Connecting motor power and motors
The negative terminal of the motor power supply should be connected to the Motoron’s large GND pin or the smaller pins next to it. The positive terminal of the motor power supply should be connected to the Motoron’s large VIN pin or the smaller pins next to it. These GND and VIN connections are required for each Motoron in a stack of Motorons. Connecting two Motorons via stackable headers does not connect their VIN pins at all, and it does not connect their GND pins in a way that is meant to carry the large currents involved in motor control. Note that connecting power to VIN does not power the Motoron’s microcontroller and does not cause any LEDs to turn on.
Each motor should have one lead connected to an MxA pin (M1A, M2A, or M3A) and the other lead connected to the MxB pin with the matching motor number. The Motoron’s concept of “forward” corresponds to MxA driving high while MxB drives low, so you might consider this when deciding which motor lead connects to which Motoron pin. You can also flip the wires later if you want to flip the direction of motion.
Connecting a controller
The Motoron M3H256 is designed to be plugged into pins 1 through 20 of a Raspberry Pi using female headers. The Motoron M2H is designed to be plugged into the 40-pin connector of a Raspberry Pi using female headers.
Plugging the Motoron into a controller this way connects the GND, SDA, and SCL pins of both boards, allowing the controller to communicate with the Motoron via I²C. It also powers the Motoron’s microcontroller by connecting the Raspberry Pi’s 3V3 pin to the Motoron’s logic voltage.
The Motoron does not need to be connected directly to the Raspberry Pi: it can be connected through another board (including other Motoron boards) as long as those boards pass the GND, SCL, SDA, and logic voltage connections through.
You can also connect the Motoron to a controller board that has a different shape as long as you make the same connections. The Motoron’s GND, SCL, and SDA pins should be connected to the corresponding pins on the controller board, and the Motoron’s logic voltage (labeled IOREF or 3V3 depending on which type of Motoron you have) should be connected to the logic voltage supply of the controller board (the allowable logic voltage range can be found in the specifications for your particular Motoron).
An Arduino Micro on a breadboard using a Motoron M3H256 to control three motors.
After you have connected one Motoron to a controller, you can connect other Motorons to the same controller simply by stacking them above or below the first one.
Once you make the GND and logic power connections and turn on the logic power, you should see the Motoron’s yellow LED blink. The red LED will also turn on unless something is communicating with the Motoron and causing it to turn the LED off.
If you are planning to stack multiple Motoron M2H controllers, note that the procedure for setting their I²C addresses (as documented in Section 3.4) requires access to the GND and JMP1 pins, but those pins are in the middle of the board. Therefore, we recommend connecting and setting up one Motoron at a time before connecting the next one.
Powering the Raspberry Pi
By default, the Motoron does not supply power to the Raspberry Pi, so you will need to power your Raspberry Pi separately. However, there are options for powering the Raspberry Pi, as documented in Section 4.4 for the M3H550/M3H256 and Section 4.6 for the M2H controllers.