View Full Version : Question Cutoff frequency for a low-pass gyro filter
mikel
Nov 12, 2006, 11:09 PM
I'm going to use an active low-pass filter (3rd or 4th order Bessel) to filter and amplify a 3V IDG-300 gyro output signal for 0-5V Mega128 built-in ADC. It's for an autonomous car project rather than for an UAV, but I don't see a big difference in gyro signal filtering.
How should I choose cutoff frequency for this filter? The only thing that comes to my mind is that highest frequency should be <= 1/2 of the sampling requency (Fs) to avoid antialiasing. If Fs = 30Hz then cutoff Fc <= 15Hz. Does that sound right? It's much lower than cutoff frequency of the IDG-300 built-in filter (140Hz).
Thanks,
Mike
hugo_vincent
Nov 17, 2006, 02:13 AM
You need to tell us what the gyro data is being used for and bandwidth you need for this data. For instance, if your need a gyro sensor bandwidth of, say, 10 Hz (for stable control or whatever you need it for) then you probably want to sample at 25+ Hz. But you also need to consider what sample rate your control loop will run at. There are rules of thumb etc to apply here, but you need to give us more information first.
(p.s. sampling at >2x the highest frequency avoids _aliasing_ not antialiasing... infact this active low pass filter will be your antialiasing filter :-) )
mikel
Nov 17, 2006, 05:43 AM
sorry, about antialiasing :) English is my second language. I often don't notice mistakes like this one after writing/editing English text.
I chose this project mostly for learning the basics of inertial navigation, control and interfacing of different sensors to MCU. It's going to be a RC car capable of following a given heading and probably navigating between waypoints (if time allows). A similar project that I saw in my college lab uses only GPS with 0.5 Hz update rate for navigation. I have to build something better. U-blox GPS with 4Hz update rate would probably provide enough navigation data for better performance, but I also want to use a gyroscope. A compass might also be useful to get the heading when the car is not moving. I have no idea what estimation algorithm/filter to use, but I'll think about it later.
There is a lot to learn about MCU programming and interfacing. So far I've connected a keyboard, LCD, I2C compass (Honeywell) and PC through serial port to an AtMega128 MCU and wrote some code for all that stuff. Gyroscope is next. Since my MCU (built-in 10bit ADC) operates at 5V and gyroscope at 3V, I have to use an amplifier for the gyro anyway. Why not make it active low-pass filter instead?
I don't know how to calculate the needed bandwidth for the gyro signal. Can you explain how to do this? The car can go as fast as 30 mph, but I'm not sure about the angle rates. Most of the 6DOF IMUs that I've read about use 30-50 Hz sampling frequency and I decided to stick with these numbers for now. Сutoff frequency for the filter will be ~20 Hz and I can always change it by replacing resistors and capacitors.
After I get all the sensors and GPS to work, I'll have to think how to structure the program. Right now I'm just writing interrupt-based code that collects the sensor data and stores it in buffers. Then I'll have to think about the main algorithm that uses all these data coming at different rates (probably a set of flags indicating new data in buffers... don't know yet). I’ll have to do some kind of PID controller too. Hopefully the sensor data will be smooth enough to calculate the derivative. Almost forgot a waypoint sequencer or something like that. Maybe even obstacle avoiding using ultrasonic rangefinders, but I doubt it.
At this moment I don’t know what max gyro sampling rate will be possible using 16MHz Mega128 MCU, but I’ve read about similar systems based on Mega128 that use more sensors (6DOF) and up to 30Hz sampling rates.
Bulma
Nov 17, 2006, 06:13 AM
Do you need 6DOF for RC car? Why do you want to limit yourself with sampling frequency? If you can get 140Hz, why don`t you use it? I believe that Mega128 MCU ADC can sample that fast. If you are planning to use some complex algorithms later, you`ll probably need to reduce frequency (simple average should do it). However, you won`t know if you need 30Hz or 10Hz or even lower until you actualy implement your algorithm and see how fast it can run. For just summing outputs from gyro (to get 1D heading), even 16Mhz MCU should be way too fast... :)
mikel
Nov 17, 2006, 03:22 PM
No, I don't need 6DOF for the car. However, looking at compass errors when it's tilted makes me want to add a 3-axis accelerometer :) or get rid of the compass completely :)
I originally planned to build a 6DOF system for a plane, but gave up. But I'm still thinking about the system as it had 6DOF instead of 1 (or 2). Maybe I want to be able to add another 5 sensors to the same board and still have enough processing power. I guess I should forget about that and use higher sample frequency + digital filtering... but I've never built an analog active filter before :) It might be useful for a future 6DOF project.
One of the professors at school have been working on an INS system and he said that the main issue was noisy sensor data. That got me thinking about analog low-pass filter. Maybe I don't even need one.
vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.