ESC calibration

User avatar
captaingeek
Posts: 228
Joined: Fri Jan 28, 2011 6:42 pm

ESC calibration

Post by captaingeek »

I'm using RCtimer 30A esc's and I beleive the throttle calibration on them is getting messed up for what ever reason. I have them running on a hex and their pretty well hard wired in so its a pain to reset the throttle enpoints calibraion and programming changes by hooking up directly to an RX.

My question is if I#define MINTHROTTLE to 2000 would this be a good way to get them into programming mode?

I would just apply power seperately to the MWC first, activate throttle then power up the ESC's to calibrate and enter programming mode...


Any thoughts?

tovrin
Posts: 705
Joined: Tue Sep 20, 2011 4:08 pm

Re: ESC calibration

Post by tovrin »

I have often wondered if there is a sketch that could be written and loaded to the arduino that would assist with programming all ESCs at once. including the min\max throttle.

would be a lot easier to change sketches in the arduino back and forth than to tear it apart everytime i need to program or configure something on an esc.

cardboard
Posts: 183
Joined: Tue Mar 15, 2011 9:40 am

Re: ESC calibration

Post by cardboard »

Agreed I to would like a coded option to calibrate all ESC's at once. Doing them all one by one is a pain, especially when you have to dismantle most of a copter to get to all the appropriate plugs and what not.

User avatar
matbogdan
Posts: 29
Joined: Wed Nov 23, 2011 9:35 am
Contact:

Re: ESC calibration

Post by matbogdan »

cardboard wrote:Agreed I to would like a coded option to calibrate all ESC's at once. Doing them all one by one is a pain, especially when you have to dismantle most of a copter to get to all the appropriate plugs and what not.


This is what I've created to calibrate ESC on my quad:
RC3toMotor.rar
(89.27 KiB) Downloaded 712 times


Feel free to modify and adapt the software as it fit for you.
I hope this will help you to do the job.
Maybe someone in the dev team will adapt this to be more easy to configure for any number of motor config and place it in the code svn as a separate project.

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: ESC calibration

Post by KeesvR »


User avatar
captaingeek
Posts: 228
Joined: Fri Jan 28, 2011 6:42 pm

Re: ESC calibration

Post by captaingeek »

matbogdan wrote:
cardboard wrote:Agreed I to would like a coded option to calibrate all ESC's at once. Doing them all one by one is a pain, especially when you have to dismantle most of a copter to get to all the appropriate plugs and what not.


This is what I've created to calibrate ESC on my quad:
RC3toMotor.rar


Feel free to modify and adapt the software as it fit for you.
I hope this will help you to do the job.
Maybe someone in the dev team will adapt this to be more easy to configure for any number of motor config and place it in the code svn as a separate project.


OK so how do we use this?

User avatar
captaingeek
Posts: 228
Joined: Fri Jan 28, 2011 6:42 pm

Re: ESC calibration

Post by captaingeek »

KeesvR wrote:And here's another one: http://www.file-upload.net/download-421 ... 2.zip.html


looks like download link hell. do you have a file we can easily download? not trying to install spyware.

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: ESC calibration

Post by KeesvR »

Paul from Flyduino placed this link on his topic, I haven't tried it so I don't know if its spyware.

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: ESC calibration

Post by Federico »

matbogdan wrote:
cardboard wrote:Agreed I to would like a coded option to calibrate all ESC's at once. Doing them all one by one is a pain, especially when you have to dismantle most of a copter to get to all the appropriate plugs and what not.


This is what I've created to calibrate ESC on my quad:
RC3toMotor.rar


Feel free to modify and adapt the software as it fit for you.
I hope this will help you to do the job.
Maybe someone in the dev team will adapt this to be more easy to configure for any number of motor config and place it in the code svn as a separate project.



Why rcValue contains 8 values but just rcValue[²] is used?
Where 900 and 2200 in comes from?

Code: Select all

if(900<diff && diff<2200 && chan<8 ) 


Why do you accept values outside of the range 1000-2000? Shouldn't be instead

Code: Select all

if(1000<=diff && diff<=2000 && chan<8 ) 


However looks like the code is assigning a random number between 900 and 2200 to rcValue... could you explain this sourcecode?

Thanks, Federico

User avatar
djrm
Posts: 40
Joined: Wed Feb 15, 2012 11:32 pm
Location: North Yorkshire, UK

Re: ESC calibration

Post by djrm »

captaingeek wrote:
KeesvR wrote:And here's another one: http://www.file-upload.net/download-421 ... 2.zip.html


looks like download link hell. do you have a file we can easily download? not trying to install spyware.


I have looked at the software from the link above, it contains a version of Multiwii V1.8 with a change to the initOutput function in Output.pde

The change alters this

Code: Select all

  writeAllMotors(1000);
  delay(300);
to this

Code: Select all

  writeAllMotors(2000);
  delay(3000);
  writeAllMotors(1000);
  delay(500);

So the ECSs will be initialised to min/max every time Multiwii boots.
If it does not work properly then your copter will be launched into space :-(
If you have a standard HW compatible ESC then it should work but I have not tried it.
hth David.

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: ESC calibration

Post by KeesvR »

I never trust these things and don't use them.

Simply disconnect the signal wires thats all.

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: ESC calibration

Post by Federico »

The point is that, for example, my cheap radio turnigy sometimes has as max value 1900, sometimes 1910 (example values), depending on how fast and how strong you move the stick. So I suppose that the ESCs are not equally trimmed. Plus, there is no reason not to automatize the calibration system, if the code is correctly written.

tovrin
Posts: 705
Joined: Tue Sep 20, 2011 4:08 pm

Re: ESC calibration

Post by tovrin »

I couldnt get the first one to compile, and the second one was too much for me to decode, there's got to be an easier sketch we can use.

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: ESC calibration

Post by Federico »

tovrin wrote:I couldnt get the first one to compile, and the second one was too much for me to decode, there's got to be an easier sketch we can use.


This one compiles, but I am still waiting for the explanation requested :-(

Code: Select all

/*
www.fuzzydrone.org
by Bogdan Matei
*/

#include <Servo.h>
//#include <ServoTimer2.h>
 
Servo serv1;
Servo serv2;
Servo serv3;
Servo serv4;
Servo serv5;

// a maximum of eight servo objects can be created
#define PPM_PIN_INTERRUPT          attachInterrupt(0, rxInt, RISING); //PIN 0
volatile uint16_t rcValue[8] = {1502,1502,1502,1502,1502,1502,1502,1502}; // interval [1000;2000]

void rxInt() {
  uint16_t now,diff;
  static uint16_t last = 0;
  static uint8_t chan = 0;

  now = micros();
  diff = now - last;
  last = now;
  if(diff>3000) chan = 0;
  else {
    if(900<diff && diff<2200 && chan<8 ) {   //Only if the signal is between these values it is valid, otherwise the failsafe counter should move up
      rcValue[chan] = diff;
      #if defined(FAILSAFE)
        if(failsafeCnt > 20) failsafeCnt -= 20; else failsafeCnt = 0;   // clear FailSafe counter - added by MIS  //incompatible to quadroppm
      #endif
    }
    chan++;
  }
}
 
int pos = 0;    // variable to store the servo position
int val=0;
int minv=50;
int maxv=170;
void setup()
{
   Serial.begin(115200);
   PPM_PIN_INTERRUPT
//11,10,9,3
   serv1.attach(11);
   serv2.attach(10);
   serv3.attach(9);
   serv4.attach(3);
   serv5.attach(6);
   Serial.print(rcValue[2]);Serial.print(" ");Serial.println(val);
}
 
 
void loop()
{
//   val=map(rcValue[2], 1000, 2000, 0, 180);
//   val = constrain(val, minv, maxv);
   Serial.print(rcValue[2]);Serial.print(" ");Serial.println("");
   serv1.write(rcValue[2]);
   serv2.write(rcValue[2]);
   serv3.write(rcValue[2]);
   serv4.write(rcValue[2]);
   serv5.write(rcValue[2]);

   //delay(1);
}

User avatar
djrm
Posts: 40
Joined: Wed Feb 15, 2012 11:32 pm
Location: North Yorkshire, UK

Re: ESC calibration

Post by djrm »

Hello Federico,

My understanding of the software is that it connects all four ESCs to your transmitter (via the ESC ports on the FC) at the same time. This would be a manual process of calibrating the ESCS like you could do if the ESCs were connected diretley to the receiver. I have not tried it but I was curius myself so I read through it. By the way it does not compile because the required ServoTimer2 library needs to be installed first.

hth David.

mr_rsv
Posts: 7
Joined: Tue Jan 17, 2012 9:14 am

Re: ESC calibration

Post by mr_rsv »

djrm wrote:


So the ECSs will be initialised to min/max every time Multiwii boots.
If it does not work properly then your copter will be launched into space :-(
If you have a standard HW compatible ESC then it should work but I have not tried it.
hth David.[/quote]

If somebody try's this and it has the space effect' please get it on camera and link it :lol:

chris ables
Posts: 317
Joined: Wed Feb 08, 2012 8:42 pm
Location: United states

Re: ESC calibration

Post by chris ables »

http://www.multiwiicopter.com/pages/multiwiicopter-wiki. Go to bottom of page on this link and that's what I do and it works for every brand esc!! You can also purchase a cable like this from whitespy ! This is easy and only requires receiver and esc's !!

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

djrm wrote:[
I have looked at the software from the link above, it contains a version of Multiwii V1.8 with a change to the initOutput function in Output.pde

we could include this code in MultiWii and activate it via a #define in config.h. It would build into a special version for your copter which is only good for calibrating all the ESCs attached. It would explicitly prevent entering the flying state.
That way , only if you want to use MWii to calibrate your copter's ESCs
- you set up config.h for your copter as usual, then activate #define CALIBRATE_ESCS_CANNOT_FLY in config.h, upload, power copter so ESCs get calibrated, - flying is not possible
- power off, comment //#define CALIBRATE_ESCS_CANNOT_FLY, upload again and go flying.

What do you think? Would that ease your calibration woes?

User avatar
djrm
Posts: 40
Joined: Wed Feb 15, 2012 11:32 pm
Location: North Yorkshire, UK

Re: ESC calibration

Post by djrm »

Greetings Hamburger, your idea is good.

There is also another patch version of auto ESC cal software with some more checking for protection here: http://fpv-community.de/wiki/index.php? ... i_anlernen
This one is only ever activated at power up if the throttle is set to full on.

I am looking at these ideas to use in conjuntion with an ESC programming sketch which could be used as an all in one ECS setup program on a seperate nano or even on the FC as you suggst.
Here the HW ESC software is described: http://www.rcgroups.com/forums/showthread.php?t=1567736

Best regards, David.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

I implemented the sequence as described earlier. It is now in the _shared branch. Please, I cannot test it, all my ESCs are reflashed and do not need nor take normal calibration. So I invite you to test it and report back, please. If we do not hear from users, the feature is likely to be removed from the code again.

User avatar
seibernator
Posts: 7
Joined: Sun Apr 29, 2012 11:38 pm

Re: ESC calibration

Post by seibernator »

Hello Hamburger, I cannot find the shared branch on the Multiwii Google code page. Could you please tell me where it is and if I am looking in the right place? Thanks.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »


User avatar
seibernator
Posts: 7
Joined: Sun Apr 29, 2012 11:38 pm

Re: ESC calibration

Post by seibernator »

Nice one, thanks. I will test and report this evening.

User avatar
seibernator
Posts: 7
Joined: Sun Apr 29, 2012 11:38 pm

Re: ESC calibration

Post by seibernator »

Just one more question, do I just need to copy across the config.h file to my version of 1.9 or do I need to copy across all of the files?? Thanks.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

It is a dev version.
Never mix files.

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: ESC calibration

Post by Federico »

/* 3. compile, upload, run --- cannot fly and will use Buzzer to indicate finished calibration */


What does "run" means? Arm the motors? Or "switch on the copter" ?

Thanks!

m00se
Posts: 54
Joined: Sat Jan 21, 2012 10:09 pm

Re: ESC calibration

Post by m00se »

hi

im interested in this, has anyone tried it yet?

im having a ton of problems with the esc settings, so i dont want to mess with them anymore until someone can confirm that this works,
thanks

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

Run means power the copter from battery - just cannot fly.

gionag
Posts: 4
Joined: Fri Mar 23, 2012 12:55 am

Re: ESC calibration

Post by gionag »

very good idea,
i have 4 x esc flashed with simonk latest firmware that accept the "standard" end-points calibration sequence.

BUT

the thing on the latest DEV version doesn't work at all. I can't provide any other infos apart from the fact that, after de-commented the right line in config.h and flashed, after the reboot of the mcu the ESC don't beep at all...

I don't know what happened. any ideas ?

Michele

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

maybe the timing is not right?
There is a definite delay between full-throttle and zero-throttle. You can try and change the delay in MultiWii.ino.
If you do not know how to do that, you have to wait for other people's input, sorry.

User avatar
captaingeek
Posts: 228
Joined: Fri Jan 28, 2011 6:42 pm

Re: ESC calibration

Post by captaingeek »

vert intersted in getting this put into the main branch will test soon

shufflez
Posts: 42
Joined: Sat Nov 19, 2011 5:26 pm
Location: Amsterdam, Netherlands

Re: ESC calibration

Post by shufflez »

Didn't seem to work for my octo set-up, not all ESC's got same throttle signal in time. Strange enough.
I've tried fiddling around with the time delay within the code, but couldn't get the timing correct.
Maybe there should be a delay added before the procedure starts, I don't know how long ESC's wait for full throttle to get in 'program mode'?
My config-card always takes a while to initialize after powering ESC, or so it seems

Now calibrated ESC's with MINTHROTTLE and MINCOMMAND (in my case 900):
!! MAKE SURE NO PROPS ATTACHED !!
1. Change MINTHROTTLE to 1950
2. Upload software
3. Power FC separately from ESC's
4. After FC has booted, ARM motors (in my case AUX1)
5. Connect power to ESC's
6. Wait to hear confirmation beep from ESC's
7. Disarm motors (AUX1 off)
8. Wait for confirmation beep
9. Disconnect power from ESC's
10. Connect board to PC again, change MINTHROTTLE back to original settings (in my case 1000), upload, test CAREFULLY.

This worked for me. Maybe Hamburger's code could be adjusted to use the ARM/DISARM combination with existing procedures?
For example, probably awful code, but I'm no coder :) :

Code: Select all

#if defined(ESC_CALIB_ON)
  delay(1500); //wait for ESC init
  if (armed == 1) writeAllMotors MAXTHROTTLE; //sets high-point
  delay(1000); //wait for ESC high-point confirmation
  armed == 0; //set low-point
#endif


I understand the need for CANNOT_FLY procedure for safety, although I couldn't figure out/find where the procedure limits actual flying?
Is it because of 'hijacking' writeAllMotors with set values?

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

no, it is a security measure.
background: The calib sequence gets ececuted upon every poweron and every reset of arduino. That could result in some unwanted maximum throttle flight when only arduino gets reset but ESCs already running.
To avoid all this I made it into a special version which will sit idle forever after the calibrating sequence. That should kindly force everyone in re-flashing with a flyable MWii version once calibrating is done.

shufflez
Posts: 42
Joined: Sat Nov 19, 2011 5:26 pm
Location: Amsterdam, Netherlands

Re: ESC calibration

Post by shufflez »

Security, safety... Similar but different ;)
I understand the security measure, I'd hate my copter to go full throttle just about anywhere.

Depending on how fast the MWC code loads after poweron/reset I think the solution for your code to set end-points is a delay before writing writeAllMotors HIGH.
Does anyone have any idea on how fast MWC loads/processes code and how long the 'timeframe' for ESC's is to set high-end point?

spidi
Posts: 5
Joined: Mon Jun 04, 2012 3:44 pm

Re: ESC calibration

Post by spidi »

I tried this, i even changed the delay to 8000 but it doesn't work.

My motors just starts to beep, and the beeping is getting slower around the motors... What could be wrong?

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

Maybe adxuino boot is too slow?

spidi
Posts: 5
Joined: Mon Jun 04, 2012 3:44 pm

Re: ESC calibration

Post by spidi »

i don't know...how can i test that?

I have Crius MultiWii SE.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

I think that no simple test exists.aybe if ypu had a board woth different bootloader...
So for now if it does not work you are out of luck

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

hey,
anyone had any success using the esc-calibration routine in the dev version?
Up until now I have seen failure reports only. If it does not work, we might better remove it.

So if it has worked for you, now is the time to speak up, please.

spidi
Posts: 5
Joined: Mon Jun 04, 2012 3:44 pm

Re: ESC calibration

Post by spidi »

For me it didn't work.
i just got error beeps from my ESC's.

I soldered together cable from 1 channel to 4 and calibrated all esc's at the same time from 1 channel. That worked.

User avatar
captaingeek
Posts: 228
Joined: Fri Jan 28, 2011 6:42 pm

Re: ESC calibration

Post by captaingeek »

which version should we test? do you have a link?

Hamburger wrote:hey,
anyone had any success using the esc-calibration routine in the dev version?
Up until now I have seen failure reports only. If it does not work, we might better remove it.

So if it has worked for you, now is the time to speak up, please.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

any of the later DEV versions from download or the _shared whould contain that code.
These can be found at the google rep.

User avatar
captaingeek
Posts: 228
Joined: Fri Jan 28, 2011 6:42 pm

Re: ESC calibration

Post by captaingeek »

OK found it can you add some step by step usage notes?

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

Read notes in config.h
It has a link to documentation.

User avatar
captaingeek
Posts: 228
Joined: Fri Jan 28, 2011 6:42 pm

Re: ESC calibration

Post by captaingeek »

yea I read the notes here. I think we need to have manual control over the throttle so we can adjust ESC parameters. Can you allow that?

http://code.google.com/p/multiwii/wiki/ESCsCalibration

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

The code uses minthrottle and maxthrottle to try calibrating.
Timing is fixed but may be wrong?

User avatar
captaingeek
Posts: 228
Joined: Fri Jan 28, 2011 6:42 pm

Re: ESC calibration

Post by captaingeek »

In addition to setting calibration I want to program the ESC's too. Possible?

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

not as is.

gompf-2
Posts: 136
Joined: Sun Jun 05, 2011 11:46 am

Re: ESC calibration

Post by gompf-2 »

Woud be just a time consuming job to count the timing for the different sequences and code it to a pwm scheme for each esc.
But be aware: I have 6 HK BL12A with stock firmware and altough they have oscillators they don´t have a synchron timing. If you concentrated on it you can hear that the last start beeps are "running out of sync", when you wait for the programming menue with all 6 escs the beeps appear to be just randomly after 10 secs. Shoud be small differences in the stock FW revision but I didn´t check via ISP.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: ESC calibration

Post by Hamburger »

thanks to hint by gompf-2, I moved the ESC calibration at the end of the output initialization. Should work (better) now?
Code is in _shared only atm, not in the 2.1-rc2.

Post Reply