Jake Wachlin Demonstrates His CAN Controlled Dual Closed- Loop Motor Controller
Jake Wachlin has posted on Hackaday a CAN Controlled Dual Closed-Loop Motor Controller. CAN is an acronym for Controller Area Network. This is a robotic vehicle bus standard designed to enable microcontrollers and devices to communicate with each other’s applications without a host computer. This mechanism is implemented in the CAN controlled dual closed-loop motor controller. This controlled dual closed-loop motor controller can be used for a SCARA robot, control a leg of a robot, and versatile if needed for any motor control. About the project, Jake says “This project aims to develop a low-cost design which can be used for closed-loop control of two micro-gear motors. The current to the motors will also be monitored for current limiting and possible impedance control applications. It can be interfaced over CAN bus, ensuring robustness and scalability in robotics applications.”
During the course of the project, CAN interface didn’t work with the V1.0 dual controller, however, Jake says that a V1.1 update should improve the workings of the controller. Also, the use of JLCPCB as an assembly service and EasyEDA for its clean interface is part of the changes made amongst the following :
- Add a 16MHz crystal to the MCP2515 to fix the CAN issue
- Add pads at logic level CAN TX/RX for debugging support
- Label all external connections on the silkscreen
- Label maximum input voltage
- Add optional CAN 120 Ohm termination resistor with a solder jumper
- Add 3-bit device numbering with solder jumpers to address devices without firmware changes
- The first version just used 0.1″ pitch through holes for the motor and power/CAN connections. On V1.1 I chose actual screw terminal connections so wires don’t need to be soldered permanently in
- Add holes that can be used for mounting
- Add bulk capacitance for the motor controller (doesn’t seem strictly necessary, but not a bad idea to have).
- The assembly service supports a limited number of components and only single-sided SMD parts so are preferable if the assembling can be done personally.
These dual motor controllers are meant to be peripherals on a larger network. They receive higher-level commands from some external device over CAN, and handle the low-level motor control, therefore building a simple main controller is advisable. The main requirements are an attitude sensor and sufficient computational capability to theoretically run complex walking gait controllers. The ESP32 with 2 cores at 240MHz is used because of its computational capability to run fairly complex control schemes that have a built-in CAN controller. It also supports wireless connectivity so commands can be sent remotely.
With the project now able to control two motors well, and much of the supporting code for more complicated use cases written, the next step is to set up the communication between devices. For this, the Controller Area Network (CAN) bus is used. Originally developed for automotive use, CAN allows for relatively high-speed, robust, and long-range multi-master communication. It uses two wires which are differentially driven by a dedicated transceiver. Preferably use the TCAN334. While some microcontrollers have a CAN controller built-in, the ATSAMD21 does not, so use the ubiquitous MCP2515. The MCP2515 is commonly used in all sorts of low-cost hobbyist (and serious commercial) CAN applications. It has an SPI interface to the ATSAMD21.
More information about the controller can be found on Jake’s project page on Hackaday.