The serial pins make it possible to connect the Simple Motor Controller to a microcontroller (e.g. an Orangutan Robot Controller, Arduino, or Basic Stamp) or other logic-level serial device, allowing for the creation of autonomous, self-contained systems. The following section explains the serial pins in detail (see Section 6 for information on using the serial interface).
Serial Connections Overview
The pins along the left side of the Simple Motor Controller can be used to communicate with devices with logic-level (TTL) serial interfaces, such as microcontrollers. As explained in Section 4.1, the Simple Motor Controller uses 3.3V logic, but all of the digital pins in the above diagrams (everything except for VIN and GND) are 5V-tolerant, which means that the Simple Motor Controller can be used directly with a microcontroller running at 5 V as long as that microcontroller is guaranteed to read a 3.3 V signal as high.
The Simple Motor Controller uses its RX and TX pins to receive and transmit asynchronous, logic-level (TTL), non-inverted serial signals with 8-bit characters and one stop bit (often expressed as 8-N-1). This is the type of serial typically used by microcontroller UART modules.
Whenever connecting devices, remember to wire the grounds together, and ensure that each device is properly powered. Unpowered devices with a TTL serial port can turn on or partially on, drawing power from the serial line, which means that extra care must be taken when turning power off and on to reset the devices.
Note: You must use an inverter and level shifter such as a MAX232 or a Pololu 23201a Serial Adapter if you want to interface an RS-232 device with the Simple Motor Controller. Connecting an RS-232 device directly to the Simple Motor Controller can permanently damage it.
Serial Interface Pin Descriptions
These pins have a 0.1" spacing.
Simple Wiring Example: Connecting to a Microcontroller
All you need to control the Simple Motor Controller with a microcontroller is a connection between the microcontroller’s TTL serial transmit pin and the Simple Motor Controller’s RX pin. If you want to get feedback from the controller, you can connect the TX pin to the microcontroller’s TTL serial receive pin and/or connect the ERR pin to one of the microcontroller’s digital inputs. Connecting one of the microcontroller’s digital outputs to the RST pin allows the microcontroller to selectively reset the Simple Motor Controller.
The ERR Pin in Detail
One function of the ERR pin is to communicate that an error is preventing the motor from moving. When such an error occurs, the red error LED turns on and the ERR pin outputs 3.3 V. When there are no errors stopping the motor, the ERR pin is pulled low and the red error LED is off. Because the ERR pin never drives low, it is safe to connect the ERR pins of multiple Simple Motor Controllers to the same microcontroller input. If any one of those controllers experiences an error, the microcontroller error input goes high and the error LEDs of all connected Simple Motor Controllers light up.
By default, the ERR pin is also configured to serve as an input that stops the motor when externally driven above 2.3 V. This means that the error lines of multiple Simple Motor Controllers can be connected together and all motor controllers will shut down their motors when any one motor controller experiences an error. This technique of connecting error lines can be used even when RC signals or analog voltages are used to control the motors. An example of this can be seen in Section 4.3.
The following diagrams show the internal circuitry of the ERR pin in the error case (driving high to report an error) and in the error-free case (pulled low and configured as an input):
The TXIN Pin in Detail
The TXIN pin is a special input that allows multiple Simple Motor Controllers to be chained together without requiring an external AND gate. The following diagram shows how multiple motor controllers can be connected to a single microcontroller UART:
Inside each Simple Motor Controller, an AND gate is used to combine the input from the TXIN pin with the controller’s serial transmissions. As long as only one chained controller is transmitting at any given time, the above method of chaining will funnel the transmissions of all chained devices to a single microcontroller receive line. The following diagram shows the internal circuitry of the TX and TXIN pins:
See Section 6.6 for more information on connecting multiple controllers on the same serial line.