Turnigy Trust 70A sbec brushless speed controller help

Hello everyone, my friend asked me to help him with an electric longboard, we will use Turnigy Trust 70A sbec ESC for controlling a brushless motor, a bunch of batteries and a potentiometer for the speed.
My problem is not how to connect it but how to programm it, i can't find anything on internet about, I know I must use Servo.h library, but i don't know much more. Can someone help me? =( =( =(

If it is just a simple speed control then you might use the map function:
http://playground.arduino.cc/ComponentLib/servo

http://playground.arduino.cc/Learning/SingleServoExample

The throttle is a servo channel so it uses a servo signal. This means any code written to control a servo will control the ESC.
MIN = 0 , MAX = 255. The servo library converts these values into duty cycle pulse width in microseconds with min being 1000 uS (1 mS) and max being 2000 uS (2 mS).

Whatever you do, DO NOT attempt to use the analogWrite command to control and ESC. ("That would be BAD", to quote Ghostbusters).
This is probably what you are looking for. I would start with this example:

thank you very much!! :slight_smile:
i’ve already seen Knob example and i have tryied it with a servomotor. But, is it the same for brushless? that angle in a servo will be speed in brushless?
And what about initialization of ESC and other things? should i do something like this?

But, is it the same for brushless?

There is no "brushless".
There is no "angle"
It is an Electronic Speed Controller (AKA , ESC), consequently there is only Min ==> Max. There is nothing else.
(meaning it would work the same way for a dc BRUSHED motor . There would simply be only min and max and everything in between.
It's as simple as that.

Perfect! Thank you again! i will try asap :wink:

EDIT: another question: should i delay some milliseconds in the loop?

Note that most ESCs require an arming sequence to operate. Below are previous post concerning ESCs that may have useful information.

https://www.google.com/search?as_q=esc&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=http%3A%2F%2Fforum.arduino.cc%2Findex&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=&gws_rd=ssl

Right. I forgot to ask you if you had any RC experience. If not, as already mentioned, there is an arming sequence. In addition to that, there is a Programming sequence to configure the ESC. You MUST READ THE DOCUMENTATION and follow the programming setup. That is very important. Things like HARD BRAKE, SOFT BRAKE AND NO BRAKE can mean the difference between life and death for you if you are using the ESC for a Longboard. DO NOT RIDE THE LONGBOARD UNTIL YOU HAVE VERIFIED THAT YOU HAVE DISABLED THE BRAKE OR THE BOARD WILL STOP SUDDENLY AND YOU'LL GO AIRBORN AND MAYBE LAND ON YOUR HEAD (OR ON A CAR).
Things like SLOW START AND FAST START CAN PUT YOU IN THE HOSPITAL TOO. FAST START WOULD MAKE THE BOARD LEAP FORWARD SUDDENLY SENDING YOU INTO A REVERSE SUMERSAULT ONTO YOUR HEAD AND POSSIBLY BREAK YOUR NECK.

Am I over-emphasizing the issues here ? Do you understand the gravity of the situation ?

Of course I understand the situation, and i know that it's dangerous to ride this thing, I'm conscious of what can it be if I configure wrong my esc.
About arming I saw on web that i must do it, but i don't know the sequence, i've searched on google and found some different configurations, i think i will try with them, because i'm not sure my friend has documentation :confused:

EDIT: ok, my friend has documentation for the 70A esc, but we will try with a smaller esc before putting it on longboard, and he has no documentation for the second one :frowning: i will search on google hoping to find something.
For you question: no, I don't have experiences with RC, not in this way.

Post a copy of the programming sheet you have. You can also take a photo of it and post that. post a photo of the ESC you don' t have the programming sheet for.
The arming sequence is usually a requirement that the throttle be at zero position in order to arm . If it is at zero position then the " ARMING" tone sequence begins. When you hear the last note of the "ARMING" TONE sequence then it arms. That means that to prevevt the " ARMING " tone sequence from playng (which pre ents ESC from arming) , all you have to do is put the throttle at MAXIMUM BEFORE plugging in the battery. I know this sounds counter intiitive and many people find it hard to overcone their fear
that the motor will staet turning as soon as they plug in the battery. Test it on the bench with nothing connected to the motor
shaft. What you will see is that if the throttle is at FULL position it plays the "THROTTLE ON!" warning tone sequence INSTEAD of the
" ARMING" sequence. The throttle remains DISARMED as long as the throttle remains at full position. ( sounds contradictory doesn't it?)
When you move the throttle from Full to Zero, THEN the "ARMING" tone sequence begins. When it completes, the ESC arms and the throttle arms.

It’s working! thank to all you guys!
This is the code:

#include<Servo.h>
Servo motor;
 
void setup() {
  motor.attach(6);  //Turnigy
  delay(1);
  motor.write(40);   
  pinMode(A0,INPUT);  //Potenziometro
  pinMode(2,INPUT);  //Switch 1
  pinMode(4,INPUT);  //Switch 2
  pinMode(5,INPUT);  //Bottone
}
int s=0;
void loop(){
  if(digitalRead(5)==1){  //Bottone
    motor.write(179);
  }
  else{
    if(digitalRead(2)==1){  //Switch 1
      s=analogRead(A0);
      s=map(s, 0, 1023, 0, 126);  //70% potenza massima  (178)
      motor.write(s);
    }
    else if(digitalRead(4)==1){  //Switch 2
      s=analogRead(A0);
      s=map(s, 0, 1023, 0, 171);  //95% potenza massima  (242)
      motor.write(s);
    }
  }
}

There is a on-off-on switch that sets speed limit on 70% and 95%, a button that speeds it up to 100% and potentiometer.
I have tried with the big esc, with the user manual, but i didn’t use it because it worked as Rashemmel said :wink:
Now i just have to set up a way to slow down and a security lock, for example if potentiometer is on max, the motor will not go, or it will accelerate gradually

RC transmitters spring-return to mid-range don't they - I'd have thought using
servo.write (90) would set mid-range and prevent arming until calling
servo.write (0).... Thereafter mid-range will be a forward speed of course.

Sounds a little bit less risky than using servo.write (180) to prevent arming.

If the ESC and motor are sensorless you'll have trouble starting under load, a clutch
would be needed perhaps?

i didn't think about the weight :blush:
i think that a big motor and a good battery (the two in the photo are just to try at home, the real motor is much bigger, and battery is also) will support a man without problems, if not, i will put a clutch :wink:

about autostart it would be not possible due to arming, if the potentiometer is not on zero, it won't even start, so i think that this is not a problem.
Another question might be brakes: in the user manual of the esc is written that brake is off by default. I don't need it because i'm scared to fly forward if it stops suddenly.

EDIT: the motors will be 2, 1000W each
I think it will be enough :wink:

Program it for SLOW START (NOT FAST START).

How can i control that from arduino?

As I said before . You MUST perform the entire programming sequence from start to finish following the user manual before you use the ESC. This does not change because you are using an arduino . I thought it would be obvious to you that the programming settings are stored in non-volatile memory (EEPROM) and therefore are not lost on poweroff (otherwise you would have to program it every time you used it.).
So I will ask you,
HAVE YOU, OR HAVE YOU NOT, EXECUTED THE ENTIRE PROGRAMMING SEQUENCE (ALL THE SETTINGS) FROM START TO FINISH AT LEAST ONCE ??? !!!!!!!!!!

no, because i don't know how to program it, i just know how to make it going forward :disappointed_relieved:

In the user manual i just have a bunch of settings drawed with musical notes! it's not written how to use them, i think they are for programming card

EDIT: ok, i found out how to enter in programming mode, now i don't know how to move, it's just playing some music :smiley:
i'll try to figure out

i setup the cuttoff , and starting sounds and other settings for the esc true remote movements ,,
i made a program doing those movements ,, just like a esc programing card ,,
you can build your own ,,
if you know the commands ,, and you can make a arduino esc programing card :smiley:

Yes, I never though about that but of course that’s true because you can generate the servo signals to simulate the throttle at the TOP and so forth but you need to listen for the items and use some kind of user input to generate the throttle positions (you could do it with 3 pushbuttons, one for bottom , one for midpoint and one for top position. When you hear the item number or item value, you push the appropriate button. I wouldn’t bother with that approach because it only took me 5 minutes to learn how to program it.

TURNIGY PROGRMMING INSTRUCTIONS.pdf (1.5 MB)

The programming sequence uses musical notes to denote the following:
SELECT FUNCTION
SELECT SETTING
NEXT FUNCTION
etc.
Once you learn the musical sequence you can do it blindfolded without the manual.
Post a copy of the user manual you have so I can look at it.
Basically , if you know how these things work, you can figure it out by how many choices you have.
It always requires a special throttle sequence to enter the programming mode
1- Put throttle on FULL
2-wait for special tone (a certain beep sequence)
3- put throttle at MIDDLE POSITION
4-wait for tone
5- Put throttle on FULL
wait for tone
put throttle at MIDDLE POSITION
ENTERS PROGRAMMING MODE AND STARTS TONE INDICATING FIRST SETTING IS READY TO BE SET.
Post the name (brand of the ESC) a copy of any documentation you have.
Post the Turnigy model number
read this:

READ THE PART ON THE RIGHT HAND SIDE WHERE IT SAYS “Program ESC , 4 Steps”
READ THE PART THAT SAYS “Enter Program Mode”
READ THE PART THAT SAYS “Select Programable Items”
print out the attached document

After folloiwing the instructions for “Enter Program Mode”, there will be a special sequence of tones that indicates you have entered programming mode.
Once it enters programming mode , it sequences through the 8 steps (one for each programable item) . Read the instructions about if you move the throttle to the down position within 3 seconds after that item beep sequence begins, it will select that item.
THEN, you need to READ the inctructions for step #3 “Set Item Value” . When you find the item value you want you need to wait until you hear the beep sequence at the top of that column. When you hear it, move the throttle back to the top (remember the LAST thing you did with it is move to the bottom to select the item. Now you have to move it back to the TOP to select the item VALUE).
Read ALL of the instructions on the right hand side of the page until you understand them.
Do a DRY RUN where a friend pretends to be the ESC and makes the beep sounds. Tell him the standard delay between item beep sequences is 2 to 3 seconds, so if the first item is “beep” and the second is “beep beep” , there is a 2 to 3 second delay between the two.
So put the throttle to the top position and go through the sequence to enter programming mode. To EXIT programming mode just unplug the battery. Once you enter program mode listen to the sequence of the 8 item tones to get a feel for it.
Then unplug the battery and do a DRY RUN with a friend mimicing the beep sounds while you move the throttle to simulate programming the ESC. When you can do it correctly several times without a mistake, plug in the battery and do it for real.
It’s not rocket science. If you can’t do this you shouldn’t be using the ESC. Everything needs to be set. The three most important settings are BRAKE, STARTUP MODE, and TIMING. The MEDIUM & HIGH Timing modes could make a BIG difference in performance of the motor. You MUST learn how to program it. I am not joking. You really must NOT use the ESC UNTIL you have done this.
Good luck

TURNIGY PROGRMMING INSTRUCTIONS.pdf (1.5 MB)

whe could be brothers ! LOL , 8)