Brushless motor, joystick

I just noticed the potentiometers in joysticks only use less than half the travel distance of the knob. The little stick shift only turns the pot from about 10:00 to 2:00 instead of the full 8:00 to 4:00 so the motors I have on either axis can't get full power. I using an Arduino nano to an ESC and a brushless motor. The question I have is, is there any way to adjust the code to get full power when the pot is about 3/4 max?

[code]
#include <Servo.h>

Servo ESC;     // create servo object to control the ESC

int potValue;  // value from the analog pin

void setup() {
  // Attach the ESC on pin 10
  ESC.attach(10,1000,2000); // (pin, min pulse width, max pulse width in microseconds) 
}

void loop() {
  potValue = analogRead(A0);   // reads the value of the potentiometer (value between 0 and 1023)
  potValue = map(potValue, 0, 1023, 0, 180);   // scale it to use it with the servo library (value between 0 and 180)
  ESC.write(potValue);    // Send the signal to the ESC
}
[/code]

Hello drumbum

Take a DMM and check the variable resistances of the pots.

Have a nice day and enjoy coding in C++.

Yes but how do you determine what the numbers should be?

DOHHHH!!!!!

Use that for safety! Suppose the ground connection is broken. Then You will read "full speed"! Perform a calibration, measure the range. Values outside the range should be handled as emergency, stop.
This is mandatory in industrial machines.

Very good idea! how do I do that? There's a 10k pot in the joystick. The motor runs forward or reverse. When the stick is in the center the resistance is 5k either way, when I push the stick full either way the pot only changes about 2k so about 7k to 3k. How does that translate to any of these numbers?

At 5K the output voltage is 0.5 x 5V =2.5V, analogRead = 512
At 7K the output voltage is 0.7 x 5V =3.5V, analogRead = 716
At 3K the output voltage is 0.3 x 5V =1.5V, analogRead = 307

..........AND the 5v reference is actually 5V.

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