ITG3200 low pass filter setting

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

ITG3200 low pass filter setting

Post by EOSBandi »

Hi,
I checked in 1.7, the ITG3200 low pass filter setting was 10Hz, and now in latest dev it's 256Hz. This makes copters very sensitive to vibrations. I recommend to change it back to 10Hz or at least 25Hz.
(recommended code change in sensors.pde)

Code: Select all

i2c_writeReg(ITG3200_ADDRESS, 0x16, [b]0x1B[/b]); //register: DLPF_CFG - low pass filter configuration & sample rate  --  value: [b]20Hz[/b] Low Pass Filter Bandwidth - Internal Sample Rate 1kHz


This change made my very twichy quad to fly as smooth as slik.

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

Re: ITG3200 low pass filter setting

Post by captaingeek »

very cool will test it out.

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

Re: ITG3200 low pass filter setting

Post by Alexinparis »

It's hard to sort out every config to find the "most usable" ;)
some time ago, we noticed an improvement with 256Hz.
viewtopic.php?f=8&t=234&p=1255&hilit=low+pass#p1255
But it was maybe before other improvements with side effects.

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

Re: ITG3200 low pass filter setting

Post by Alexinparis »

256Hz is the only setting that allows a 8KHz Internal Sample Rate.
Other setting allows only a 1KHz Internal Sample Rate, so SMPLRT_DIV should normally be also adjusted accordingly to deliver gyro data as a sufficient data rate 1KHz/(div+1) > 500Hz

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: ITG3200 low pass filter setting

Post by ziss_dm »

Hi EOSBandi,

There are couple of points to concider:
1) 1.7 never had 10Hz LPF due initialization issue.
2) Are you reffering acro mode or level mode?
3) Can you actually see vibrations in GUI?
4) What PIDs you have?

regards,
ziss_dm

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: ITG3200 low pass filter setting

Post by EOSBandi »

ziss_dm wrote:Hi EOSBandi,

There are couple of points to concider:
1) 1.7 never had 10Hz LPF due initialization issue.

OK thats true, I just checked the 1.7 source, and now I found that there were a bug in init.
ziss_dm wrote:2) Are you reffering acro mode or level mode?

ACRO
ziss_dm wrote:3) Can you actually see vibrations in GUI?

Absolutely, check attached files with different low pass filter settings. (I also changed the divider, so sample rate to 500Hz (1Khz / (1+1)).
Gyro output (4x scale) at hoover throttle with original settings (256Hz low pass)
Gyro output (4x scale) at hoover throttle with original settings (256Hz low pass)

Gyro output (4x scale) at hoover throttle with 42Hz LPF
Gyro output (4x scale) at hoover throttle with 42Hz LPF

Gyro output (4x scale) at hoover throttle with 20Hz LPF
Gyro output (4x scale) at hoover throttle with 20Hz LPF

ziss_dm wrote:4) What PIDs you have?

See attached screenshoots. MAX_CORRECTION is set to 450.

Regards,
Andras

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: ITG3200 low pass filter setting

Post by ziss_dm »

Hi Andras,

Just a quick questions:
1) So big I and D is it result of LPF (Have you re-adjusted PID's after reducing LPF cut-off frequency?)
2) Have you tried FF and fast dscends with this settings? No oscillations?
3) What ESC's/motors/props are you using? ;)

regards,
ziss_dm

PeterPilot
Posts: 19
Joined: Fri Jun 17, 2011 10:08 am

Re: ITG3200 low pass filter setting

Post by PeterPilot »

I also have the problem with the 256Hz low pass!
I was not aware of my Quad having this problem (I thought some older SW-Versions also used 256Hz LPF).
Now I tested rev214 and had a crash because of oscillations. Within two seconds the quad was uncontrolable and flipped.

My PID is 3.0 - 0.030 - 13 and I fly in Acro-Mode.

EDIT: If I understood it right the 256Hz Setting for the LPF is the only one supporting the sample rate needed, right? Then it might be better to keep the setting and talk about the sensor-mounting!
Which dampers are good?
I use two layers of "TESA - Montageband für Spiegel" which I was told to use with my Flybarless-System on my heli. It is quite hard compared to the "Robbe Gyro - Dämpfungsklebepad".
Which Pads do you suggest?

Regards,
Peter

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: ITG3200 low pass filter setting

Post by EOSBandi »

ziss_dm wrote:Hi Andras,

Just a quick questions:
1) So big I and D is it result of LPF (Have you re-adjusted PID's after reducing LPF cut-off frequency?)
2) Have you tried FF and fast dscends with this settings? No oscillations?
3) What ESC's/motors/props are you using? ;)

regards,
ziss_dm

Hi !
1. It was some test settings, now I fly with r214 and default settings. With 256Hz i can clearly see the noise during flight, my quad was very anxious and twitchy. However it was not a feedback wobble, but random twiches. Decreasing LPF (kept 500Hz refresh rate) made twitches away.
2. It flies without oscillations expect very fast descent (way below hoover throttle), but it's not wobble, it's rather lost of control due
low throttle.
3. PowerHD 12A ESC/Gaui scorpions/10x4.5 props on Jakub's glass fiber frame.

Regards,
Andras

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: ITG3200 low pass filter setting

Post by EOSBandi »

PeterPilot wrote:EDIT: If I understood it right the 256Hz Setting for the LPF is the only one supporting the sample rate needed, right? Then it might be better to keep the setting and talk about the sensor-mounting!

Nope, If you decrease the divider from 7 to 1 then the sample rating will be fine (500Hz), even can go 1000Hz (just as current settings) by setting divider to 0.
I agree that the ultimate solution is the proper balancing and dampening, however decreasing LPF frequency can help also.
Try balancing and dampening first, then if you ran out of ideas, try to change LPF freq.

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

Re: ITG3200 low pass filter setting

Post by Alexinparis »

Hi,

I've just done some new tests.
On my setup, a LPF set at 10Hz is worse than a LPF set at 256Hz in a hover state.
stable P at 10Hz is something like 2
stable P at 256Hz is something like 3.5

But I discovered one thing:
This line was set because I thought it was better to use a close to the need sample rate

Code: Select all

  i2c_writeReg(ITG3200_ADDRESS, 0x15, 0x07); //register: Sample Rate Divider  --  value: 7: 8000Hz/(7+1) = 1000Hz . more than twice the need

I tried to remove it, which is equivalent to no sample rate divider (default value)

conclusion on my setyp: 256Hz LPF + 8000Hz sampling rate (register 0x15 = 0x00) is much better than 256Hz LPF + 1000Hz sampling rate

stable P at 256Hz - 8000Hz is something like 5.5

@EOS, I suggest a try

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: ITG3200 low pass filter setting

Post by EOSBandi »

Hmm, interesting. Will test it tomorrow. Now it's to late to go outside for flying :D
Alex, just a quick question, I assume your quad/tri is well dampened and balanced, so you cannot see any vibration noise in GUI at hoover throttle? (See my pervious screenshoots).

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: ITG3200 low pass filter setting

Post by ziss_dm »

Hi Andras,
1. It was some test settings, now I fly with r214 and default settings. With 256Hz i can clearly see the noise during flight, my quad was very anxious and twitchy. However it was not a feedback wobble, but random twiches. Decreasing LPF (kept 500Hz refresh rate) made twitches away.

I had the same symptoms then I was using too soft mounts for sensor board. (Too soft mounts was allowing board to resonate on low frequencies)

regards,
ziss_dm
Last edited by ziss_dm on Sat Jul 23, 2011 12:14 am, edited 1 time in total.

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

Re: ITG3200 low pass filter setting

Post by Alexinparis »

EOSBandi wrote:Hmm, interesting. Will test it tomorrow. Now it's to late to go outside for flying :D
Alex, just a quick question, I assume your quad/tri is well dampened and balanced, so you cannot see any vibration noise in GUI at hoover throttle? (See my pervious screenshoots).


On all my multi, I always use the HK foam to mount every sensors:
http://www.hobbyking.com/hobbyking/stor ... oduct=8999

No specific precautions are taken for others parts: HK motors, gaui or gws props, very rigid frame.

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: ITG3200 low pass filter setting

Post by EOSBandi »

OK, I went through four packs, and many settings. Got rid of dampening and put my sensor board on a piece of HK foam. It indeed helped on vibrations, but I did not managed to get rid of them completly. However with this new "dampening" I managed to reach smooth fly with 98Hz LPF, and reasonable PID settings (4.2,0.028,18) So I still believe that in same cases changing the gyro lfp frequency could be a solution for a smooth copter. I also experineced that the bigger refresh rate is better. So I changed divider to zero.
I put together some #defines and comments in case Alex wants to include the possibility for setting LPF.

Changes are against r214

config.h

Code: Select all

/* ITG3200 & ITG3205 Low pass filter setting. In case you cannot eliminate all vibrations to the Gyro, you can try
   to decrease the LPF frequency, only one step per try. As soon as twitching gone, stick with that setting.
   It will not help on feedback wobbles, so change only when copter is randomly twiching and all dampening and
   balancing options ran out. Uncomment only one option!
   IMPORTANT! Change low pass filter setting changes PID behaviour, so retune your PID's after changing LPF.*/

//#define ITG3200_LPF_256HZ     // This is the default setting, no need to uncomment, just for reference
//#define ITG3200_LPF_188HZ
//#define ITG3200_LPF_98HZ
//#define ITG3200_LPF_42HZ
//#define ITG3200_LPF_20HZ
//#define ITG3200_LPF_10HZ      // Use this only in extreme cases, rather change motors and/or props


sensors.pde

Code: Select all

//ITG3200 and ITG3205 Gyro LPF setting
#if defined(ITG3200_LPF_256HZ) || defined(ITG3200_LPF_188HZ) || defined(ITG3200_LPF_298HZ) || defined(ITG3200_LPF_42HZ) || defined(ITG3200_LPF_20HZ) || defined(ITG3200_LPF_10HZ)
  #if defined(ITG3200_LPF_256HZ)
    #define ITG3200_SMPLRT_DIV 0  //8000Hz
    #define ITG3200_DLPF_CFG   0
  #endif
  #if defined(ITG3200_LPF_188HZ)
    #define ITG3200_SMPLRT_DIV 0  //1000Hz
    #define ITG3200_DLPF_CFG   1
  #endif
  #if defined(ITG3200_LPF_98HZ)
    #define ITG3200_SMPLRT_DIV 0
    #define ITG3200_DLPF_CFG   2
  #endif
  #if defined(ITG3200_LPF_42HZ)
    #define ITG3200_SMPLRT_DIV 0
    #define ITG3200_DLPF_CFG   3
  #endif
  #if defined(ITG3200_LPF_20HZ)
    #define ITG3200_SMPLRT_DIV 0
    #define ITG3200_DLPF_CFG   4
  #endif
  #if defined(ITG3200_LPF_10HZ)
    #define ITG3200_SMPLRT_DIV 0
    #define ITG3200_DLPF_CFG   5
  #endif
#else
    //Default settings LPF 256Hz/8000Hz sample
    #define ITG3200_SMPLRT_DIV 0  //8000Hz
    #define ITG3200_DLPF_CFG   0
#endif
...

  i2c_writeReg(ITG3200_ADDRESS, 0x15, ITG3200_SMPLRT_DIV); //register: Sample Rate Divider
  delay(5);
  i2c_writeReg(ITG3200_ADDRESS, 0x16, 0x18 + ITG3200_DLPF_CFG); //register: DLPF_CFG - low pass filter configuration
 


Post Reply