i’m working on a quadrotor and i was trying to pilot Maestro from the serial line of Arduino to control a BLDC motor connected with an ESC.
I tryed a code for arduino which i found on this forum but it was made for servos but i need to pilot an ESC.
I read it is possible and the position of the servo (the PWM time) is mapped in a speed for the ESC.
The code i found is here https://forum.pololu.com/t/additional-chassis-level/41/1.
First thing i can’t understand, is why first byte sent to the serial is 0x80 and not 0xAA as written in Pololu protocol, moreover it send first the high data and then the low data when in Pololu protocol is the reverse.
With that code the ESC just say: beep-beep-beep forever and every beep the motor moves CW and CCW a little (this happen always, also with Maestro unconnected).
-using a GAUI GUEC GE-183 esc
-ESC powered with a Li-Po battery
-I removed the blue jumper from Maestro
-I removed middle cable (+) from the triple cable going from Maestro to Esc, beacause the ESC have a BEC circuit.
-using Arduino Mega1280 with 0022 software
-Maestro powered from Arduino 5V output (gnd connected from arduino to Maestro, and reset pin too so when arduino reset, Maestro will reset too)
What ESC are you using? Does your ESC work with normal RC hobby servo signals? Before trying to get serial communication to work, can you try getting it to work using the Maestro Control Center and not the Arduino?
the ESC is: GAUI GUEC GE-183, a taiwanese ESC which doesn’t exist a datasheet.
This evening i’ll try to use it with Maestro control center and i’ll tell you how it worked.
By the way, could you tell me the corret protocol for the serial line? (Pololu Protocol).
With maestro control it’s working…now my problem is the serial communication.
Have you had a chance to look at the serial interface section of the Maestro Users’ Guide?
I read all the serial interface section.
Today I achieved move the motor with serial using this protocol:
Pololu protocol: 0xAA, device number, 0x04, channel number, target low bits, target high bits
BUT the motor wasn’t always moving as intended. Very often the motor moved at a certain speed for 1-2 seconds and then stopping (my code was giving the speed reference in a loop with a 2s delay).
1st question: do i need to send the “target” command only once to keep the motor move at that speed or do i need to send in continuosly?
2nd question: using Maestro Control Software i noticed that, with target between 64-650, the ESC was beeping and “looking” for a command, with a target between 651-1200 the ESC seemed “armed” and with 1201-1700 the speed was increasing. Why this? and how can i know/set the interval of target where the motor moves?
The answer to all of your questions basically depends on how the ESC works. It sounds like you are on your way to discovering how it works. When you command the Maestro to a specific target, it keeps transmitting that pulse width. A target value of 0 tells the Maestro to stop sending pulses to the servo.
I still have some problems…
By the way, what’s the target range i can send throught Maestro? 500-5500 or different one?
I don’t know exactly what you are referring to. What are the units of 500-5500? How are communicating with the Maestro? Whatever the answer to these questions, the answers to your questions are most likely in the Maestro User’s Guide. For example, output pulse length limitations are specified in the section called “Maestro Settings Limitations,” and the serial command that sets the target takes a 2 byte number with units of quarter microseconds.
For 500-5500 i meant the microsecond of target…i understood 0 mean Maestro stops sending pulse…so i suppose minimum is 1…right? and maximum? 16 bit (2 bytes) is 65535 in decimal…can i send this value as maximum through serial?
I found limitation…for 6 servor (motors in my case) at 333hz, the limitations are 64-2328 microseconds…is this already with the quarter microsecond resolution or should I multiply it for 4? And when it’s written 3000+, does it mean a value up to 3000 or is possible more (the +)?
Another question: how do i set the pulse rate via serial line? Standard is 20ms (50 hz) it seem…how can i change it without using Maestro Controller via USB?
The limitation tables are all units of microseconds, not quarter microseconds. Yes, you should multiply it by 4 to get quarter microseconds. 3000+ means we are guaranteeing it up to 3000 but it might be able to go higher. Unfortunately, you cannot set the pulse rate with a serial command. You can configure it in the Maestro Control Center, and it will be saved. I don’t expect that you would need to alter the pulse rate on the fly to control your ESC because, as far as I know, the receivers I have encountered do not have that flexibility.
It’s working perfectly…
I had some problem because the serial line of the board was broken (idk why), by the way with a new one mini maestro it worked very well.