Turnigy TrackStar 18A ESC

Anything to do with Propulsion.
User avatar
bikerbones1968
Posts: 374
Joined: May 10th, 2012, 5:21 pm
Location: Annapolis Valley Nova Scotia
Contact:

Re: Turnigy TrackStar 18A ESC

Post by bikerbones1968 »

Exactly how did you change the refresh rate? I know the multi rotor gurus are doing this for better stability in their copters but I haven't seen any tutorials yet. I would be interested in re-flashing some spares I have for testing and comparisons.
User avatar
KR2_Diving
Posts: 391
Joined: Aug 30th, 2012, 11:43 am
Location: Currently: NW Suburbs of Chicago. Originally: NE Wisconsin

Re: Turnigy TrackStar 18A ESC

Post by KR2_Diving »

Bones, you read my mind! How DID you modify the refresh rate Ross?
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Turnigy TrackStar 18A ESC

Post by rossrov »

Thanks guys, but I'm not that clever yet! I increased the refresh rate in my microcontroller that is emulating an RC receiver, not in the ESCs themselves. Have not altered the ESCs - settings there are the same as they've been for a good while now.
There will be Arduino and other compilers which have libraries or servo commands that use 50Hz. If you can change the library code or write your own to increase to 400Hz then good. I'd reckon some RC systems these days will have selectable servo frequency.
I've seen "SimonK" code being used to flash the micros in multicopter ESCs, but nothing in the way of alterable source code to tailor to our stuff. Closest thing has been an application note on Atmel's website which is where I'd be starting. Most ESCs use Atmel micros I believe, though the Trackstar 18A I opened up uses a Silab chip.
User avatar
KR2_Diving
Posts: 391
Joined: Aug 30th, 2012, 11:43 am
Location: Currently: NW Suburbs of Chicago. Originally: NE Wisconsin

Re: Turnigy TrackStar 18A ESC

Post by KR2_Diving »

I had a hunch you meant the Arduino code. DId you modify the "standard" Servo library that is available, or have you written your own?
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Turnigy TrackStar 18A ESC

Post by rossrov »

Not using Arduino, but the same microcontroller (Atmel), and programming with BASCOM AVR, a popular BASIC compiler for the Atmel micros. Have written a very simple program which converts serial data to PWM for the ESCs. No servo commands are used, so I can change anything I want, within limits of clock frequency and code execution time. I see you are using Arduino - if you are familiar with the timer interrupts then you could do the same in Arduino C. I will post the BASCOM code, which is very easy to read, on another thread. viewtopic.php?f=15&t=997&p=5043#p5043
User avatar
KR2_Diving
Posts: 391
Joined: Aug 30th, 2012, 11:43 am
Location: Currently: NW Suburbs of Chicago. Originally: NE Wisconsin

Re: Turnigy TrackStar 18A ESC

Post by KR2_Diving »

Found a link to someone who played with the SERVO.h library to tweek refresh rate on Servos and the Arduino.

http://forum.arduino.cc/index.php?topic=115545.0

Just thought I would post it here, for what it's worth... thinking I may have to give this a try... before I ditch the TrackStars...
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Turnigy TrackStar 18A ESC

Post by rossrov »

Thanks for link KR2. The thread suggests that only 2 servos can be used per timer? Why not write your own servo function? For me using the timers in Arduino seems at first a bit overwhelming when confronted with compare registers and the like. However, I "found" another library which looks like it would make things a lot easier: http://playground.arduino.cc/code/timer1
Here is what I'm thinking: Decide how many speed steps I need for my thrusters. For say 24 forward and 24 reverse, plus one for neutral, that's 49 steps. Close enough to 50. The pulse width needed by the ESC has a range of say 2 milliseconds from full reverse to full forward. Dividing 2 milliseconds by 50 gives 40 microseconds. The timer therefore needs to be set up to generate an interrupt every 40 microseconds. My servo function gets called every time an interrupt occurs. When the number of interrupts that have occurred equals the throttle value the output pin is set low, generating the desired pulse width. The refresh rate of approximately 400Hz can be achieved by setting the output pins high every 63 interrupts at which time the process repeats.

Just what effect this would have on the ability of the Arduino to do other tasks I cannot say - have not tried it yet :)
User avatar
KR2_Diving
Posts: 391
Joined: Aug 30th, 2012, 11:43 am
Location: Currently: NW Suburbs of Chicago. Originally: NE Wisconsin

Re: Turnigy TrackStar 18A ESC

Post by KR2_Diving »

rossrov wrote:The thread suggests that only 2 servos can be used per timer?
Yea... i kind of got that impression as well...
Why not write your own servo function?
Hmmm... the thought crossed my mind... but the jury is out on that one... my fear at the moment is that I would be trying to find fix for an issue that shouldn't be an issue: i.e. poor quality ESC...

I have a few things I am currently working on... once I get them sorted, I am going to re-examine the thrusters...

Thanks for the link! Let me know how you get on!

Ryan
"KR2_Diving"
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Turnigy TrackStar 18A ESC

Post by rossrov »

Well I was hoping someone else ;) would have a go, but temptation got the better of me. Downloaded the library this morning, and had some PWM happening an hour or so later. Testing with an ESC and getting the communications going took a bit longer. The spare Trackstar (the one not sealed up in a pressure hull) seems faulty, so I used one of my new Car-30As. I tried the code both 50Hz and 400Hz with this ESC and worked fine in each case. Code is below, and I am curious to see whether it will indeed work with the Trackstar 18A. Would appreciate any help, please. KR2??

3 ESCs can be controlled from the Arduino IDE's Serial Monitor. Select the newline option at the bottom of the monitor screen, and type in the 3 ESC throttle values with commas separating the first and second, followed by a carriage return to send to the Arduino. 38,38,38 gives neutral on all 3 motors. 25 is full astern and 50 is full ahead (or vice-versa). Clearly one wouldn't use the keyboard in this manner to control their ROV or Multicopter, so with a second Arduino topside or similar it would be easy to emulate the keyboard commands. More ESCs can be added simply by duplicating the relevant lines of code.

//timer1esctest

#include <TimerOne.h>

int step=0;
volatile int esc1=37;//37*40uS ESC neutral
volatile int esc2=37;
volatile int esc3=37;

void setup()
{
pinMode(13, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);

Serial.begin(9600);
Timer1.initialize(40); // 40uS
Timer1.attachInterrupt( timerIsr );
}

void loop()
{
while (Serial.available() > 0)
{
int esccommand1 = Serial.parseInt();
int esccommand2 = Serial.parseInt();
int esccommand3 = Serial.parseInt();

if (Serial.read() == '\n')
{
esc1=esccommand1;
esc2=esccommand2;
esc3=esccommand3;
Serial.print(esc1, DEC);
Serial.print(esc2, DEC);
Serial.print(esc3, DEC);
}
}
}


void timerIsr()
{
if (step==esc1)
{
digitalWrite(13,LOW);
}
if (step==esc2)
{
digitalWrite(8,LOW);
}
if (step==esc3)
{
digitalWrite(9,LOW);
}

if (step==63)//63 for approx 400Hz, 500 for approx 50Hz
{
digitalWrite(13, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
step=0;
}
step++;
}
User avatar
KR2_Diving
Posts: 391
Joined: Aug 30th, 2012, 11:43 am
Location: Currently: NW Suburbs of Chicago. Originally: NE Wisconsin

Re: Turnigy TrackStar 18A ESC

Post by KR2_Diving »

rossrov wrote:Well I was hoping someone else ;) would have a go, but temptation got the better of me. Downloaded the library this morning, and had some PWM happening an hour or so later. Testing with an ESC and getting the communications going took a bit longer. The spare Trackstar (the one not sealed up in a pressure hull) seems faulty, so I used one of my new Car-30As. I tried the code both 50Hz and 400Hz with this ESC and worked fine in each case. Code is below, and I am curious to see whether it will indeed work with the Trackstar 18A. Would appreciate any help, please. KR2??
I will have a play with this to see what I can do! Can't make any promises at the moment... but I will try it!

Ryan
"KR2_Diving"
Post Reply