4 motor analog joystick/arduino control

Hi Rusty - I know you have the three motor arduino control, but I wondered if the four motor code was ever uploaded? or is it still just three? I have middle schoolers (only just learning basic arduino, so zero programming chops) building a MATE competition ROV, who are hoping to have one vertical thruster, two horizontal thrusters and one lateral. We have four T100s with built in ESC. We know about this code:

but wondered if there was a four motor option? If not, I think we will go three just to be able to use the thrusters.

Thank you so much!




The arduino code can be modified pretty easily to allow a fourth channel to be used for the lateral thruster. Just copy the code relating to vertical command and add lateral (strafe) command in the same manner.

I added the changes for a 4th channel in a fork of Rusty’s git repository. Hook the 4th unused channel from the joystick to analog pin A3, and the strafe motor servo pin to digital pin 3 on the Arduino. I haven’t tested it, but this should work.

You can find it here: br-esc-examples/arduino/AnalogJoystickControl at master · jaxxzer/br-esc-examples · GitHub

You can see the changes that were made here: Add 4th strafe channel option to AnalogJoystickControl · jaxxzer/br-esc-examples@343a033 · GitHub

Thank you Jacob!

We’ll keep you posted!!!

Hi Jacob, one more questions, can we use pretty much any parallax joystick, or should it have a gimbal like the one linked? I’m assuming the 5K linear pot is the critical feature, but that we could use any parallax joystick that fits that spec?

Oops, I see it’s the adapter that is the critical feature. my bad! Thanks!!

The parallax joysticks are nice, but not absolutely necessary. Any potentiometer (variable resistor) could be used as input to the arduino adc. The joysticks combine two potentiometers for control over two channels with the x,y position of the joystick. I have used joystick modules such as these with success for similar purposes, but the parallax joystick seems to be better quality. http://www.ebay.com/sch/i.html?_from=R40&_sacat=0&_nkw=joystick%20module&rt=nc&LH_PrefLoc=1&_trksid=p2045573.m1684

@Jacob - thanks for modifying the code! Looks great.

@Ashley - the Parallax joysticks are not required but they are really nice joysticks. As Jacob mentioned, you can use any potentiometer.


Hey guys,

I actually decided to go this route with my project also where I am utilizing the Parallax joysticks. I just wanted to get some input from you guys. I see how the ESC’s and joysticks are both running off of the same breadboard but is it possible to use one Arduino on land, receiving commands from the joysticks, and sending those commands through an ethernet to another arduino underwater where the ESC’s will be connected? Would I need to incorporate I2C in order to control the arduino underwater or would it be able to be controlled simply through the ethernet connection?



Hi Vaughn,

You can definitely do that. You’ll need to come up with a way to send the joystick measurements to the other Arduino. You can use Ethernet but it might be easier to use a low-speed (4800 bps) serial connection, which is natively supported in Arduino.

On the Arduino onboard the ROV, you would listen to the incoming signals and send those to the ESCs. I would recommend looking for Ethernet or serial communication examples between two Arduino to learn how to do this properly.



Hi everyone,

I am also starting a MATE competition ROV Club at my school, and am somewhat new to using Arduino and ESCs. I understand a lot of this, but just have a power supply question. When using the original 3 thruster/2 Parallax setup, I am told the max amount of amperage I can use is 25A (according to MATE competition rules). Can I use this setup if I only have 25A to play with? Or is there a way to limit the power I use for this system? I am told I can use thrusters that require more power than what I can provide, but I have to somehow limit the power used by the thrusters in my software. Any help would be appreciated.

Hi Brian, the ESCs and the example code use a control signal called PWM to control the speed of the motor.

The faster a motor spins the more current you will draw, so if you are drawing too much current then we just need to slow the motors down.

The ESCs we sell are reversible, and this is what the arduino program is designed to use. You will find a lot of tutorials about ESCs that are not reversible, because these are the most used type.

The reversible esc works like this:

A pwm signal of 1500 is stopped, a pwm signal > 1500 is forward spin command, and a signal < 1500 is reverse spin command. The closer the signal is to 1500, the slower the motor will spin. A signal of 1900 is full speed forward, and 1100 is full speed reverse.

So just limit the range of your output signals to be closer to 1500 if you need to slow things down. In this program, you can lower this number to achieve that effect: br-esc-examples/AnalogJoystickControl.ino at master · bluerobotics/br-esc-examples · GitHub

This is great thank you.

Being new to ESCs, how are the black connectors put into the breadboard? Would this be the new ESCs in the picture or the older one?

Im working on a Rov project where I am using analog joystick to control my brushless motors.
This code is great, but is there a way to break down the speed before it change direction or some way to prevent reverse/foreward before motorspeed is back to zero?

You will have to write some code to limit the rate of change of the motor command in the manner that you want, we haven’t done this ourselves.

Thanks for answer. On your rovs do you simply wait a bit before you go reverse to prevent a hard sweep in direction on the motor?