Radiolink Pixhawk, ArduRover and L298N H Bridge

Hi everyone,

I’m trying to build a rover (Lynxmotion A4WD1 v2 Robot) with Radiolink Pixhawk, ArduRover and L298N H Bridge. I’m not sure is it possible to interface Pixhawk with L298N H Bridge and how to do it. L298N H Bridge is basically Arduino motor controller that can control two or four (interconnected 2+2) motors. One motor (or set of two motors) is controlled with two signals (“10” forward, “01” reverse, “00” break). This is easily interfaced with Arduino and Raspberry Pi, but I have some doubts on how to connect it to Pixhawk. There are four wires to connect, so do I just connect them to four signal connectors on Pixhawk (such is displayed in http://ardupilot.org/rover/docs/common-pixhawk-wiring-and-quick-start.html)? Or I need different controller? Until today, I saw configurations with only two wires connected to Pixhawk, and this is why I’m confused. Can Pixhawk generate PWM signals?
Btw, Motors on Lynxmotion rover are 12V DC motors.

I hope someone will have some advice.

Thanks in advance,

Lov

Lov,

Welcome!

I don’t think we support this. the Pixhawk does generate PWM signals in various ranges and we also support using a “relay” pin to control the motor’s direction. We don’t support using two relay pins to control a single motor’s direction though. We could add support I suppose so I’ve created an issue for it.

Here is our basic Motor & Servo connection instruction wiki page: http://ardupilot.org/rover/docs/rover-motor-and-servo-connections.html

The closest we have is the “Brushed With Relay” motor type but this only uses a single relay to control the motor’s direction. I guess you could get it working by somehow splitting the output from the Pixhawk’s relay pins, putting a NOT gate on one and feeding it into the 2nd direction pin that the H-bridge requires.

Sorry, we actually don’t yet have any documentation on how the BrushedWithRelay motor type should be wired up (issue created here) but it involves wiring up the flight controller’s output 1 and 3 to each motor to provide the pwm value and then output 9 and 10 (aka AUX OUTPUT1 and 2) to the motor driver’s direction pins.

1 Like

Hi rmackay9,

thanks for great information. I hope I will make it work. I will try with “Brushed With Relay” option.

In the meantime, do you think this controller might be interfaced with Pixhawk in my rover configuration: https://www.robotshop.com/en/sabertooth-dual-12a-regenerative-motor-driver.html? I suppose I can connect 4W (left and right interconnected).

Lov,

I’m pretty sure that one will work but the bad thing about it is that it is a skid-steering vehicle but with separate throttle and steering input channels. It’s better to have a motor driver that allows independent control of each wheel. The reason is that for regular throttle-steering vehicles we assume that a servo is being used for steering which leads to a faster turn speed the faster the vehicle goes. Skid steering vehicles rotate at the same speed regardless of how fast they are moving forward or backwards (if anything they turn more slowly as their forward-back speed increases).

I think you were trying to explain behavior that is very well shown here: https://www.youtube.com/watch?v=tYPbA6zms88 (from 0:30). This also happens in my case when I try to use Raspberry Pi to control this rover. I actually do not understand why this is happening, and how to fix it. Does this has to do with connecting left and right wheels (skid-steering) versus front and back wheels (Separate Steering and Throttle)?

Can you point me to some well known motor driver that I can use for my rover and Pixhawk?

@lovnajagode
Sabertooth works well with Ardurover. You can use the DIP switches to configure it for independent or mixed mode. In independent mode, one input controls one output, so if you connect the wheels on one side in parallel to one output of the sabertooth, it works as needed.

1 Like

Hi again,

I made it work with Sabertooth motor controller, Pixhawk Cube 2.1 and R/C Taranis X9D+. However, I have some questions. I’m not sure if they are related to Pixhawk or motor controller.

  1. I cannot reverse it. Is this pixhawk configuration problem? In APM, under Servo Output, I’ve setup Function to be ThrottleLeft for #1 and ThrottleRight for #2 (Skid Steering). This is explained in http://ardupilot.org/rover/docs/rover-motor-and-servo-configuration.html. Can this be solved by setting Motor Type to BrushedBiPoloar?
  2. When turning left or right, it is very slow. I’ve seen it turning very fast in this video from 00:54 sec https://www.youtube.com/watch?v=ImNEj4KAIoQ, but not sure how to do it and what seems to be the problem. My rover behaves exactly like this one from 00:34 sec https://www.youtube.com/watch?v=tYPbA6zms88. I have noticed when turning left or right only one set of motors (left or right) are turning. Is it possible to set up that both sides of wheels are turning (of course in opposite direction)? I think this could speed it up.

When working with L298N H Bridge and Raspberry Pi it was possible to reverse motors, hence it is not due to motors.

Thanks in advance!

Hi Lov,

I noticed you had the same issue I have now regarding the 360* turns of the Lynxmotion A4WD1, have you managed to resolve the issue? I have provided you with links of how my rover is behaving currently:

Could you run L298N H Bridge with pixhawk?

@rmackay9

I have two brushed motors and want to use the L298N motor driver, which requires 2 relay pins for each motor. Below is the steering/throttle configuration I intend to use:

  • SERVO1_FUNCTION = 26 (Ground Steering)
  • SERVO3_FUNCTION = 70 (Throttle)

By default, AUXOUT5 and AUXOUT6 are setup for the 1st and 2nd relays and I added 2 more by reducing BRD_PWM_COUNT from 4 to 2. I then reassigned the following parameters:

  • RELAY_PIN = 52
  • RELAY_PIN2 = 53
  • RELAY_PIN3 = 54
  • RELAY_PIN4 = 55

How can I configure the relay pins in Mission Planner for each motor output?

I tried this connection but was not successful. If you have a circuit diagram, can it help?