# Brushed DC-motors ArduSub

**URL:** <https://discuss.bluerobotics.com/t/brushed-dc-motors-ardusub/16272>\
**Category:** General Discussion\
**Created:** [March 14, 2024, 12:52pm UTC](https://discuss.bluerobotics.com/t/brushed-dc-motors-ardusub/16272 "2024-03-14T12:52:35Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![MartinFaak](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@MartinFaak](https://discuss.bluerobotics.com/u/MartinFaak)\
**Post date:** [March 14, 2024, 12:52pm UTC](https://discuss.bluerobotics.com/t/brushed-dc-motors-ardusub/16272/1 "2024-03-14T12:52:35Z")

</div>

Hello everyone,

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!

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/13297_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [March 14, 2024, 11:52pm UTC](https://discuss.bluerobotics.com/t/brushed-dc-motors-ardusub/16272/2 "2024-03-14T23:52:06Z")

</div>

Hi @MartinFaak -  
I think you’re looking for something like [this](https://www.amazon.com/dp/B0BYVPWR6S?psc=1&ref=ppx_yo2ov_dt_b_product_details).

---

<div class="post-metadata">

**Author:** ![MartinFaak](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@MartinFaak](https://discuss.bluerobotics.com/u/MartinFaak)\
**Post date:** [March 15, 2024, 12:22am UTC](https://discuss.bluerobotics.com/t/brushed-dc-motors-ardusub/16272/3 "2024-03-15T00:22:56Z")

</div>

Hi @tony-white,

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?  
 ![6DmX8](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/e/eb70764121dbd4e495b633a7b874452e7366db19.png)  
Would anything need to be changed in ArduSub itself, like parameters for example?

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/13297_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [March 15, 2024, 10:57pm UTC](https://discuss.bluerobotics.com/t/brushed-dc-motors-ardusub/16272/4 "2024-03-15T22:57:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [March 18, 2024, 2:01pm UTC](https://discuss.bluerobotics.com/t/brushed-dc-motors-ardusub/16272/5 "2024-03-18T14:01:33Z")

</div>

Hi @MartinFaak,

Adding some extra context around Tony’s replies:

> [@MartinFaak](#):
>
> We saw that you guys are using a Polulu brushed DC-motor for the gripper

The motor controller is the important part, not the motor itself. For our gripper we use a [custom controller](https://github.com/bluerobotics/newton-firmware/blob/master/Newton-Gripper/schematic.pdf) 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).

> [@MartinFaak](#):
>
> Would anything need to be changed in ArduSub itself, like parameters for example?

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

1. PWM is one-directional, so your motors would only be able to spin one way, and
2. 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.

---

<div class="post-metadata">

**Author:** ![MartinFaak](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@MartinFaak](https://discuss.bluerobotics.com/u/MartinFaak)\
**Post date:** [May 31, 2024, 6:18pm UTC](https://discuss.bluerobotics.com/t/brushed-dc-motors-ardusub/16272/6 "2024-05-31T18:18:28Z")

</div>

Hi @EliotBR,

We are using [these](https://www.amazon.ca/Readytosky-Bidirectional-Electric-Controller-Difference/dp/B0CPDXWJJ2) 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.

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/13297_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [May 31, 2024, 11:14pm UTC](https://discuss.bluerobotics.com/t/brushed-dc-motors-ardusub/16272/7 "2024-05-31T23:14:38Z")

</div>

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](https://discuss.ardupilot.org/) 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](https://bluerobotics.com/learn/newton-subsea-gripper-installation/#setup-in-qgroundcontrol).

 ![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/9/992eec3380ce1023b006ee872b6eaeba4505a227.jpeg)

---

<div class="post-metadata">

**Author:** ![MartinFaak](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@MartinFaak](https://discuss.bluerobotics.com/u/MartinFaak)\
**Post date:** [June 1, 2024, 11:10am UTC](https://discuss.bluerobotics.com/t/brushed-dc-motors-ardusub/16272/8 "2024-06-01T11:10:28Z")

</div>

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.  
 ![Schermafbeelding 2024-06-01 125036](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/2/29399e31fcce685c2f9ec97815bcc782a8530ca8.png)  
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?

---

<div class="post-metadata">

**Author:** ![MartinFaak](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@MartinFaak](https://discuss.bluerobotics.com/u/MartinFaak)\
**Post date:** [June 1, 2024, 2:10pm UTC](https://discuss.bluerobotics.com/t/brushed-dc-motors-ardusub/16272/9 "2024-06-01T14:10:59Z")

</div>

For example does the parameter MOT\_PWM\_TYPE need to be changed or any of these parameters? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [June 3, 2024, 3:09pm UTC](https://discuss.bluerobotics.com/t/brushed-dc-motors-ardusub/16272/10 "2024-06-03T15:09:53Z")

</div>

> [@MartinFaak](#):
>
> 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?
> 
> …
> 
> does the parameter MOT\_PWM\_TYPE need to be changed or any of these parameters?

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.

1. 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`](https://docs.bluerobotics.com/ardusub-zola/software/autopilot/ArduSub-4.1/developers/parameters/#servon-function-servo-output-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

2. 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
