We want to use brushed DC-motors in combination with a Pixhawk 4 and Raspberry Pi 3B. We installed Blue OS on the Raspberry Pi and ArduSub on to the Pixhawk but we are a bit stuck on how to incorporate the brushed DC-motors with Pixhawk. We saw that you guys are using a Polulu brushed DC-motor for the gripper but haven’t found any brushed motor controller that goes with Pixhawk. Your help would be greatly appreciated!
Thanks for the quick response. We are using a PM07 Power Module board in conjunction with the Pixhawk 4. Would the +,- and signal line of the brushed ESC go on the FMU-PWM-OUT (see image below) pins?
Would anything need to be changed in ArduSub itself, like parameters for example?
Hi @MartinFaak -
Apologies, I’m not familiar with that board or the Pixhawk 4. If it can be used with brushless motors, the ESCs I linked would function the same. You should only need the ground and signal line of the ESC connected to the appropriate channel outputs.
The motor controller is the important part, not the motor itself. For our gripper we use a custom controller so that it’s possible to send servo-style PWM values and get the desired behaviour out of the gripper motor (which in the case of the gripper is rotate in the specified direction until the input signal returns to neutral, or there’s excess current-draw indicating an end-stop / grip condition).
If you have a DC motor controller that accepts servo-style inputs for bidirectional control (e.g. 1100µs pulses for full reverse, 1500µs pulses for neutral/stopped, 1900µs pulses for full forwards) then it should work fine with your Pixhawk PWM outputs - ArduSub has no idea what kind of motors it’s controlling.
If you’re trying to control a DC motor directly using one of the flight controller’s output pins then that’s ill-advised because
PWM is one-directional, so your motors would only be able to spin one way, and
the PWM frequency is quite low relative to what a DC motor would want for smooth control
You would also need some kind of power amplification circuit since the output signals are very limited in how much current they can provide (and you likely want a higher voltage as well). In that case you would also need to change the output pin and motor control parameters so the minimum and neutral PWM values were set to 0, to avoid the motors spinning when you want it to be stopped.
We are using these ESC’s to control 4 brushed ESC’s using a Pixhawk 2.4.8 and a Raspberry Pi 3B+ connected to the laptop via ethernet cable. We were first using the Pixhawk 4 but now we are using the Pixhawk 2.4.8. When we tested these with the Pixhawk 4, they worked fine but now we are using the other Pixhawk they stopped working. We are only using the signal cable of the ESC to connect to the Pixhawk. Do the ground and + cable also need to be connected to the rail of the Pixhawk or not? And on which rail should I put them, the main or aux because I’m not too sure? Also do any parameters need to be changed in QGroundControl? We are using a controller and I changed the arrow buttons to Servo1_Inc and Servo1_Dec but as I said, the motors didn’t start turning. Your help would be greatly appreciated because I am kinda stuck at this point.
Hi @MartinFaak -
You will need to connect both the signal and ground of the ESC to the Pixhawk - just the signal line is a “floating” signal until referenced to the same common ground.
It’s tough to advise where to connect them, and what parameters you may need to adjust without more information on your vehicle. The Ardupilot forums may be a better resource for your project?
Generally, motors used to control the vehicle go on the first 3 to 8 channels. If you’re trying to control a servo via joystick buttons (running ArduSub?) then you would connect to Aux channels - reference this guide.
Hi @tony-white,
We are using this vehicle frame, but for motors 3 and 4 we are using brushed motors that will pump water in a volume to increase buoyancy or decrease etc.
We are using the controller to control the vehicle and we placed the 3 brushless thrusters (1,2 and 5 on the vehicle frame above) on the first 3 MAIN pins on the Pixhawk 1. But since we use brushed motors I’m just not sure if I should place them on pins 4 and 5 on the MAIN rail for example or on the AUX rail pins?
The important part is not really the type of motor - it’s what kind of input signal the ESCs are controlled by. In this case your brushed motor ESCs are controlled by the same kind of bi-directional servo-style PWM signal that ArduSub expects by default, so you shouldn’t need to change the motor type allocations.
It’s a bit unclear on how you’re hoping to control the vehicle.
If you’re using standard controls and just happen to have some special motors then the motors should be connected to the normal locations, in which case your motors should be connected to the MAIN pins specified by their frame number
Alternatively you can adjust the SERVOn_FUNCTION values to reassign your Motor n outputs to the pins you’ve got each motor connected to, but that can lead to extra confusion down the line
If instead you’re wanting to use progressive controls for the brushed motors (with buttons that increment or decrement the signal sent to the ESCs, instead of using a joystick for vertical control) then the best approach is likely to connect them to AUX pins so that ArduSub’s servo_*_inc button functions are available
Alternatively you could use a workaround like defining SERVOn_FUNCTION for the relevant pins as Lights 1 and Lights 2 outputs, in which case you could control them using the lights button functions, but that then means you can’t nicely control actual lights at the same time