Picbuster
Newbie level 5
- Joined
- Jul 13, 2011
- Messages
- 9
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,358
How are you interfacing with the L3G4200D, with a commercial breakout board or a DIY design?
Can you post a detailed schematic of the L3G4200D and all its pins?
BigDog
You did not answer my question.
Are you using a commercial breakout board or have you mounted the device on your own PCB?
Post a schematic of the implementation.
The reason I ask this question is to determine whether or not the PLL Low Pass Filter has been implemented correctly, the device has proper decoupling caps and the state of the unused pins.
BigDog
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 //============ SPI int ========================= if (PIR1bits.SSPIF) { Spi_rec[Spi_pointer]=SSPBUF; Spi_pointer++; PIR1bits.SSPIF=0; // flag off } //========= request receive ======= void R_Inclino(int P_function,int number) { int i; Spi_pointer=0; Klok_sel=0; // select chip Xt_SPI(P_function); // pointer to function for (i=0;i<number;i++) { Xt_SPI(0); // dummy generate clock to receive } Klok_sel=1; } //=================== main =========== // -------------------spi bus master ------------------ SSPSTATbits.CKE=1; //0=Data transmitted on falling edge of SCK SSPSTATbits.SMP=1; //1=SPI mode-Input data sampled at end of data output time SSPCON1bits.CKP=0; //0=idle clock state is low SSPCON1bits.SSPM3=0; //FOSC/4 SSPCON1bits.SSPM2=0; //FOSC/4 SSPCON1bits.SSPM1=0; //FOSC/64 SSPCON1bits.SSPM0=0; //FOSC/4 1=/16 IPR1bits.SSPIP=1; PIE1bits.SSPIE=1; PIR1bits.SSPIF=0; //---------------------------------------------- PEIE=1; // Enable peripheral int. TMR0 = 0; GIE = 1; //enable Global interrupts //================================ //========= SSPCON1bits.SSPEN=1; // start spi interface R_Inclino(0b10001111,1);// read Chip_ID Chip_ID= Spi_rec[1]; CREN=1; input=0; Char_pointer=0; Address= eeprom_read(0); putchar('>'); SPI_s[0]=0b00100000; SPI_s[1]=0b00001111; S_Inclino(); // controlreg1 write power, x,y,x on Delay10KTCYx(3500); // wait to start l3g SPI_s[0]= 0b00100011; SPI_s[1]=0b01000000;// S_Inclino(); // controlreg4 write SPI_s[0]=0b00100100; SPI_s[1]=0b01000000; // fifo enable S_Inclino(); // controlreg5 write SPI_s[0]=0b00101110; // fifo_cntrl_reg SPI_s[1]=0b01100111; // S_Inclino(); // write fifo_cntrl_reg Delay10KTCYx(3500); // ============== read x,y,z loop signed int Zas; signed int Xas; signed int Yas; R_Inclino(0b10101111,1); // fifo src int status = Spi_rec[1]; if ((status & 128) ==128) // if data read it else skip { R_Inclino(0b11101000,6); // get 6 bytes signed int Xas_L = Spi_rec[1]; signed int Xas_H = Spi_rec[2]; Xas =((Xas_H << 8) + Xas_L); signed int Yas_L = Spi_rec[3]; signed int Yas_H = Spi_rec[4]; Yas = ((Yas_H << 8) + Yas_L); signed int Zas_L = Spi_rec[5]; signed int Zas_H = Spi_rec[6]; Zas = ((Zas_H << 8) + Zas_L); if (Xas_out != Xas) // for debug purposes only { printf("X:%d Y:%d Z:%d \r",Xas,Yas,Zas); } Xas_out=Xas; Yas_out=Yas; Zas_out=Zas; } Spi_pointer=0;
I'm pretty sure that getting a 0.01 dps measurement isn't going to be feasible with this, or any other mems gyro. You're talking about a rotational period of once per hour. Also the built-in highpass filter will probably mask such slow movements completely, and anything left over will be swamped with noise.
Also you never actually explained what you mean by "stability." Are you referring to drift or noise or something else?
Here it is I did attach schematic but not sure if you received it.
I removed all unneeded parts and functions and keep it to the parts involved.
aim: to detect rotations of 10 milli degree per second.( this should work according to ST but I ??)
Well there's a big difference between "possible" and "feasible." The thing is sensitive to changes as small as 10mdps, but actually being able to measure such a thing with useful accuracy is a completely different issue.That's what I believe so ST salesman is wrong.
The datasheet specs the noise at 0.03dps/√Hz, so if your bandwidth is high then that much measured noise may be reasonable. The bandwidth of the measurement can be programmed in the sensor, or you could digitally filter the data yourself to reduce the noise.I talk about noise value popping at a delta value about 200. (raw data). All axis.
View attachment l34200d_test 001.jpg here it isWell there's a big difference between "possible" and "feasible." The thing is sensitive to changes as small as 10mdps, but actually being able to measure such a thing with useful accuracy is a completely different issue.
Also don't take technical advice from the sales department.
The datasheet specs the noise at 0.03dps/√Hz, so if your bandwidth is high then that much measured noise may be reasonable. The bandwidth of the measurement can be programmed in the sensor, or you could digitally filter the data yourself to reduce the noise.
The schematic looks fine.
Just an example noise calculation for you: if you've configured the measurement bandwidth to be high (max seems to be 110Hz) then you'll get 0.3146 dps rms noise, or about 1.89 dps of peak to peak noise on your measurement. With max sensitivity that's 216 LSBs of peak to peak noise on the digital result. Is that consistent with what you're seeing? Note that number doesn't include offset in the measurement. Table 4 in the datasheet says that it can be +/- 10dps, which is another big problem for you.
Also make sure the thing is put on a surface where it won't feel any vibration at all.
Exactly what kind of motion are you trying to detect? A tilt sensor based on accelerometers may work better than a gyro.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?