Need urgent help setting up L298N V2 motor driver and DC Geared Motor using Pixhawk

Hi everyone,

My rover project is using two L298N V2 motor drivers to control 4 JGB37-520 DC Geared Motors.

I am thinking of the Skid-steering mode but I couldn’t set it up. When I tried the Motor Test, nothing happened and it said that “command was denied by autopilot”. Maybe it’s wrong in wiring, I am not very familiar with this electronics stuff. If you have time, please help me in detail with the wiring. I have already read many discussions about this L298 driver on the forum but I couldn’t find the solution.

image


image
image

This is our wiring diagram, further wiring information are below:

Using the skid-steering method, each L298N driver control 2 motors for each side of the rover (left and right).

To connect the L298N driver and Pixhawk, I wired ENA and ENB parallel and connect it to Main Output 1 on Pixhawk (Signal port - the last row). Because I think that ENA/ENB input PMW signal. I wired IN1 parallel IN3, IN2 parallel IN4 (motor A are 1-2 and motor B are 2-4). Then I connected them to the +/- port on Pixhawk (the first and second row).

I see that there is another output method called “Brushed with relay”. But I don’t really know how to wire them.

I am using the Radiolink Pixhawk with ROVER V.4.1.5 firmware via Mission Planner. If you need any more information, please tell me.

I truly appreciate it if you could help me soon. It’s near the deadlines and I have been stuck on this for a few weeks.

Have a nice day. Best wishes.

Hello, just want to ask if you have solved this problem? I have quite a similar issue

1 Like

Hi @johnmeeel,

Unfortunately, the L298N driver is not compatible with Pixhawk as they use different types of PWM signals. The Pixhawk transmits the PWM Servo signal and the L298N driver needs PWM brushed motor signal.

If you really want to use that driver. A solution is to use an intermediate board (Ex: Arduino) to convert the PWM signal. This way is kind of a struggle and needs lots of time.

Another simple solution is to use the ESC for the brushed motor. You just need to plug it in the Pixhawk and the motor, and everything will work out as usual. The ESCs are pretty cheap and I guess you can buy them easily.

Just tell me if you need more help.

2 Likes

The intermediate board can be as simple as two TTL inverter’s. You can insert an Arduino if you want controlled braking when changing direction, but the inverters work decently.

See here:

Wiki
GitHub

You can output duty cycle PWM and direction signals directly using the BrushedWithRelay motor type.

See also here regarding Radiolink:
Junk warning

Hi, we have a dc (geared) brushed motors and Hobbywing Eagle-20A. How the connection is done, which pins should be used? What configuration we should do?