Arduino Uno Sketch

Hello experts,

I am new to this forum, and I am new to Arduino world, I bought 2 brushless motor thrusters that came with Basic ESC. I have the set up connected and works fine but when power is cycled to turn the thrusters on and off, after off thrusters don't turn back on with same set speed that is on potentiometer. I was told to use Arduino and write sketch for the motor to turn on when power is turned on, is there sketch already that I can use and then tweak the sketch to my requirement?

Thank you all,

Ravi

Welcome to the forum

Please post your sketch, using code tags when you do

How are the motors and ESCs powered ? It would help if you posted a schematic of your project. A 'photo of a hand drawn circuit is good enough

How are you power cycling to turn the thrusters on and off ?

1 Like

@ [UKHeliBob] - Thank you for your reply, I am using everything from blue robotics, 2 t500 thrusters, 2 basic ESC's for thrusters and I am using Commander to control the speed of thruster via potentiometer. I am using timer outlet that is program to turn the power supply on and off - 8 am on and 10 pm off. I was told by Blue Robitics that I will have to use Arduirno to be able to use have it turned on at one set speed when power cycled, this is the sketch they provided for Arduino, this will have to be changed to turn on the thrusters when power is turned on,

Arduino Sketch by BlueRobotics -

#include <Servo.h>

byte servoPin = 9; // signal pin for the ESC.
byte potentiometerPin = A0; // analog input pin for the potentiometer.
Servo servo;

void setup() {
servo.attach(servoPin);
servo.writeMicroseconds(1500); // send "stop" signal to ESC. Also necessary to arm the ESC.

delay(7000); // delay to allow the ESC to recognize the stopped signal.
}

void loop() {

int potVal = analogRead(potentiometerPin); // read input from potentiometer.

int pwmVal = map(potVal,0, 1023, 1100, 1900); // maps potentiometer values to PWM value.

servo.writeMicroseconds(pwmVal); // Send signal to ESC.
}

Has the Blue Robotics Thruster Commander got anything to do with an Arduino ?

no sir, Commander will be replaced with Arduino as shown below by bluerobotics

Now I am confused. Do you have a problem with the Controller or with an Arduino ?

If the letter then please do as requested in reply #2

Controller does not turn the thrusters on when power is cycled since It is designed to manually turn the potentiometer to 0 position and dial up to desired speed, Arduino have the capability to overcome this issue but sketch needs to be modified to turn the thruster on at one speed when power is cycled, I am not sure code they provided will have Arduino function as my requirement,

Youtube/electronoob has thorough series on ESC and Arduino Drone that might be helpful.

Thank you so much, I am trying to upload the sketch on my Arduino Uno and I am getting this error, any suggestions?

Start by posting you full sketch and full error message in code tags

In the meantime look at what is at the end of line 12

this is the error I copied from the sketch page

C:\Users\ravi1\AppData\Local\Temp.arduinoIDE-unsaved2023828-14072-1y4p916.b76d\sketch_sep28a\sketch_sep28a.ino: In function 'void loop()':
C:\Users\ravi1\AppData\Local\Temp.arduinoIDE-unsaved2023828-14072-1y4p916.b76d\sketch_sep28a\sketch_sep28a.ino:13:1: error: expected ')' before 'servo'
servo.writeMicroseconds(pwmVal);
^~~~~

exit status 1

Compilation error: expected ')' before 'servo'

This is line 12 in the code from post #3

int pwmVal = map(potVal,0, 1023, 1100, 1900); // maps potentiometer values to PWM value.

This is line 12 from the screenshot in post #9

int pwmVal = map(potVal,0, 1023, 1100, 1900

Can you see the difference?

It worked, I was missing part of the code in line 12

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.