Micro Joysticks In Place Of Dial On Servo Testers

Ya’akov

Joined Jan 27, 2019
10,370
I appreciate it

I understood pretty much all of that code

So the micro joysticks, are you saying that that one specific listing has potentiometers or they all have potentiometers

The first one I posted seems to say in one of the pictures that they don't go back to center on their own. Like I said before that's what I'm looking for.

Is there a way to know by looking at it if it centers itself

And is there a way to remove the self-centering mechanism

And are there any micro joysticks that would work for this that are higher quality than others
That particular type of joystick is so pervasive because it is a replacement part for console game controllers. I believe you will find that all of that type have an X and a Y potentiometer, and a Z switch.

Were I doing this, I would buy a couple from different sources, and check them. I am guessing there is a way to remove the center return spring, and possibly a way to lock the unused axis.

I think in this case, empirical investigation is the best route.
 

KeithWalker

Joined Jul 10, 2017
3,628
If you use a ATTINY85, you don't need to use any libraries or the built in PWM functions, this is all the code you need:

// Program an ATTINY85 to set position of servo by position of potentiometer.
// Pot connected to pin A1, servo connected to pin D0

int val;

void setup()
{
pinMode(D0, OUTPUT); //Defines D0 as output for servo
digitalWrite (D0, LOW); // Sets servo output low
}
void loop()
{
val = analogRead(A1); // Reads position of potentiometer
val = map(val, 0, 1023, 1000, 2000); //Scales the input range to pulse length values (uS)

digitalWrite (D0, HIGH); // Generates a positive output pulse
delayMicroseconds (val);
digitalWrite (D0, LOW);
delay (16); // Sets the frame rate
}
 

Ya’akov

Joined Jan 27, 2019
10,370
s
If you use a ATTINY85, you don't need to use any libraries or the built in PWM functions, this is all the code you need:

// Program an ATTINY85 to set position of servo by position of potentiometer.
// Pot connected to pin A1, servo connected to pin D0

int val;

void setup()
{
pinMode(D0, OUTPUT); //Defines D0 as output for servo
digitalWrite (D0, LOW); // Sets servo output low
}
void loop()
{
val = analogRead(A1); // Reads position of potentiometer
val = map(val, 0, 1023, 1000, 2000); //Scales the input range to pulse length values (uS)

digitalWrite (D0, HIGH); // Generates a positive output pulse
delayMicroseconds (val);
digitalWrite (D0, LOW);
delay (16); // Sets the frame rate
}
This is, of course, 100% correct and in this case it seems there is no particular downside to using analogWrite() and the advantage is it deals with the details for you. If the analogWrite() output doesn't provide sufficient speed or resolution, bypassing it makes sense.

@KeithWalker's version is far more granular, and so long as you have a good understanding for how it works, it makes sense to use it.
 

MisterBill2

Joined Jan 23, 2018
28,636
Still not mentioned is the issue of just exactly what sort of control signal the driver for that BLDC motor requires. If it isone designed to plug directly into an RC receiver that is one thing, if it is intended to be fed with a PWM signal, that is quite different, and if it wants an analog voltage control, still different yet.
What I see is that all assumptions are based on the controller using a PWM input. Did I miss something about the required input type being described??
 

KeithWalker

Joined Jul 10, 2017
3,628
Still not mentioned is the issue of just exactly what sort of control signal the driver for that BLDC motor requires. If it isone designed to plug directly into an RC receiver that is one thing, if it is intended to be fed with a PWM signal, that is quite different, and if it wants an analog voltage control, still different yet.
What I see is that all assumptions are based on the controller using a PWM input. Did I miss something about the required input type being described??
The original posting discussed modifications to a R/C servo tester to control the brushless motor. Therefore we can safely assume that he is using a R/C motor controller. Most controllers of this type also supply regulated 5VDC from the motor battery through the connector to power the radio receiver. That is ideal for powering the ATTINY85 so no extra supply is needed.
 

MisterBill2

Joined Jan 23, 2018
28,636
The original posting discussed modifications to a R/C servo tester to control the brushless motor. Therefore we can safely assume that he is using a R/C motor controller. Most controllers of this type also supply regulated 5VDC from the motor battery through the connector to power the radio receiver. That is ideal for powering the ATTINY85 so no extra supply is needed.
That assumption is a rather big one. Given the additional comments about "producing a PWM signal it may not be correct. Of course it is also quite possible that the TS is not conversant with the broad world of electronic speed controllers. Consider how many have presumed that an RC servo module is a "servomotor." MOST servomotors are not associated with RC systems.
 

Thread Starter

DragonTheta

Joined Feb 6, 2022
89
I just checked on the FPV forum that I find is best, and one of the experts there verified it by saying

"Yes. All BLHeli_S ESCs have backwards compatibility support for PWM"
 

Thread Starter

DragonTheta

Joined Feb 6, 2022
89
Definitely

For slide potentiometers and knob potentiometers

Are there any that are around an inch or less and are higher quality than others
 

Ya’akov

Joined Jan 27, 2019
10,370
Definitely

For slide potentiometers and knob potentiometers

Are there any that are around an inch or less and are higher quality than others
You can certainly get miniature pots of high quality, but a slide pot that small isn't very practical for much. I haven't seen one and I suspect it would be a custom thing. Perhaps a paddle-like knob with a finger depression would work in a rotary.
 

MisterBill2

Joined Jan 23, 2018
28,636
I am by no means an expert on drone ESCs, but so far as I can tell, that controller does not support PWM. It seems to use DSHOT which is a digital protocol developed for the purpose.

Are you sure it can use the PWM?

OK, finally it is verified that the BLDC motor controller DOES have an RC servo interface connection and protcol. Thus it is verified that those servo-tester boxes do speak the language that the controller speaks.
Until this point it was an assumption, not verified.
Now as for the variable controls, linear not rotary, the better quality ones are not that small. One alternative that I have seen several times is a rotary control with the edge of a thin knob through a slot in the panel. That can be done with good quality parts but even the half-inch pots are not so small.
 

Ya’akov

Joined Jan 27, 2019
10,370
Yeah, those are both junk. Hiletgo is actually a pretty decent supplier of high value low cost items but those pots are garbage compared to what you are looking for.

This is the sort of thing you need, a manufacturer like Bourns is a sure thing for quality. Their smallest slide control is 77.5mm long, so too big, but this ½" square rotary is the ticket.

1644445947191.png​
 

MisterBill2

Joined Jan 23, 2018
28,636
Plastic pots may be OK for a volume control on a radio that gets adjusted once a day. Fir a flight control that is going to be constantly adjusted I predict a lifetime of three hours until problems start. The reason being that side loading on cheap plastic bearings leads to excessive clearance in a fairly short time. Actually, using an inexpensive game controller pad may be another option..
Of course we do not know the intended function of the system controlling these motors, and so we are unable to give specific advice.
 

Thread Starter

DragonTheta

Joined Feb 6, 2022
89
Thank you, yes I meant a plastic shaft. It sounds like it would not be suitable for the application. I am going to try the potentiometers that were linked along with some micro joysticks.

I would tell more about the exact design, however, I'm planning to protect it as intellectual property. Any public disclosure would begin a timeline which would be an issue.
 
Top