Motors interface
To control the motors I used a L293D from Texas Instruments. The documentation can be downloaded here.
It is a component that integrates a dual H-bridge with protection diodes (the L293 version has no diodes) and therefore can control two motors: one for each wheel, which seems to be good 😉
The H-bridge way of working is:
SW1 | SW2 | Comment |
Vcc | Gnd | Move forward |
Gnd | Vcc | Move back |
Vcc | Vcc | Brake |
Gnd | Gnd | Brake |
In the case of L293D, we will use two inputs to provide the position of SW1 and SW2. The two corresponding outputs will be connected to the motors. The L293D has an additional input that can “disconnect” outputs, allowing to leave the engine coasting without taking in account the input values.
The following diagram extracted from the datasheet is used to illustrate the assembly principle:
1A and 1B entries are used to control the state of the corresponding outputs (0 – > Gnd and 1->VCC2 ). The entry 1,2EN validate teh activation of 1Y and 2Y output.
The schema of the interface board is given below.
It has two power connectors, one for the 5V of the ‘logic’ and the other for the motors that can be different.
There are two connectors for the 2-bits logic of the motors control and two connectors to connect the right and left wheel motors.
The validation of command outputs are connected to two 3 positions jumpers. It allows to perform tests without running the robot’s motors. It is also possible to connect the middle pin to a PIC output to control the activation, and thereby modulate the motor speed with a PWM signal (Pulse Width Modulation: the time ratio between the 5v value and 0v of the rectangular signal gives the speed variation).