i'm having trouble identify why strange values , overflow mpu6050 sensor. have atm328p micro reading values drotek 10 dof imu sensor, 1 of these values acceleration one, , become ovf or behaves in weird way. code i'm using it:
#include<wire.h> const int mpu=0x69; int16_t ax,ay,az; float acc[3] = {0, 0, 0}; float s = 0.00006103515625; // scale factor g/lsb 4/65536 void setup(){ wire.begin(); wire.begintransmission(mpu); wire.write(0x6b); // pwr_mgmt_1 register wire.write(0); // set 0 (wakes mpu-6050) wire.endtransmission(true); serial.begin(115200); } void loop(){ wire.begintransmission(mpu); wire.write(0x3b); // starting register 0x3b (accel_xout_h) wire.endtransmission(false); wire.requestfrom(mpu,6,true); // request total of 14 registers az=wire.read()<<8|wire.read(); // 0x3b (accel_xout_h) & 0x3c (accel_xout_l) ay=wire.read()<<8|wire.read(); // 0x3d (accel_yout_h) & 0x3e (accel_yout_l) ax=wire.read()<<8|wire.read(); // 0x3f (accel_zout_h) & 0x40 (accel_zout_l) acc[0] = ax*s; acc[1] = ay*s; acc[2] = az*s; } why these last acc values array overflow or behave in weird way (not expected values) sometimes, , why when starts behaving weird doesn't recover anymore? i've looked problems regarding int16_t float conversion haven't found clue me. here there similar issue, think won't apply mine cause ax, ay , az values sensor far away limits, , i'm converting larger format number.
does have idea?
i'm starting think may hardware thing.
Comments
Post a Comment