Control ESC from Serial Servo controller question

Hi all,

I am using the C# code sample that colin has listed on this site. I am using it in the SSC mode and wish to control a motor with it. The ESC was just a cheap one from ebay i figured go cheap while trying to figure this out in case if smoke it. here are some specs on the ESC:

BDU 50A Brushed Speed Controller W/Reverse (6-12V,2-3CELLS LIPO.)
PARTS For R/C CARS ,BOATS Trucks and Vehicle …
Description :
Size : 72mm (L) x 26mm (W) x 23mm (H)
Weight : 50.9g (without wires, 59g with wires)
Current Limit : 50A
Input : 6-12V(2-3CELLS LIPO.)
Cut-off : Auto
Continuous Load Current : Forward 50 / Backward 30
BEC : 2cells 4servos, 3cells 3servos
Brake setting OK
With Reverse
Suitable for JR/Futaba/Hitec/GWS receiver

I have seen videos with the serial servo controller and a banebot ESC move a motor forward and reverse, but it did not go into how he did it, and from what i can find on the net the PWM is a standard for talking to a ESC. So i would think that most servo controllers can talk to most ESC, is that true?

I thought Jan had made a post in the forums about using the servo controller to talk to the ESC, but now that i am looking for it i can not find it.

in colin’s code he write to the serail port the following snipped of code:

        SerialPort port = new SerialPort(ComPort, BaudRate, Parity.None, 8, StopBits.One);
        // Open the port for communications
        port.Open();
        //convert position into hex string
        string ServoPosHex = ServoPos.ToString("X");
        //convert position into single byte
        byte PositionByte = byte.Parse(ServoPosHex, System.Globalization.NumberStyles.HexNumber);
        //convert servo number into hex string
        string ServoNumberHex = ServoNumber.ToString("X");
        //convert servo number into single byte
        byte ServoNumberByte = byte.Parse(ServoNumberHex, System.Globalization.NumberStyles.HexNumber);

        //write 3 bytes, start byte, servo number, position
        port.Write(new byte[] { 0xFF, ServoNumberByte, PositionByte }, 0, 3);

        // Close the port
        port.Close();

I have used his code for every project i have done with servos, this is the first for controling motors. from what little i understand, i need to send a 2 ms pulse for forward and 1.5ms to reverse, but i am not totally sure what that means. does the controller do that or do i need to keep sending a command to the controller from a loop.

Can someone point me in a direction or tell me how off base i am?

thanks tim

I forgot to mention, i am using a motor and battery from a 7.2 volt cordless drill for this project. I believe the motor is 550 type and is brushed motor.

thanks for any help

tim

Hello.

The speed controller should plug in just like a servo. The signals that make a servo go to one extreme (1 ms pulse width), center (1.5 ms), and the other extreme (2.0 ms) will make the speed control go forward, stop, and reverse. For units that have BEC, you should not connect a servo supply battery (but you will still need a logic supply). The user’s guide for the servo controller says some stuff about how the commands correspond to the pulse widths.

- Jan

Jan,

does it matter if i continue to use SSC mode or do i have to use Pololu mode? It seems the Pololu mode gives me more control, but i like the simplicity of the SSC mode. Your thoughts…

thanks tim

I think can answer my own question, after rereading the manual, i will need to move back to the pololu mode. since from what i can tell the SSC mode does not support the ability to accept the proper values; where the pololu mode supports the special features that i will need. is that correct? Also i should be able to control some servos and some ESC from the same serial controller, is that correct?

thanks tim

The Pololu protocol just gives you access to a few extra features:

Bigger range: this typically won’t matter for an ESC, and many can be set to work with the pulse range from your radio (or servo controller).

Higher resolution: this also won’t usually matter for an ESC since they typically don’t have that high of a resolution to begin with.

Ability to turn a servo “off”: doesn’t matter for ESC.

“Speed” control: this would translate to acceleration control on a speed control, and that probably isn’t necessary.

So, the Mini SSC protocol is certainly good enough in most cases. And yes, you can connect a mix of servos and speed controls (it’s just a one-way communication system, so the servo controller can’t even tell if you have a servo, speed control, or anything plugged in). If you do use a mix, make sure you take care of BEC correctly. In most cases, that would mean enable it on just one speed control and use that to power the servos.

- Jan

Thanks Jan,

I am following you i think on everything and will give it a test run. only thing that i am not sure about is what you said on the BEC and power. If i understand you correctly, I can still power the board from the Vin/ground with 6 volts, but instead of powering the servos from the connection where the servos are plugged in, i will connect the batteries to the ESC, this in turn when plug into the controller will also supply all power to the servos is that correct?

tim

Yeah, that’s right.

- Jan

Jan, after reading the docs on the controller, relooking at Colin’s code and probable my biggest mistake reading the documentation on the Motor controller you sell, i can say i am feeling pretty lost.

In the SSC mode i am allowed to only sent 3 bytes to the serial controller, from what i can tell from the documentation i must put 0xFF (255) in for byte one, byte 2 is the servo number which can be 0-254, but with me using only one board the value should be 0-7 to reflect the possible sockets that i can plug up to 8 servos into. This leaves us with only the servo position byte, it is my guess this is where i give a value to tell the ESC to go forward, reverse or stop. in Pololu mode a 1.5ms pulse would equal 3000 (pulse wanted * 2 * 1000) how does that translate to the value of 0-254 which is all i can put in for byte 3 while in SSC mode?

Also i think i am missing something, you mentioned earlier in this post that 1ms (forward), 1.5 (center/stopped), 2.0 (reverse) and with 3000 = center then 1000 would equal forward at full speed and 4000 would equal full reverse. In SSC mode i am not sure how to translate the pulses, but if 0 = full forward, 127 = center and 254 = full reverse and if i can already use Colin’s code to move servos forward and reverse in SSC mode using the values of 0-254. Shouldn’t the ESC be working also and turn my motor forward and reverse. And when giving a range between center and full forward, this is how i would control the speed?

I am not sure if i am on the verge of figuring this out and only need the math to translate SSC mode or if i am totally lost?

your thoughts

tim

In Mini SSC II mode, the output pulse range is about 1-2ms. So, 0 will make the speed control go full speed one way, 127 should be stop, and 254 should be full speed the other way. In general, if you keep the servo controller powered, you can swap out servos or speed controls and see how the servo position corresponds to the speed control speed.

- Jan

thanks Jan,

Wow, that means that since i can already move servos in SSC mode that I should be able to just use the same code on the ESC and it work basiclly the same way. The only difference is that if a servo is giving the command to move to position 5 it is absolute; where in a motor it really means turn the motor a certain way and speed. is that correct? And if it is, it sounds like I might have an issue with the ESC since i can move servos forward and reverse now. Does that also mean that a servo that is a continuious turning one acts like a motor on an ESC?

Yeah, the continuous rotating servo is like a motor on an ESC. Some speed controls have various safety features that require them to be armed before they deliver power to the motor, so make sure you’re following any applicable features (typically, you have to go to neutral (center of the range) first).

- Jan

Is it possible to use any ESC with SSC?
Thanks
-Som

Generally speaking, yes.

- Jan

Thanks Jan. Just would like you to give some detail about the ESC.
Shoud the ESC have reverse function or any type of ESC from the market?

Are you asking what the reverse function is? It’s the ability to make the motor go the other way than forward. Many speed controls are optimized for one direction, meaning they can provide more current forward than in reverse.

If your question is actually about whether or not you should have reverse for your project, how do you expect anyone to answer? It depends on your application, about which you’ve provided no information.

- Jan

Hello
New user got my micro servo serial controller recently.
currently i have the unit wired to a linksys wrt54gl with openwrt running ser2net then connected to my tablet running HWserialport and am running
superrobotica.com/VisualSC2e.htm its working great to control ESC on my brushless controller and have not had much issues.
in visualsc2 servos 8-16 are mirrored of 1-7 but faster. and sometimes more precice.

i am currently trying to learn visual C# to write up a progaram to control everything and well im way overwhelmed. any help or just points in the right direction would be amazing or just any tips on where to start. should i lookinto ms robotics studio>? or just stick with visual c#?

Just something to keep in mind… Most modern R/C ESCs are programmable, so make sure when you turn the ESC on, the servo position is @ center. (127 in ssc mode). Anythign more than 127 will make the motor turn forward, anything less will turn it backwards.

Hello, are you using rs232 over ethernet between your tablet pc and wrt54gl with ser2net ? if yes, can you tell us more about the HWserialport.
I am thinking about to do the same thing with socat running on pc, and wl520gu with ser2net running with the servero controller, but socat do not seems to work for hex data.