MPU6050 sensitivity how to?

hi, I'm trying to set the mpu6050 sensitivity, how can it be set? Thank you

Help us help you.

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

Please post a schematic.

Please post an image of your project.

Please describe the problem better then you just did.

Which library is being used?

[code]




#include <Wire.h>
#include <MPU6050.h>
#include <Servo.h>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif

#define PIN 6
#define NUMPIXELS 1
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels

MPU6050 sensor;
int16_t ax, ay, az;
int16_t gx, gy, gz;
int pos = 90; // variable to store the servo position
int lastPos = 90;
Servo sg90;
int servo_pin = 2;
void setup()
{
    sensor.setFullScaleAccelRange(8);
    sg90.attach(servo_pin);
    Serial.begin(9600);
    Wire.begin();
    pixels.begin();
    sensor.initialize();
}
void loop()
{
    pixels.clear();
    sensor.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
    ax = map(ax, -17000, 17000, 180, 0);
    

    sg90.write(ax);
    if(ax <= 50)
    {
        pixels.setPixelColor(0, pixels.Color(255, 0, 0));
    }
    delay(500);
}
[/code]

There are several 100 libraries that use the name MPU6050, where does the library you are using come from?

If you are using this library, MPU6050 - Arduino Reference

Here is the Git Hub page, MPU6050 - Arduino Reference

If you were to look here, mpu6050/MPU6050.h at master · ElectronicCats/mpu6050 · GitHub you'd get a lest of the deets on the library.

I looked at this, but I don't see how I can use it, how it should be written in the code ? thank you

and when I use the servo it shakes terribly, what about that? I set the delay to 200 but it still shakes so I want the sensitivity to calm down the servo but I don't know if it will work

That is usually due to an inadequate power supply. For example, the Arduino 5V output cannot be used for motors or servos.

Servos should be separately powered from a 4.8 to 6V power supply capable of providing 1 Ampere per small servo like the SG90, or 2.5 Amperes per servo for larger ones like the MG996R.

Don't forget to connect all the grounds.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.