This is the first part exploring the motor control shield that I designed for the project where I was doing 3D Printer Filament Measuring with Arduino. The DC motor portion of the project is based on the Infineon brushed DC motor controller TLE94112EL Arduino Shield. In this installment we will focus on the Arduino sketch software to control all the features of the board. If you want to know more about the hardware, see the first link.
The TLE94112LE Arduino Shield on top of the XMC1100 Boot Arduino
The TLE94112EL is a flexible and sophisticated component. I consider it to be more reliable than just using a handful of half-bridges for the following reasons:
- Separate motor power supply
- Can control up to 6 independent DC motors
- Three independent PWM channels (80, 100 and 200 Hz) available
- bidirectional SPl communication with the micro controller
- Exhaustive error and status registers
The three PWM channels on-board, as well as the error and status registers, are one of the key factors of this component. Arduino can program the behavior of every motor individually while also processing other tasks. It does this seamlessly while all the motors are running.
The last update of the software platform is available on GitHub.
Electronics and Wiring
Compatible Microcontroller Boards
Several boards can be used: the Arduino compatible board XMC1100 by Infineon (used in this project) is more powerful and faster than the Arduino UNO R3 but both can be used, as well as the the Arduino Mega 2560.(more powerful but running at 16 MHz like the Arduino UNO). The hardware has also been tested with other Arduino board with good results
Wiring the circuit is easy: just put the TLE94112EL Arduino shield on top of your board and wire the motors. That’s all, folks!
The wired test platform used to develop and test the language and parser
As shown in the image above, the platform design includes an DC/DC power converter (available on many online platforms for few dollars) used to provide two separate power lines: 5Vcc for the Arduino or Arduino compatible board and 12Vcc to power the DC motors
Modular Software Design Layout
Together with the Arduino LCD and TLE94112 libraries, the software includes a class and two header files for the better parametrization. The image above shows the sketch design architecture while the image below shows the three main logic block A, B, C details the scheme of the extra functions called by the parser and the main loop()
The software design and relative tasks, aligned to the typical Arduino Sketch format
The software is conceived to perform as a development and test platform, adaptable to many different usages. I have included a user interaction mechanism: the design can be modeled on the hardware also excluding unwanted parts (for example the LCD display) without penalizing the performances.
Classes and headers details inheriting the TLE94112 Arduino library and the serial communication
Motor Current Inrush Control
A DC motor consuming 900 mA or few less while running, it is expected having a meaningful higher peak when it starts or stop. We can avoid this issue, in most cases, by changing the freewheeling flag in the board settings. If the issue still persists, I have experimentally verified it does impact the performances. Though, an Open load error is generated when motor starts. To bypass this condition, a preprocessor definition is provided to toggle off this flag.
The 2 lines x 16 characters alphanumeric LCD display gives real-time feedback while the system runs. The user interaction is controlled through the serial interface, so the LCD messaging can be disabled if it is not in use. This will save a considerable amount of program memory.
The serial USB interface is the interaction channel between the user and the device. The commands are intuitive alphanumeric instructions. It is easy to adapt the software to be controlled by another device, a computer or an embedded Linux board.
We should be able to control the platform from any serial terminal. Serial terminals send terminated strings: we should ignore the Carriage Return (and the optional Line Feed) terminating characters. For this reason, when the parser receives a command the terminating character is removed before passing the data to the parser function.
In the next installment, we will be going through the code and how to use it in your application. Till next time. If you have any project ideas, please let me know in the comments below!
This content was originally published here.