I2C ESC (Can I use the values in motor array?)

Post Reply
gineer
Posts: 2
Joined: Thu Aug 01, 2013 12:38 pm

I2C ESC (Can I use the values in motor array?)

Post by gineer »

Hi all,
I've read the topics saying that the MultiWii was designed for low cost and that there is no reason to use I2C ESC's as newer ESC's can deal with much higher refresh rates. I however have three MikroKopter BlCtrl v1.2's which require input values of 0 to 256.

I've looked at output.cpp and modified the "writeMotors()" to include:

Code: Select all

      #if defined(BlCtrl)
      // Using BlCtrl to write to ESC via I2C
        i2c_rep_start(MOTOR_LEFT_ADDRESS);
        i2c_write(motor[0]);
        i2c_stop();
      #else
      .
      .
      .


I haven't tested this code, but I'm not sure what the number range would be in motor[0].

At the top of the "writeMotors()" method a comment states: // [1000;2000] => [125;250]

Does that mean the values in the motor array would be between 125 and 250?

David

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: I2C ESC (Can I use the values in motor array?)

Post by ronco »

Hi,

the Motor Values inside of MWC are scaled from ~1000-2000 (mincommand-maxthrottle in the config.h) you should do ((motor[0]-1000)>>2) to get 0-250

and BTW. I2c on MK isnt much faster then PWM .. yes the i2c bus it selve workes with 400kHz but thay do a delay of 1ms for sending the values to each ESC. so for a quad it also takes 4ms till all ESC's have thaire values .. with 488Hz PWM it takes 2-4ms for all ESC's no matter how many you use. and if one ESC fails the whole i2c bus may be down.. which means no sensors an no ESC's .. with PWM it will be just the one failing ESC ;)

regards

Felix

gineer
Posts: 2
Joined: Thu Aug 01, 2013 12:38 pm

Re: I2C ESC (Can I use the values in motor array?)

Post by gineer »

Hi Felix, Thanks for the info. I'll give it a go.

Also thanks for the info on PWM ESC's. If I buy more ESC's they will definitely be PWM versions, but at least now I can use my existing investments. ;-)

One benefit of going with I2C though is that I'm not using up additional pins for each motor.

Anyway. Thanks again.

David

Post Reply