Control 2 ESC with one potentiometer

I have 2 ESC (electronic speed controller) which control brushless motors (https://hobbyking.com/en_us/hobbyking-donkey-st3511-810kv-brushless-power-system-combo.html?gclid=CjwKCAjwm-fkBRBBEiwA966fZNUs_Lq5O0I9nkySMYFtYdEYreK2LXFlR0XGbOV2MIj9oXWXFvWRkxoCAhEQAvD_BwE&gclsrc=aw.ds&___store=en_us)

I would like to make them work with a poentiometer, under arduino.

I have a program but it only works with one engine. Here is the program :

"#include <Servo.h>//Using servo library to control ESC

Servo esc;
Servo esc2;
//Creating a servo class with name as esc

void setup()

{

esc.attach(9); //Specify the esc signal pin,Here as D8

esc.writeMicroseconds(1000); //initialize the signal to 1000

Serial.begin(9600);

esc2.attach(9); //Specify the esc signal pin,Here as D8

esc2.writeMicroseconds(1000); //initialize the signal to 1000

Serial.begin(9600);

}

void loop()

{

int val; //Creating a variable val

val= analogRead(A0); //Read input from analog pin a0 and store in val

val= map(val, 0, 1023,1000,2000); //mapping val to minimum and maximum(Change if needed)

esc.writeMicroseconds(val); //using val as the signal to esc
esc2.writeMicroseconds(val);
} "

I did not find help on the internet, thank you in advance.

According to that program you have both ESCs connected to the same pin (9). Is that how they are really connected?

Steve

No on the real program it is on the pin 10

PICHAR:
No on the real program it is on the pin 10

So, you didn't post your real code? Why not?

I don't have the ESC / brushless motors that you have, but your code, with one of the attach(9)'s changed to 10, works for me with 2 servos.

Please please please please PLEASE!!! When posting code in the forum do not just copy and paste it into your post. Above the box you type into when making a new post or a reply is a whole series of buttons. If you hover your mouse over the 11th button from the left in the top row (The Hash # symbol) you will see it says "Insert Code". Click on this and then inbetween the two sets of brackets paste your code.

This way your code is captured inside a small box with scrollbars making it easy to read and keeping the size of the whole thread to a minimum. If you don't do this, the thread turns into pages and pages of code, with lots and lots of mouse wheel scrolling to be done to read it, making it hard work to read and losing its clarity.

BullEngineer:
Above the box you type into when making a new post or a reply is a whole series of buttons. If you hover your mouse over the 11th button from the left in the top row (The Hash # symbol) you will see it says “Insert Code”. Click on this and then inbetween the two sets of brackets paste your code.

Actually it’s this icon:

Code tags.jpg

I don’t even see a # icon, so not sure where that instruction came from.

PICHAR:
No on the real program it is on the pin 10

Then I guess in the real program it probably works.

If not then then try putting a delay(1000) at the end of setup to give both ESCs time to initialise.

Steve

slipstick:
Then I guess in the real program it probably works.

It did for me, but with servos, not ESCs; ie the previous code with one attach changed to a 10.

My servos went back and forth as expected, it’s really just knob, doubled up.

neiklot:
It did for me, but with servos, not ESCs; ie the previous code with one attach changed to a 10.

My servos went back and forth as expected, it's really just knob, doubled up.

Yes but servos don't need particular initialising whereas ESCs quite often do.

Steve

slipstick:
Yes but servos don't need particular initialising whereas ESCs quite often do.

Steve

I know that, and didn't mean to say (and in fact didn't say) that it would work with ESCs. All I meant was that the OP's code was "intact" in the sense that the writes are changing with the pot, as expected.

neiklot:
I don't have the ESC / brushless motors that you have, but your code, with one of the attach(9)'s changed to 10, works for me with 2 servos.

When i turn everything on, only one motor turns. The ESC are on pin(9) and pin(10), and ground. The potentiometer is on A0 for the information, 5V and ground. The esc and the arduino card are on an external power source. It the same motor that turns, when on pin(9) or (10). (The second motor turns when the connnections change).
I can't understand why doesn't it work.

PICHAR:
It the same motor that turns, when on pin(9) or (10). (The second motor turns when the connnections change).

Sorry that doesn't make any sense.

Do you mean that only one of the motors ever turns whether it is connected to pin 9 or pin10? If so then the other motor or ESC is bad. If not perhaps you could try the explanation again.

Do you hear any beeping from the ESC/motors? Both of them?

Can you post a diagram showing exactly what wires are connected where and also give details of the "external power source".

Steve

Yes only one motor turns whether it is connected to pin 9 or 10.
The ESC that doesn't turn does 1 less beep than the one who turns.( The final beep isn't emitted)
The external power source is just an alimentation of 0-30 V set on 12V with 3A possible.

Are the ESCs the same as each other? Maybe one needs a different arming sequence?

They are exactly the same. The problem is that I have already done a test and both work normally. And I can’t understand why this time only knew motor turns.

If all you want is to control 2 escs with one pot then just hook up the signal lines together to one pin.

Thank you for the post, I will try it and then tell you back. ( Probably Wednesday )

I tried but it doesn't work. The second motor doesn't turn

Take a couple of pictures of your setup that clearly shows the connections along with a hand drawn schematic.