20 March 2019

The curse of the L293D

Post-construction testing of the first prototype has discovered an unfortunate problem with the L293D H-bridge drivers used for controlling the wheel and hook motors within an Omni-Pi-tent module. While all had worked at their full speeds they quickly staleld when PWM duty cycles were reduced, this meant that while the L293D had been able to "sneak through" earlier testing it turned out to be unsuitable for driving the robot around at varying speeds, especially for driving at carefully selected angles or along curving paths.

The problem is as follows,while being a very popular chip the L293D is rather old and has a large voltage drop, even at low currents, within it. In practice this means that around a Volt is dropped between the chip's VCC2 power supply and the high side of the motor, and another good fraction of a Volt is dropped between the motor's low side and ground. Overall 1.5 to 2 Volts are lost. At 5V the motor's just about run, hence this problem eluding earlier tests, but start PWMing and the voltage on which the motor has to operate is getting below 3V. Our motors are not able to run at such low voltages, hence the stalling.

Many people who use the L293D have a 9 or 12 Volt power supply available. While our batteries give between 12V and 8V as they discharge, we only use regulated power within the robot's actuators, sensors and computing systems, hence ensuring consistent performance right until the battery gets critically low and is cut off. And finding step-down regulators rated for the kinds of several Amp current that the full robot can draw at peak is pretty hard, harder still when you've got a space constraint due to the sizing of the gears driving the hinge, so there's no opportunity to fit a second regulator able to supply more than 5V for the motor driver chips.

Fortunately there is a simple workaround, the L29D can be replaced with a better chip. We've found the Toshiba TB6612FNG to be a nice choice. While the pin layout is very different from the L293D, and these chips are SMD rather than through hole, the functions of the pins are pretty similar: two outputs for two motors, an input to run each motor in either direction, a PWM enable for each motor and plenty of ground pins to double as thermal sinks.

We've been rebuilding our boards with the new chips fitted and final testing of the AVR microcontroller code should start tomorrow. I2C master code has already been tested on the Pi zero W with breadboard connections, this should replicate pretty reliably on the new PCBs. Providing the tests don't conclude that the microcontroller code needs a thorough refactoring, then we should get a video of the full robot driving around uploaded to here within a week or two.

The robot's central board with Pi, regulator and microcontrollers fitted.

No comments:

Post a Comment

Thank you for your thoughts, your comment should be visible soon.