MultiWii Pocket X

Post Reply
Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

MultiWii Pocket X

Post by Alexinparis »

IMG_2504.jpg




It's a very small quadrirotor with brushed motors made by Ulix.
much smaller than the LADYBIRD or the HUSBAN X4, with only 8g weight

Running Multiwii 2.2 with the predefine board LADYBIRD
bat: 1S 60mAh
RX: 0.21g DSM2 from deltang.co.uk
Last edited by Alexinparis on Thu Mar 28, 2013 11:19 pm, edited 1 time in total.

Lapino
Posts: 84
Joined: Tue Aug 16, 2011 10:01 am

AW: MultiWii Pocket X

Post by Lapino »

Cool :)
Really impressive that multiwii runs on it.

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

Re: MultiWii Pocket X

Post by Hamburger »

Too small for me - would get lost in 10 seconds at other side of the room.

Noctaro
Posts: 280
Joined: Thu Sep 08, 2011 11:15 am
Contact:

Re: MultiWii Pocket X

Post by Noctaro »

sweet!

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: MultiWii Pocket X

Post by PatrikE »

And i thought my HUSBAN X4 was small!..

alexia
Posts: 85
Joined: Sun Jun 17, 2012 10:23 pm
Contact:

Re: MultiWii Pocket X

Post by alexia »

beautiful but too small..hubsan seize is better for indoor ans outdoor

felixrising
Posts: 244
Joined: Sat Mar 23, 2013 12:34 am
Location: Australia

Re: MultiWii Pocket X

Post by felixrising »

I don't care how big it is, I just want to know where do I get one?! =D

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: MultiWii Pocket X

Post by Alexinparis »

you can get one RTF from this its creator:
http://macam.be/profile.php?lookup=31

it's basically:
- a full home made fc board
- a full home made frame
- motors&propellers comes from this toy: http://www.hobbygaga.com/fr-search.htm? ... rms=tw-782
- RX comes from here: http://www.deltang.co.uk/rx31b.htm

User avatar
nanobot9000
Posts: 8
Joined: Wed Apr 03, 2013 6:59 pm

Re: MultiWii Pocket X - TX questiond

Post by nanobot9000 »

I have been in contact with the builder of this great quad and hope to have one in about a month :D

In the interim, I need to get a proper TX for it. I have a Spektrum DX6, which of course is not DSM2 and a Walkera DEVO10 for my Ladybird which also won't help. Can I get a recommendation on an inexpensive TX option other than the DX6i for this Pocket Quad?

Thanks!

felixrising
Posts: 244
Joined: Sat Mar 23, 2013 12:34 am
Location: Australia

Re: MultiWii Pocket X

Post by felixrising »

I'm not sure what you call inexpensive, but I have a Walkera Devo running DeviationTX, which does DSM2 and a few others with a little soldering :D.. you might find a Turnigy 9x is a good option too, fully hacked by community with OSS firmware available and supports many modules including DSM2/DSMX with a Orange module, FrSky, etc...

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: MultiWii Pocket X - TX questiond

Post by Alexinparis »

nanobot9000 wrote:I have been in contact with the builder of this great quad and hope to have one in about a month :D

In the interim, I need to get a proper TX for it. I have a Spektrum DX6, which of course is not DSM2 and a Walkera DEVO10 for my Ladybird which also won't help. Can I get a recommendation on an inexpensive TX option other than the DX6i for this Pocket Quad?

Thanks!


Hi,
I use a HK turnigy 9x + a DSM2 orange module to control this small RX.
It's quite cheap and works great.

User avatar
nanobot9000
Posts: 8
Joined: Wed Apr 03, 2013 6:59 pm

Re: MultiWii Pocket X

Post by nanobot9000 »

Thanks for the feedback. I ended up getting a deal on a DX6i.

What I would really like to see is either an iPhone or Android app and small plug in TX to use as the quad is so tiny it would be nice not to have to carry a regular sized TX. I have read some posts on what people have done, but have not found any real DSM2 app and tiny TX. Maybe some day soon! Walkera has the MTC-01 and app and although it is not great there is potential.

Thanks!

User avatar
nanobot9000
Posts: 8
Joined: Wed Apr 03, 2013 6:59 pm

Re: MultiWii Pocket X

Post by nanobot9000 »

I have received my Pocket X MultiWii and would appreciate help with the TX instructions. I translated from French, but want to be certain as I have my questions in bold below

Based on what Vincent sent:
On the TX:
Create a model plane with no mixing of channels. (Did you use plane or Heli?)
Set the servos to 125% racing (ATV) on all 7 necessary channels.
Assign a switch 3 position on a track (5 or 6). This allows for 3 modes of flights: Acro- Horizon - Angle (I am not sure what this means or how to do it - any help is appreciated)
• Mode Acro = single Gyro, behaves like a chopper.
• Mode Horizon = Gyro + Acc, mode to 'Flip' and back flat. This mode works with the spleen located in the GUI Multi config.
• Mode Angle = make flights without acro, even with the handles in place, ideal for Pocket MultiWii.

I just purchased this DX6i so it is all new - any setting help is appreciated.

felixrising
Posts: 244
Joined: Sat Mar 23, 2013 12:34 am
Location: Australia

Re: MultiWii Pocket X

Post by felixrising »

Hi Nanobot9000.

Have you used MultiWii before? Are you familiar with the MultiWiiConf?

1. I've got a DX7s, so probably not too different (hope I'm not talking out my bum here) You can use either heli or plane, it's really more about channel mixing so plane appeals to me more due to it not mixing throttle and gear channels.
2. You need to assign a channel to a switch so that you can choose from Level mode, Horizon Mode or Acro mode. In MultiWiiConf you can assign an auxiliary channel (such as channel 5 (often Gear/Flaps) or 6 (Aux1)) to select from these modes. You don't have a three position switch on the DX6i, not to worry, you just need two positions to begin with as you probably only need Level to start off with, maybe Horizon if you want to be able to do flips with some extra "help" for levelling. This clip (http://www.youtube.com/watch?v=apVSG4cu_N8) shows you how to achieve a three position switch using mixing and two toggle switches, but that seems a bit overkill to me as you can use both channel 5 and 6 to achieve the same through appropriate selections in MultiWiiConf.

More here on MultiWiiConf GUI: http://www.multiwii.com/wiki/index.php? ... _GUI#Input

Lots more stuff here to walk you though all of a MultiWii setup: http://www.multiwiicopter.com/pages/multiwiicopter-wiki

User avatar
nanobot9000
Posts: 8
Joined: Wed Apr 03, 2013 6:59 pm

Re: MultiWii Pocket X

Post by nanobot9000 »

Thanks! You are correct that I have not used MultiWii before and have been trying to cram all the info in. I did see that video so I will give that a try. Could I not also set all three values In multiWiiConf to the same setting for both Aux 1 and Aux2. So for example, to get started flying this tiny quad, I check the LOW, MID and HIGH for ANGLE so there are three white boxes in a row for both AUX1 and AUX2. This way regardless of the switch position I always am in the ANGLE mode. Then I can experiment later with different modes.

I also think I need to calibrate the ACC via the TX. I have not tried that yet but did try the CALIB_ACC feature and hopefully did not screw something up. When I give it throttle it wants to fly backwards and flip over. The settings that were on the quad when I first connected it to the MultiWiiConf were only for AUX2 (HORIZON-MID and ANGLE-HIGH) so not sure if that is the issue as well - Huge learning curve, but very exciting.

Just to recap my translation of the steps I need to follow:
I created and ACRO plane model and the only setting I changed was to make the 6 TRAVEL ADJUST settings 125%
Is there another setting or step I am missing?
The instructions saw the ACC needs calibrated each time the battery is changed - which I believe is via the TX

I am attaching some images from the MultiWiiConf - sorry for the long response - just want to get it hovering!!!!

Thanks,
Mike
Attachments
Pocket x - multiwii console2.JPG
Pocket x - multiwii console.JPG

User avatar
nanobot9000
Posts: 8
Joined: Wed Apr 03, 2013 6:59 pm

Re: MultiWii Pocket X

Post by nanobot9000 »

Good news :)

Rudder and alerion needed to be reversed. Once I reversed those I was able to calibrate it with the TX. it seems to calibrate to 0 much closer if I use the multiwiiconf calibrate_acc versus just the but at least it calibrates. I also had to adjust the subtrim on the pitch as it wanted to drift backwards.

I set all the choices for both aux1 and aux2 to angle that way I was sure to have that choice engaged.

Now to do some flying!
:D

felixrising
Posts: 244
Joined: Sat Mar 23, 2013 12:34 am
Location: Australia

Re: MultiWii Pocket X

Post by felixrising »

Great. Nice work.

Just a tip on setting trims - You should really follow the intructions on Transmitter Calibration using that last link I posted. You should never try to level a MultiWii quad using transmitter trim. Transmitter Trims (preferably sub-trims) should only be used to get your centers right on 1500.

To level the quad, simply place the quad totally level and then use the stick combinations (when NOT armed) to calibrate the accelerometers and gyros using the instructions in the same link I mentioned before, there are even nice animations showing "ACC.Cal" and "Gyro.Cal". In this case, Throttle Full + Yaw Left + Pitch Backwards for ACC Cal. and Throttle Down + Yaw Left + Pitch Back for Gyro Cal. I do this before every flight as temperatures can affect the gyro and acc. There are other ways to level/trim your quad but I find this pretty easy and it's easy to commit to memory.

User avatar
nanobot9000
Posts: 8
Joined: Wed Apr 03, 2013 6:59 pm

Re: MultiWii Pocket X

Post by nanobot9000 »

Thanks - I am getting there!

I had read the links but missed the ACC cal one with throttle full - I just did that and it zeroed out with 0,0,512 just like the MultiWiiConf - thanks for that tip.

I did reset the subtrim back to 0. So the only thing I have set on the TX is the Travel Adj at 125% and the Aileron to the middle to get close to 1500.

So just a few more questions:

Based on the attached image - do I need to change the PID values or do they look OK?
Can I set the L-M-H to all be the same for both AUX1 and AUX2 for the stable ANGLE mode?
Do the values look correct for AUX1 and AUX2 in the 900 range?

Sorry for all the questions - sometimes I just need hear it a different way and then it clicks! Making progress :D
Attachments
multiwii settings.JPG
DX6i setting.JPG

User avatar
nanobot9000
Posts: 8
Joined: Wed Apr 03, 2013 6:59 pm

Re: MultiWii Pocket X

Post by nanobot9000 »

One more observation. I have it flying and I calibrate the both the gyro and ACC successfully but still drifts back unless I increase the pitch on the tx. Should I trim a different way?

Thanks,
Mike

felixrising
Posts: 244
Joined: Sat Mar 23, 2013 12:34 am
Location: Australia

Re: MultiWii Pocket X

Post by felixrising »

Can you take a video of it? Remembering that it won't hover without drift when only a few cm from the ground due to ground effect/turbulence.

gke
Posts: 10
Joined: Sat Dec 15, 2012 7:42 am
Contact:

Re: Acc Calibration & Code mods

Post by gke »

Probably wrong Pocket Quad but oh well.

The MPU6050 accelerometer has very low temperature drift and so assuming you don't bend something a once off calibration is usually enough. What I do is put a small piece of scrap printed circuit on top of the prop hubs and a bubble float on top of that. I then level the bubble and push the acc cal buttons. That's it.

A flat coffee/beer coaster will also work as what we are trying to do is to get the plane of the propellors level. For my bigger multis i.e. 600mm span I use a sheet of thin glass.

I failed to read the first post so probably should have used LADYBIRD. Anyway I made some mods to MW2.1 to get the brushed motors to stop. For Output.ino:

Code: Select all

#define EXT_RANGE(n) constrain((((n-1000)<<4)), 0, 8000)

  #if defined(PROMICRO)
    #if (NUMBER_MOTOR > 0) // Timer 1 A & B [1000:2000] => [8000:16000]
      #ifndef EXT_MOTOR_RANGE
        OCR1A = motor[0]<<3; //  pin 9
      #else
        OCR1A = EXT_RANGE(motor[0]);
      #endif
    #endif
    #if (NUMBER_MOTOR > 1)
      #ifndef EXT_MOTOR_RANGE
        OCR1B = motor[1]<<3; //  pin 10
      #else
        OCR1B = EXT_RANGE(motor[1]);
      #endif
    #endif
    #if (NUMBER_MOTOR > 2) // Timer 4 A & D [1000:2000] => [1000:2000]
      #if !defined(HWPWM6)
        // to write values > 255 to timer 4 A/B we need to split the bytes
        #ifndef EXT_MOTOR_RANGE
          TC4H = (2047-motor[2])>>8; OCR4A = ((2047-motor[2])&0xFF); //  pin 5
        #else
          TC4H = 2047-(((motor[2]-1000)<<1)+16)>>8; OCR4A = (2047-(((motor[2]-1000)<<1)+16)&0xFF); //  pin 5
        #endif
      #else
        #ifndef EXT_MOTOR_RANGE
          OCR3A = motor[2]<<3; //  pin 5
        #else
          OCR3A = EXT_RANGE(motor[2]);
        #endif
      #endif
    #endif
    #if (NUMBER_MOTOR > 3)
      #ifndef EXT_MOTOR_RANGE
        TC4H = motor[3]>>8;
        OCR4D = motor[3]&0xFF; //  pin 6
      #else
        Temp = constrain(motor[3]-1000, 0, 1000)<<1;
        TC4H = (Temp>>8) & 0xFF;
        OCR4D = Temp & 0xFF; //  pin 6
      #endif
    #endif   


Also an entry in config.h.h

Code: Select all

//#defime MW_ECKS

#ifdef MW_ECKS
  #define NANOWII
  #define SERIAL_SUM_PPM
#else
  #define POCKETQUAD
  #define SPEKTRUM 1024
#endif

......


And in def.h

Code: Select all

#if defined(POCKETQUAD)
  #define EXT_MOTOR_RANGE
  #define MOTOR_STOP
  #define MINTHROTTLE 1000
  #define MINCOMMAND 1000
  #define MPU6050
  #define ACC_ORIENTATION(X, Y, Z)  {accADC[ROLL]  = -X; accADC[PITCH]  =  -Y; accADC[YAW]  =  Z;}
  #define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] = Y; gyroADC[PITCH] = -X; gyroADC[YAW] = -Z;}
  #undef INTERNAL_I2C_PULLUPS
  #define HWPWM6
#endif



Motors can still run very slowly when powered up possibly because the FETs do not turn off compltely.

Greg

User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: MultiWii Pocket X

Post by Plüschi »

I suggest upping the pwm freq from the 490hz to 2,4 or 8 khz.

Code: Select all

/**************************************************************************************/
/************  Writes the Motors values to the PWM compare register  ******************/
/**************************************************************************************/
void writeMotors() { // [1000;2000] => [125;250]
  /****************  Specific PWM Timers & Registers for the MEGA's   *******************/
  /******** Specific PWM Timers & Registers for the atmega32u4 (Promicro)   ************/
  #if !(NUMBER_MOTOR == 4)
    #if  !((NUMBER_MOTOR == 6) && defined(HWPWM6))
      #error 4 motors or 6 motors with #define HWPWM6
    #endif
  #endif
 
  #if defined(PROMICRO)
    // plain old 16it counter
    #ifdef EXT_MOTOR_2KHZ
      OCR1A = ((motor[0] - 1000+8)<<2); // 1000..2000 -> 32..4096, max = 4095
      OCR1B = ((motor[1] - 1000+8)<<2); // 1000..2000 -> 32..4096, max = 4095
    #endif
    #ifdef EXT_MOTOR_4KHZ
      OCR1A = ((motor[0] - 1000+8)<<1); // 1000..2000 -> 16..2016, max = 2047
      OCR1B = ((motor[1] - 1000+8)<<1); // 1000..2000 -> 16..2016, max = 2047
    #endif
    #ifdef EXT_MOTOR_8KHZ
      OCR1A = (motor[0] - 1000+8); // 1000..2000 -> 8..1008, max = 1023
      OCR1B = (motor[1] - 1000+8); // 1000..2000 -> 8..1008, max = 1023
    #endif
    #ifdef EXT_MOTOR_16KHZ
      OCR1A = ((motor[0] - 1000+8)>>1); // 1000..2000 -> 4..504, max = 511
      OCR1B = ((motor[1] - 1000+8)>>1); // 1000..2000 -> 4..504, max = 511
    #endif
   
    #if defined(HWPWM6) // no 16khz with hwpwm cuz im lazy !!
      // to write values > 255 to timer 4 A/B we need to split the bytes
      OCR3A = (motor[2] - 1000+8);
      TC4H = ((motor[3]-1000)+8)>>8;
      OCR4D = (((motor[3]-1000)+8)&0xFF); //  pin 6
     
      #if (NUMBER_MOTOR == 6)
        #ifdef EXT_MOTOR_2KHZ
          OCR1C = ((motor[4]-1000+8)<<2);
          TC4H = (motor[5]-1000+8)>>8;
          OCR4A = ((motor[5]-1000+8)&0xFF); //  pin 13       
        #endif
        #ifdef EXT_MOTOR_4KHZ
          OCR1C = ((motor[4]-1000+8)<<1);
          TC4H = (motor[5]-1000+8)>>8;
          OCR4A = ((motor[5]-1000+8)&0xFF); //  pin 13       
        #endif
        #ifdef EXT_MOTOR_8KHZ
          OCR1C = (motor[4]-1000+8);
          TC4H = (motor[5]-1000+8)>>8;
          OCR4A = ((motor[5]-1000+8)&0xFF); //  pin 13       
        #endif
      #endif
    #else
      // to write values > 255 to timer 4 A/B we need to split the bytes
      #ifdef EXT_MOTOR_16KHZ
        TC4H  = (1023-(motor[2]-1000+8))>>9;
        OCR4A = ((1023-(motor[2]-1000+8))>>1)&0xFF; //  pin 5
        TC4H  = ((motor[3]-1000)+8)>>9;
        OCR4D = ((motor[3]-1000+8)>>1)&0xFF;   //  pin 6
      #else
        TC4H  = (1023-(motor[2]-1000+8))>>8;
        OCR4A = (1023-(motor[2]-1000+8))&0xFF; //  pin 5
        TC4H  = (motor[3]-1000+8)>>8;
        OCR4D = (motor[3]-1000+8)&0xFF;        //  pin 6
    #endif
    #endif

  #endif
}


/**************************************************************************************/
/************        Initialize the PWM Timers and Registers         ******************/
/**************************************************************************************/
void initOutput() {
  /****************            mark all PWM pins as Output             ******************/
  for(uint8_t i=0;i<NUMBER_MOTOR;i++) {
    pinMode(PWM_PIN[i],OUTPUT);
  }
   
  /******** Specific PWM Timers & Registers for the atmega32u4 (Promicro)   ************/
  #if defined(PROMICRO)
    TCCR1A |= (1<<WGM11); // phase correct mode & no prescaler
    TCCR1A &= ~(1<<WGM10);
    TCCR1B &= ~(1<<WGM12) &  ~(1<<CS11) & ~(1<<CS12);
    TCCR1B |= (1<<WGM13) | (1<<CS10);
    #ifdef EXT_MOTOR_2KHZ
      ICR1   |= 0x0FFC; // TOP to 4092;     
    #endif
    #ifdef EXT_MOTOR_4KHZ
      ICR1   |= 0x07FE; // TOP to 2046;     
    #endif
    #ifdef EXT_MOTOR_8KHZ
      ICR1   |= 0x03FF; // TOP to 1023;     
    #endif
    #ifdef EXT_MOTOR_16KHZ
      ICR1   |= 0x01FF; // TOP to 511;     
    #endif
   
    TCCR1A |= _BV(COM1A1); // connect pin 9 to timer 1 channel A
    TCCR1A |= _BV(COM1B1); // connect pin 10 to timer 1 channel B

    #if defined(HWPWM6) // timer 3A + timer 4D
      TCCR3A |= (1<<WGM31); // phase correct mode & no prescaler
      TCCR3A &= ~(1<<WGM30);
      TCCR3B &= ~(1<<WGM32) &  ~(1<<CS31) & ~(1<<CS32);
      TCCR3B |= (1<<WGM33) | (1<<CS30);
      #ifdef EXT_MOTOR_2KHZ
        TCCR4B &= ~(1<<CS42);
        TCCR4B |= (1<<CS41) | (1<<CS40); // prescaler to 4
        ICR3   |= 0x0FFC;     
      #endif
      #ifdef EXT_MOTOR_4KHZ
        TCCR4B &= ~(1<<CS42) & ~(1<<CS40);
        TCCR4B |= (1<<CS41); // prescaler to 2
        ICR3   |= 0x07FE;     
      #endif
      #ifdef EXT_MOTOR_8KHZ
        TCCR4B &= ~(1<<CS42) & ~(1<<CS41);
        TCCR4B |= (1<<CS40); // prescaler to 1
        ICR3   |= 0x03FF; //   
      #endif
      TCCR4D |= (1<<WGM40);
      TC4H = 0x3;
      OCR4C = 0xFF; // phase and frequency correct mode & top to 1023 but with enhanced pwm mode we have 2047

      TCCR3A |= _BV(COM3A1); // connect pin 5 to timer 3 channel A   
      TCCR4C |= (1<<COM4D1)|(1<<PWM4D); // connect pin 6 to timer 4 channel D
     
      #if (NUMBER_MOTOR == 6)
        TCCR1A |= _BV(COM1C1); // connect pin 11 to timer 1 channel C
        TCCR4A |= (1<<COM4A1)|(1<<PWM4A); // connect pin 13 to timer 4 channel A
      #endif 
    #else // timer 4A + timer 4D
      #ifdef EXT_MOTOR_2KHZ
        TCCR4B &= ~(1<<CS42);
        TCCR4B |= (1<<CS41) | (1<<CS40); // prescaler to 4
        TC4H = 0x3;
        OCR4C = 0xFF; // phase and frequency correct mode & top to 1023
      #endif
      #ifdef EXT_MOTOR_4KHZ
        TCCR4B &= ~(1<<CS42) & ~(1<<CS40);
        TCCR4B |= (1<<CS41); // prescaler to 2
        TC4H = 0x3;
        OCR4C = 0xFF; // phase and frequency correct mode & top to 1023
      #endif
      #ifdef EXT_MOTOR_8KHZ
        TCCR4B &= ~(1<<CS42) & ~(1<<CS41);
        TCCR4B |= (1<<CS40); // prescaler to 1
        TC4H = 0x3;
        OCR4C = 0xFF; // phase and frequency correct mode & top to 1023
      #endif
      #ifdef EXT_MOTOR_16KHZ
        TCCR4B &= ~(1<<CS42) & ~(1<<CS41);
        TCCR4B |= (1<<CS40); // prescaler to 1
        TC4H = 0x1;
        OCR4C = 0xFF; // phase and frequency correct mode & top to 511
      #endif
      TCCR4D |= (1<<WGM40);

      TCCR4A |= (1<<COM4A0)|(1<<PWM4A); // connect pin 5 to timer 4 channel A
      TCCR4C |= (1<<COM4D1)|(1<<PWM4D); // connect pin 6 to timer 4 channel D
    #endif
  #endif
 
  writeAllMotors(MINCOMMAND);
  delay(300);
}

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: MultiWii Pocket X

Post by Alexinparis »

Plüschi wrote:I suggest upping the pwm freq from the 490hz to 2,4 or 8 khz.

You said in another topic that 490Hz seems low for a brushed multi, and the motors get warn.
This is not what I noticed with the ladybird or pocket quad from ulix, the motors stays cold and the stability is excellent. The noise of the motors is even quieter if we compare it with the original ladybird FC.
I have probably something like 30 or 40 flight with my ladybird and it's still like the first day.
what is your exact setup ?

User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: MultiWii Pocket X

Post by Plüschi »

I have the HK pocketquad (32u4) with "high speed 7mm coreless" motors and the 45mm gemfan props. This flies somewhat twitchy at 490hz.

Probably because the low inductance motors may get saturated in one 490hz pulse and produce current spikes. Those current spikes are not nice on the motor brushes. You may notice strange behaviour like constant yaw turn and shakes when the lipo gets soft. I did read a similar setup in a tail-motor of a mini helicopter was the cause of early tailmotor failure (cant exactly remember).

The literature says the "feel well" frequency for coreless minis is 30khz and above.

An australian guy named Greg did correct/improve my code and made it more multiwii compatible. Post 406 here:
http://www.rcgroups.com/forums/showthre ... st25066229

gke
Posts: 10
Joined: Sat Dec 15, 2012 7:42 am
Contact:

Re: MultiWii Pocket X

Post by gke »

Increasing the PWM frequency definitely does improve the motor response and attitude hold. For the HK quad the best frequency seems to be 8KHz although some guys have gone to 16KHz to get the noise down. I have replaced the motors and props with those from a FF120 and I get 7 minutes hover at 27% using 300mAH packs. Motors at 31C in 22C ambient.

The FET drive circuit is a 20K resistor to the FET gate whereas most other implementations correctly use a low value series resistor, a high value pulldown from the gate and a diode across the motor. There are other issues with this product like the bootloader LED signal coupling into the left rear motor etc etc and my pet hate no programming pads. All of this is on the RC Groups thread.

I re-cut the MW flight control code using elements of UAVX. It was too hard to resist the temptation ;).

The paramterised driver code is below if anyone wants to suck that into MW updates.

Greg

Code: Select all

// Prof Greg Egan 2013 
// Version stripped for 4 motors and no servos - original faster PWM update from Cesco

// set PWM frequency for DC motors

#define DC_SCALE 0 // 8KHz
//#define DC_SCALE 1 // 4KHz
//#define DC_SCALE 2 // 2KHz

uint8_t PWM_PIN[] = {
  9,10,5,6};   

void writeMotors() {

#ifdef DC_MOTORS

  uint16_t Temp;

  OCR1A = (motor[0]-1000) << DC_SCALE; //  pin 9 (BR)
  OCR1B = (motor[1]-1000) << DC_SCALE; //  pin 10 (FR)

  Temp = 1023 - (motor[2]-1000);
  TC4H = Temp >> 8;
  OCR4A = Temp & 0xFF; //  pin 5 (BL)

  Temp = motor[3] - 1000;
  TC4H = Temp >> 8;
  OCR4D = Temp & 0xFF; //  pin 6 (FL)

#else // !DC_MOTORS

  OCR1A = motor[0] << 3; //  pin 9 (BR)
  OCR1B = motor[1] << 3; //  pin 10 (FR)
#if defined(HWPWM6)
  OCR3A = motor[2] << 3; //  pin 5 (BL)
#else
  // to write values > 255 to timer 4 A/B we need to split the bytes
  TC4H = (2047-motor[2]) >> 8;
  OCR4A = ((2047-motor[2])&0xFF); //  pin 5 (BL)
#endif
  TC4H = motor[3] >> 8;
  OCR4D = (motor[3]&0xFF); //  pin 6 (FL)

#endif // DC_MOTORS

} // writeMotors

void writeServos() {
  // servos not used
} // writeServos

void writeAllMotors(int16_t mc) { 
  for (uint8_t i =0; i < NUMBER_MOTOR; i++)
    motor[i]=mc;
  writeMotors();

} // writeAllMotors

void initOutput() {

  for (uint8_t i = 0; i < NUMBER_MOTOR; i++) {
    pinMode(PWM_PIN[i],OUTPUT);
    digitalWrite(PWM_PIN[i], 1);
  }

#ifdef DC_MOTORS

  // code due originally to Cesco - 16 bit counters     
  TCCR1A |= (1 << WGM11); // phase correct mode & no prescaler
  TCCR1A &= ~(1 << WGM10);
  TCCR1B &= ~(1 << WGM12) &  ~(1 << CS11) & ~(1 << CS12);
  TCCR1B |= (1 << WGM13) | (1 << CS10); 
  ICR1 = (0x03FF << DC_SCALE) | 0x0003;

  TCCR1A |= _BV(COM1A1); // connect pin 9 (BR) to timer 1 channel A
  TCCR1A |= _BV(COM1B1); // connect pin 10 (FR) to timer 1 channel B

  TCCR4B &= 0xf8;
  TCCR4B |= (1 + DC_SCALE);

  TC4H = 0x3;
  OCR4C = 0xFF; // phase and frequency correct mode

  TCCR4D |= (1 << WGM40);
  TCCR4A |= (1 << COM4A0)|(1 << PWM4A); // connect pin 5 (BL) to timer 4 channel A
  TCCR4C |= (1 << COM4D1)|(1 << PWM4D); // connect pin 6 (FL) to timer 4 channel D

#else // !DC_MOTORS

  TCCR1A |= (1<<WGM11); // phase correct mode & no prescaler
  TCCR1A &= ~(1<<WGM10);
  TCCR1B &= ~(1<<WGM12) &  ~(1<<CS11) & ~(1<<CS12);
  TCCR1B |= (1<<WGM13) | (1<<CS10);
  ICR1   |= 0x3FFF; // TOP to 16383;
 
  TCCR1A |= _BV(COM1A1); // connect pin 9 (BR) to timer 1 channel A
  TCCR1A |= _BV(COM1B1); // connect pin 10 (FR) to timer 1 channel B

#if defined(HWPWM6) // timer 3A
  TCCR3A |= (1<<WGM31); // phase correct mode & no prescaler
  TCCR3A &= ~(1<<WGM30);
  TCCR3B &= ~(1<<WGM32) &  ~(1<<CS31) & ~(1<<CS32);
  TCCR3B |= (1<<WGM33) | (1<<CS30);
  ICR3   |= 0x3FFF; // TOP to 16383;     
  TCCR3A |= _BV(COM3A1); // connect pin 5 (BL) to timer 3 channel A   
#else
  // timer 4A
  TCCR4E |= (1<<ENHC4); // enhanced pwm mode
  TCCR4B &= ~(1<<CS41);
  TCCR4B |= (1<<CS42)|(1<<CS40); // prescaler to 16
  TCCR4D |= (1<<WGM40);
  TC4H = 0x3;
  OCR4C = 0xFF; // phase and frequency correct mode & top to 1023 but with enhanced pwm mode we have 2047
  TCCR4A |= (1<<COM4A0)|(1<<PWM4A); // connect pin 5 (BL) to timer 4 channel A   
#endif

#if defined(HWPWM6)
  TCCR4E |= (1<<ENHC4); // enhanced pwm mode
  TCCR4B &= ~(1<<CS41);
  TCCR4B |= (1<<CS42)|(1<<CS40); // prescaler to 16
  TCCR4D |= (1<<WGM40);
  TC4H = 0x3;
  OCR4C = 0xFF; // phase and frequency correct mode & top to 1023 but with enhanced pwm mode we have 2047
#endif
  TCCR4C |= (1<<COM4D1)|(1<<PWM4D); // connect pin 6 (FL) to timer 4 channel D
 
#endif // DC_MOTORS

  writeAllMotors(MINCOMMAND);
  delay(300);
} // initOutput

gke
Posts: 10
Joined: Sat Dec 15, 2012 7:42 am
Contact:

MultiWii Lite version for Atmel 32u4 Nano/Micro Quads

Post by gke »

I have uploaded a radically cutdown Lite version of MW into the gke folder in the SVN repository.

There are many many changes and in fact it is close to a rewrite. The PID control code may be of interest to the main MW guys and is adapted from UAVX. Code loop can run down to 1.3mS which is more than enough and I have it set to 2mS currently. I apologise for departing from the config disciplines.

Flown on my NanoWii Ecks frame and my HK Pocket Quad. Uses MW defaults currently but I will tweak further.

Greg

User avatar
nanobot9000
Posts: 8
Joined: Wed Apr 03, 2013 6:59 pm

Re: MultiWii Pocket X

Post by nanobot9000 »

Quick question on code changes:

I need to change a section of the code in the config.h file so that I can use a Futaba TX to control the Pocket X instead of a Spektrum. I have the cable and USB adapter I use with the mutliwiiConf but not sure what software I need to reload the Pocket X board with the new code or the steps. Is there a simple set of steps to follow aside from reading through all the pages.

Something like...launch this program, select files....

Thanks,
Mike

Post Reply