Offline
Newbie
Karma: 1
Posts: 28
|
 |
« Reply #405 on: March 15, 2013, 06:39:40 pm » |
Hi again Lauzurus ,  Thank you verry much for your answer ,but i am afraid that I won't need your source anymore.I just found out this link it is a source for Arduino and MinIMU-9 board wich is exactly what i have.Once again I am really sorry for wasting your time.  I hope you that you won't get angry at me. 
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 7
Posts: 246
|
 |
« Reply #406 on: March 15, 2013, 06:44:28 pm » |
No problem. I'm just glad you got it working 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 8
|
 |
« Reply #407 on: March 16, 2013, 03:10:17 pm » |
Hey Lauszus!
I was hoping to learn something about using IMU effectively with the help of Kalman filtering as I came across this wonderful tutorial. The only problem I have is I have 2 separate gyro and accelerometer modules (L3G4200D and ADXL 335). How do I combine and use them according to your pin config.
gyro has pins GND, VIN, SCL, SDA, SDD, INT1, INT2 and accelerometer pins are VCC, GND,X,Y,Z,ST. Where do these pins go?
Thanks!
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 7
Posts: 246
|
 |
« Reply #408 on: March 16, 2013, 03:19:25 pm » |
@psyoptica The gyroscope is a digital gyroscope so you need to connect it to the SDA and SCL on the Arduino. See the following page for more information: http://arduino.cc/en/Reference/Wire. Then connect VIN to 3.3V and GND to GND on the Arduino. Your accelerometer is a analog one, so you need to connect X, Y, and Z to your analog inputs. And yet again connect VIN to 3.3V and GND to GND on the Arduino.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 8
|
 |
« Reply #409 on: March 16, 2013, 03:31:59 pm » |
Thanks! this really helps but aren't A4 and A5 analog input pins?
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 8
|
 |
« Reply #411 on: March 16, 2013, 03:44:20 pm » |
Tell me if I have configured it correctly
Acc_Gyro Arduino 3.3V <—> 3.3V GND <—> GND X <—> AN0 Y <—> AN1 Z <—> AN2 SDA <—> AN4 SCL <—> AN5
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 7
Posts: 246
|
 |
« Reply #412 on: March 16, 2013, 03:48:45 pm » |
@psyoptica Yes that looks correct. But beware that if there is no logic level circuit on your breakout board, you might damage the IC. So get a logic level converter if you need to use if on the long run: https://www.sparkfun.com/products/8745.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 8
|
 |
« Reply #413 on: March 16, 2013, 03:53:35 pm » |
I don't think there is a need for any logic level converter device since the arduino I'm using already gives a 3.3V signal.
Thanks for the quick responses. Really hope I learn something from this tutorial.
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 7
Posts: 246
|
 |
« Reply #414 on: March 16, 2013, 03:54:47 pm » |
@psyoptica You are using an Arduino Uno, right? Then there is need for a logic level converter! Since the ATmega328P is running at 5V.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 8
|
 |
« Reply #415 on: March 16, 2013, 03:57:55 pm » |
Thanks for clearing it up. Will definitely have to get a converter circuit then..
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 1
|
 |
« Reply #416 on: March 26, 2013, 11:06:28 am » |
I see a lot of experience embedded in this thread, so I have a question about any noticed issues with the LSM303DLM or DLH regarding bad readings in abrupt changes in orientation. Abrupt is defined as peak accelerations of about 3 g's in all directions. I am experiencing abrupt / large heading changes in a tilt compensated compass implemented with this device. In relatively "flat" conditions I don't see failures, but in severe conditions, especially sharp pitch (dx/dt) and sharp roll (dy/dt) I seem to get non linear readings. I say I seem, because as of yet I have not captured the case live as trials are expensive to duplicate in my moving platform.
My question is two fold:
1) Has anyone experienced big non linear results in the accelerometers ? 2) Has anyone noticed big non linear results in the magnetometer that are somehow induced with strong acceleration ?
My application is using a 9DOF IMU and I have wrapped the sensors in filters that limit rate of change of data as well as do a variety of selectable filter algorithms.
Regards, Brian
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #417 on: March 28, 2013, 09:30:16 am » |
Hi Lauszus, I have read your codes about the gyro sensor and it's very helpfull. So thank you about it. Now i try to modify your code to my quadrotor project but it stills have some problem about "gyro drift". I know that i have to use the Kalmal filter but my board just only has 3 angular rate sensors (the gyro sensor as i think) and have no accelerometer, so i don't know how to use the Kamal filter. Could you take a look at my problem in here: http://arduino.cc/forum/index.php/topic,156912.0.htmlAnd could you show me some simple equation like the Complementary Filter which can aplly to my board. Regards, Nghia
|
|
|
|
« Last Edit: March 28, 2013, 09:32:43 am by doantrungnghia05 »
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 7
Posts: 246
|
 |
« Reply #418 on: March 28, 2013, 12:08:10 pm » |
@brianb00 I haven't got much experience with magnetometers, sorry.
@doantrungnghia05 The Kalman I filter I wrote can't be used without an accelerometer. The easiest thing would be to use a digital high-pass filter.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #419 on: March 28, 2013, 08:13:54 pm » |
@brianb00 I haven't got much experience with magnetometers, sorry.
@doantrungnghia05 The Kalman I filter I wrote can't be used without an accelerometer. The easiest thing would be to use a digital high-pass filter.
Thank Lauszus, here is my board, i bought it because in the internet many people use this board and they also buid their quad fly, but they just assembly these things like: motors, rf-controller, ...together without writing any code for the uController.  1.Kk_board datasheet: http://www.kkmulticopter.com/downloads/resources/KKmulticontroller%20v.5.5.pdf2.The angular rate sensor use in kk board: (ENC series) http://www.murata.com/products/catalog/pdf/s42e.pdfMy code is C++ for atmega168pa and i know this forum is about adruino, but i think my code is very cleary and easy to understand. Here is it: /************************************************************************/ /* MAIN FUNTION */ /************************************************************************/ int main(void) { CLKPR=0x80; CLKPR=0x00; //----------- system init -------------------- sei(); usart_init(); adc_sensor_init(); led_init(); motor_control_init(); motor_start(); DDRB|=(1<<PINB3);// measure loop time for cheking //----------------------------------------------------------- //---------- update the zero value --------- adc_sensor_get_value(); roll_zero=roll_adc;//~=824 yaw_zero=yaw_adc;//~=816 pitch_zero=pitch_adc;//~=846 roll_angle=360; yaw_angle=360; pitch_angle=360; //---------------------------------------------------------- timer2_start();//start measure system time by timer2 _delay_ms(2000); led_on(); while(1) { //-------------- get value in 3 sensors ----------------------- PORTB^=(1<<PINB3);// toogle this pin per main loop adc_sensor_get_value();// //-------- just process roll gyro-------------------------------------------------------------- if(roll_adc<roll_zero) { roll_rate=(roll_zero-roll_adc)/sensitivity;//tinh toc do goc theo phuong roll [degree/s] roll_angle-=roll_rate*dtime/1000;//tra ve gia tri degree theo phuong roll [degree] } if(roll_adc>roll_zero) { roll_rate=(roll_adc-roll_zero)/sensitivity;//tinh toc do goc theo phuong roll [degree/s] roll_angle+=roll_rate*dtime/1000;//tra ve gia tri degree theo phuong roll [degree] } //--------------------------------------------------------------------------------------------- usart_clr(); usart_print_nb(roll_angle);//print roll_angle to computer screen //----------------------- creat fixed_loop_time= 25ms per loop--------------------------------- loop_usefull_time=sys_time-last_time; if(loop_usefull_time<fixed_loop_time) { for(i=0;i<(fixed_loop_time-loop_usefull_time);i++) { _delay_ms(1); } } dtime=sys_time-last_time;//dtime=time per main loop (ms) last_time=sys_time;//update the last_time value for the next loop //------------------------------------------------------------------------------------------ } }
ISR(TIMER2_OVF_vect)//when the timer2 over flow we have: sys_time=sys_time +1(ms) { // so we can caculate the dtime( time per main loop) sys_time+=1; TCNT2=130; } In my board, the three gyro sensors also have the high-pass filter as you say, but it still drifs. Could you take a look at my "gyro drift" problem and show me how to fix it ? Regrard, Nghia
|
|
|
|
« Last Edit: March 28, 2013, 08:15:37 pm by doantrungnghia05 »
|
Logged
|
|
|
|
|
|