neskweek / LightSaberOS

Operating System for Arduino based LightSaber
Creative Commons Zero v1.0 Universal
80 stars 25 forks source link

please help Mpu 6058 #53

Open DRagonenko opened 7 years ago

DRagonenko commented 7 years ago

Could you help me with Mpu 6058. in project LSOS 1.4, please? It works only by hit. And movement works only with a hit of the player or doesn't work at all. I can't understand how to fix it. I had coded colibration data but nothing changed. Sorry if I have mistakes. I'm not good enough in English

Protonerd commented 7 years ago

Hi DRagonenko, If you are using the MPU6050, please first execute the calibration using the sketch: https://github.com/Protonerd/DIYino/blob/master/MPU6050_calibration.ino

Here please take care to select the right position in the EEPROM to store the values. If you use LSOS v1.5, please use:

define MEMORYBASEMPUCALIBOFFSET 200

If an earlier version:

define MEMORYBASEMPUCALIBOFFSET 96

In the LSOS code the calib values will be fetched from this location, code-wise it can be found here:

ifdef MPUCALOFFSETEEPROM

    // retreive MPU6050 calibrated offset values from EEPROM
    EEPROM.setMemPool(MEMORYBASEMPUCALIBOFFSET, EEPROMSizeATmega328);
    int addressInt=MEMORYBASEMPUCALIBOFFSET;
   mpu.setXAccelOffset(EEPROM.readInt(addressInt));
    #ifdef LS_INFO
      int16_t output;
      output = EEPROM.readInt(addressInt);
      Serial.print("address: ");Serial.println(addressInt);Serial.print("output: ");Serial.println(output);Serial.println("");
    #endif
     addressInt = addressInt + 2; //EEPROM.getAddress(sizeof(int));        
   mpu.setYAccelOffset(EEPROM.readInt(addressInt));
    #ifdef LS_INFO
      output = EEPROM.readInt(addressInt);
      Serial.print("address: ");Serial.println(addressInt);Serial.print("output: ");Serial.println(output);Serial.println("");
    #endif
     addressInt = addressInt + 2; //EEPROM.getAddress(sizeof(int));
   mpu.setZAccelOffset(EEPROM.readInt(addressInt));
    #ifdef LS_INFO
      output = EEPROM.readInt(addressInt);
      Serial.print("address: ");Serial.println(addressInt);Serial.print("output: ");Serial.println(output);Serial.println("");
    #endif
     addressInt = addressInt + 2; //EEPROM.getAddress(sizeof(int));
   mpu.setXGyroOffset(EEPROM.readInt(addressInt));
    #ifdef LS_INFO
      output = EEPROM.readInt(addressInt);
      Serial.print("address: ");Serial.println(addressInt);Serial.print("output: ");Serial.println(output);Serial.println("");
    #endif
    addressInt = addressInt + 2; //EEPROM.getAddress(sizeof(int));
    mpu.setYGyroOffset(EEPROM.readInt(addressInt));
    #ifdef LS_INFO
      output = EEPROM.readInt(addressInt);
      Serial.print("address: ");Serial.println(addressInt);Serial.print("output: ");Serial.println(output);Serial.println("");
    #endif
     addressInt = addressInt + 2; //EEPROM.getAddress(sizeof(int));
   mpu.setZGyroOffset(EEPROM.readInt(addressInt));
    #ifdef LS_INFO
      output = EEPROM.readInt(addressInt);
      Serial.print("address: ");Serial.println(addressInt);Serial.print("output: ");Serial.println(output);Serial.println("");
    #endif

else // assign calibrated offset values here:

/ UNIT1 / mpu.setXAccelOffset(46); mpu.setYAccelOffset(-4942); mpu.setZAccelOffset(4721); mpu.setXGyroOffset(23); mpu.setYGyroOffset(-11); mpu.setZGyroOffset(44);

endif

Vulkan1 commented 7 years ago

Have a look at this, it sounds like the problem I had.

Vulkan1 commented 7 years ago

https://github.com/neskweek/LightSaberOS/issues/41

Forgot the link

DRagonenko commented 7 years ago

did the calibration 1

amended 1 uploaded

and the same thing please help

Protonerd commented 7 years ago

you have to amend it in the Config.h file like this:

define MPUCALOFFSETEEPROM

ifdef MPUCALOFFSETEEPROM

define MEMORYBASEMPUCALIBOFFSET 200 // 96 -> increased due to storing RGB PWM values in EEPROM takes a lot of space (3 x 1byte x 3 color types x nr of sound fonts i.e. for 5 sound fonts 45 bytes

endif

DRagonenko commented 7 years ago

default

DRagonenko commented 7 years ago

only blows =(

Protonerd commented 7 years ago

When you calibrated the board with the sketch I've sent you, did you press y and enter at the end to save the values into the EEPROM? Looking at the screen shot I have the impression that you did not.

DRagonenko commented 7 years ago

pressed . =(

DRagonenko commented 7 years ago

tried everything. Only the collision the dream is dead =((( please help

Protonerd commented 7 years ago

OK, please send me your whole wiring diagram. Or buy a DIYino board, those boards are assured to work! If I know your circuitry, I might figure out what is wrong. BTW, what do you mean by "collosion"?

DRagonenko commented 7 years ago

https://yadi.sk/d/bI9wkqg63GLyHq

"collosion"(works only by hit) Sorry if I have mistakes. I'm not good enough in English

DRagonenko commented 7 years ago

Thanks for the help. updated libraries and seems to work. thank you very much

DRagonenko commented 7 years ago

when driving hangs playing music