servos controlled by potentiometers


Je suis bricoleur, mais très débutant en matière d’automatisme et programmation, et j’ai eu (il y a quelques années) le plaisir de réaliser un petit hexapode pour la joie de mes enfants et la terreur de mon chat, avec un Micro-Maestro et tout à bien fonctionné.

Aujourd’hui, je viens de réaliser un petit montage me permettant de contrôler (avec ou sans ordinateur) les positions de trois servomoteurs au moyen de trois potentiomètres distincts, normalement, rien de bien sorcier. En m’inspirant de différents exemples, dont certains sur ce forum, j’ai créé un script.
J’arrive à mon problème : je n’arrive pas à emmener mes servo jusqu’à leurs positions maximum, et je ne trouve pas sur que(s)l paramètre(s) intervenir.
vous joints les captures d’écran correspondantes aux onglets :

Merci d’avance de votre aide
Status: tous potentiomètres à 0
status: Tous potentiomètres à 255

Status: Tous potentiomètres à 130
Chanel settings
I’m a handyman, but very new to automation and programming, and I had (a few years ago) the pleasure of making a small hexapod for the joy of my children and the terror of my cat, with a microphone -Maestro and everything worked well.
Today, I have just carried out a small assembly allowing me to control (with or without computer) the positions of three servomotors by means of three distinct potentiometers, normally, nothing too rocket science. Drawing on different examples, some of which are on this forum, I created a script.
I arrive at my problem: I cannot bring my servos to their maximum positions, and I do not find on that (s) the parameter (s) intervene.
I attach the screenshots corresponding to the tabs:

Thank you in advance for your assistance

!Status: tous potentiomètres à 0Pot status 130|690x455


Thank you for posting those pictures of your Maestro Control Center that demonstrate the problem. It looks like you are using 4 times 4000 plus to scale the analog reading to the value for your servo signal. That will scale the 0-1023 analog value to a 4000-8092 value which corresponds to 1000-2023μs servo pulses.

However, based on the screen shot of your “Channel Settings” tab, it seems like the pulse range for your servos is actually as wide as 400-2656μs, so you will need a different operation to convert to that range. For that range, you might use 9 times 1508 plus instead, which should give you a range of 377-2679μs.

- Patrick

Bonjour PatrickM,
Merci beaucoup, pour vos précisions qui m’ont amenées à mieux comprendre l’interprétation des données.
Après rectification, tout fonctionne parfaitement.
Il ne me reste plus qu’à compliquer, progressivement, mon projet, et je reviendrais certainement avec d’autres difficultés, c’est comme cela qu’on apprend et qu’on progresse.
A bientôt.

1 Like

Hi guys, not wishing to hijack this thread but i have the exact same problem as Neobreton29. What i don’t understand is why in the status and channel tabs the servo positions use one range of seemingly random numbers (900ish to 2000ish) but then in the script it changes to a range from 4000 to 8092, and yet what they are actually using is a change in pulse width between 1-2ms? Could someone explain the origin of the different ranges please. I also have the problem of needing to invert either my pot or servo signal as currently the servo moves the wrong way in relation to the pot
many thanks


As defined in the Maestro Scripting Language Command Reference section of the Maestro user’s guide, the SERVO command sets the pulse width of the servo signal in quarter-microseconds (0.25μs). That is the Maestro’s maximum pulse width resolution.

The origin for that setup stems from the fact that a program in the Maestro script language consists of a sequence of commands which act on a stack of values, and the values in the stack are integers. There are no decimal values. Therefore, the inputs for the SERVO command are in units of to 0.25μs to make that Maestro’s full maximum resolution accessible.

- Patrick

Thanks for the reply, that now makes sense. So if the servo command is 8000 that means 8000 lots of 0.25μs which equals 2000μs which equals 2ms.

I actually managed to make some progress after i read your earlier response yesterday and i’ve inverted the pot signal and managed to get the full sweep of the pot quite close to the full sweep of the servo.

Something i noticed that confused me is when doing what i thought were simple calculations in order to convert the pot signal to a servo command signal i got some strange results in the stack, like negative numbers after doing a divide, or getting a smaller number than expected after doing a times

The values in the stack are integers from -32768 to +32767, so it is possible some of the weird behavior is a result of the value overflowing. If the weird values are causing problems, them my best suggestion is the next time it occurs, repeat whatever caused the result to see if it is repeatable. Then simplify your script to the simplest thing that causes the problem. If you do that and cannot figure out what is going on, post more details and we can take a look.

- Patrick