SMC_L298N PID MOTOR CONTROLLER (aka smc_l298n)
Imagine sending actual velocity commands (not PWM commands) to your DC motor and seeing them running at that commanded velocity. This is exactly what the SMC_L298N PID MOTOR CONTROLLER (aka smc_l298n) helps you to accomplish.
It is an easy-to-use PID motor driver module/system based on the popular L298N driver IC designed for controlling the angular velocities of geared DC motors with quadrature encoders via angular velocity commands rather than the traditional PWM commands. It has a GUI application that enables one to easily set up motor PID parameters and libraries for easy interfacing with ROS2-based and Arduino-based projects (as well as Python and Cpp microcomputer-based projects).
NOTE: It can easily be used by hobbyists, students, learners, researchers, etc.
THE COMMON MOTOR VELOCITY CONTROLLER PROBLEM (The Traditional Approach)
The L298N motor driver module (as well as the L298N driver IC) is widely used among hobbyists, makers, engineers, students, and researchers for robotics projects due to its ability to control the speed and direction of DC motors in a reliable and easy-to-use manner. It uses PWM commands to control the speed of the interfaced DC motor.
The only drawback of this control style is that it is an open-loop control and does not allow you to command a desired angular velocity easily. This generally poses a lot of limitations in their uses, especially in more advanced robotics projects requiring precise velocity controls.
To achieve precise angular velocity control with the L298N motor driver, one would need to understand quite a bit of control theory and signal processing calculations, write more control and signal processing code, and possibly add an extra layer of circuitry, all of which can become cumbersome and might not be easy to integrate into one’s desired project (i.e., the whole “easy-to-use” property of the L298N motor driver is completely removed). All these require a good level of expertise.
The SMC_L298N PID MOTOR CONTROLLER easily solves and abstracts all these problems so you can focus more on building your projects with good controls being made readily available.
In summary, the SMC_L298N PID MOTOR CONTROLLER (aka smc_l298n) provides the following:
- Easy interfacing with a geared DC motor with a quadrature encoder.
- Easy setting up of PID control parameter gain for the interfaced motor.
- Sends angular velocity commands (not PWM) to the motor and gets back the motor’s actual angular position and angular velocity as feedback
- Easy integration with ROS2-based (microcomputer or PC) projects with its ROS2 package.
- Easy integration with Arduino-based projects with its I2C library (Arduino UNO, NANO, MEGA, ESP32).
- Easy integration with a microcomputer-based (Python or Cpp) project with its Python and Cpp library.
SMC_L298N PID MOTOR DRIVER (aka smc_l298n_pid_motor_driver) MODULE SPECIFICATION
- Recommended Driver Voltage Supply – 12v to 7v
- Motor Output Supply Current (Max) – 2A (i.e. should be used with geared DC motors whose stall current is not greater than 2A or 2.5A)
- Communication Interface – USB Serial (with FTDI Programmer) and I2C
- The I2C interface has its separate power which can take 5V or 3.3V depending on the Arduino-based microcontroller communicating with it.
- Easily integrates with ROS2 and Arduino (as well as Python and Cpp) projects.
- Angular velocity commands and feedback are in rad/sec.
- Angular position feedback is in radians.
SAMUKO L298N PID MOTOR CONTROLLER APPLICATIONS
- Robotics (Arduino, ROS2, Python, and Cpp)
- Precise Motor Velocity Control
SMC_L298N USAGE NOTE
The SMC_L298N was developed primarily to be used with ROS2 and Arduino robotics projects. Still, it can also be used with just Python and C++ as well as with any other project(s) that requires precise motor velocity control.
Its GUI setup application works on PCs running Ubuntu OS [22.04], Windows, and Mac. One must have python3 installed to run the GUI setup application. Do not run the GUI setup application on microcomputers (e.g. Raspberry PI, etc.)
The SMC_l298N can be used with Arduino-based microcontrollers (e.g. Arduino UNO, NANO, MEGA, Esp32, etc.). It can also be used with microcomputers like Raspberry Pi 4, Nvidia, etc, and PCs, for ROS2 (and Cpp) applications as long as you can install ubuntu22.04 (and ros-humble) on it.
The SMC_L298N can be used with Python-based microcomputer and PC robotics projects as long as you can run Python3 on the microcomputer or PC (with any preferred OS – Ubuntu Windows, Rapbian, etc.)
SMC_L298N PID MOTOR CONTROLLER QUICK USAGE GUIDE
- Get/Purchase the smc_l298n_pid_driver module (it will come with an FTDI programmer for USB serial communication). [Contact to Purchase]
- Download the FTDI driver and connect the PID motor driver to your PC. Also, ensure you have interfaced the motors to the driver module. [ link to tutorial]
- Download and run the smc_l298n_setup_application to set up the encoder parameter and PID gains for the DC motor. You will be able to visualize the result. [link to full tutorial]
- Use it in your Arduino-based project with its smc_l298n_i2c_lib library. [link to full tutorial]
- Use it in your ROS2-based project with its smc_l298n_ros_plugin package. [link to full tutorial]
- There’s also an option for using it in your Python or Cpp microcomputer-based project using its libraries – smc_l298n_pyserial_lib, and smc_l298n_cppserial_lib
CHECK OUT THESE RELATED ARDUINO LIBRARIES
Check out these Github repos of libraries that went a long way in developing the smc_l298n pid motor driver system. (please ensure to star them)
- simple_pid_control – PID Arduino library based on the [PID control series] by Prof. Kelvin Lynch of Northwestern Robotics, developed by samuko-things.
- l298n_motor_control – Arduino library that helps you easily control with PWM the l298n driver module (or any other driver module with a similar control style), developed by samuko-things.
- adaptive_lowpass_filter – Arduino code for implementing one and two-order Butterworth lowpass filter in your Arduino signal processing project/code [filter code], developed by Curio Res. Also, check out how I made use of it to create an Arduino library [samuko filter code]
- quadrature_encoder_velocity_and_position_calculation – sample Arduino code on how to compute rotational velocity and position with a quadrature encoder, developed by samuko-things.