Controlling brushed motors


I’m building small ROV with 4 brushed motors, converted from bilge pumps with 3D-printed props and mounts. I’m looking for controlling system, and I’m thinking if ardusub on Raspberry Pi will work for me. I have very limited budget, so 15$ brushed RC ESCs seems bit expensive, when I can control 2 motors with < 5$ L298N H-bridge board ( )

This works fine with Arduino, using 3 gpo-pins per channel. At the moment I think the easiest way to use these will be using arduino as i2c slave and put it in place of PCA 9685 in PXFmini-clone

Another option will be modifying the output code so pwm will be 0-100% instead of RC and few pins are used for direction, 0 or 100% out.

Have someone already made something like this?

I don’t know about the motors, but you can get a PCA 9685 that works over i2c directly with the pi, and skip the arduino. They are like 3 bucks off ebay. I have made the arduino the i2c slave as well, but I ended up with crashes with the b model. I think it had to do with clock stretching.

I have those boards, and can get servo working ok with some test-script. But is there somewhere in ardupilot code option to change output from servo-pwm to linear 0-100% and another pin controlling direction?

I looked it up because I need to do the same thing, but I was going to use the PFXMINI board type with the rt kernel extensions, and a pair of brush motors. Kind of like this:

There is brushed motor support.

// parameters for the motor class
const AP_Param::GroupInfo AP_MotorsUGV::var_info[] = {
// @Param: PWM_TYPE
// @DisplayName: Motor Output PWM type
// @Description: This selects the output PWM type as regular PWM, OneShot, Brushed motor support using PWM (duty cycle) with separated direction signal, Brushed motor support with separate throttle and direction PWM (duty cyle)
// @Values: 0:Normal,1:OneShot,2:OneShot125,3:BrushedWithAPMrover2/AP_MotorsUGV.cppRelay,4:BrushedBiPolar
// @User: Advanced
// @RebootRequired: True


I had some help from a book and on a couple of sites but I came up w/ some software for a related board w/ the L298. See here:

I have a similar board and thought you could use some advice. Although I am using the BeagleBone Black on this project. Adafruit promotes their findings of I/O w/ the Raspberry Pi.


P.S. Good luck!