How to controll servo via imu on nano rp2040

hi, i trying to find way how to control servo via imu on arduino nano rp2040. I cant find on internet any code for that, so my question is how i can program it? I mean control via imu like make gyro like you can do it with mpu6050/gy521.

thanks for any ideas

Please don't hijack threads @dinamick. I have removed your other post about this from the unrelated topic.

Hijacking is against the Arduino forum rules. The reason is that it may sidetrack the discussion, even preventing the creator of the topic from getting the assistance they need.

This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

1 Like

I have deleted your other cross-post @dinamick.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

can you help me with my topic?

i think you dont undestand me. I dont want to use separate imu i would like to use that one wich is palce on board of nano rp2040

you are right, i dont catch

so do you think it will be possible?

Why not?
If the board contains IMU - it can be used...

do you now how to program it?

I dont know exactly for rp2040
But I think there is no much difference with any other board.
This is not "in-chip" IMU, it has separate chip just placed on the same PCB.
You should see to the schematic and find the pins used for imu
Then you can able to run some tests with it

See this tutorial:

do you think you will can modify that code for controling servo?

I can't answer because I don't know how you want to control the servo.

What is your arduino and programming experience? If this is the first project - start with something simpler.

i would like to control 2 servos by motion of the imu. like on this video Controlling servo motor with accelerometer | MPU6050 with servo - YouTube

yea i make mistake

my expirienc is litle bit experience beginer

yes, I think this is possible.
But I haven't any experience with RP2040 IMU

Just mash the two example sketches together.

#include <Arduino_LSM6DSOX.h>
#include <Servo.h>

Servo servoX;
Servo servoY;

float Ax, Ay, Az;
float Gx, Gy, Gz;

void setup()
{
  Serial.begin(9600);
  delay(200);
  while (!Serial);

  servoX.write(0);
  servoX.attach(3);

  servoY.write(0);
  servoY.attach(4);

  if (!IMU.begin())
  {
    Serial.println("Failed to initialize IMU!");
    while (1);
  }

  Serial.print("Accelerometer sample rate = ");
  Serial.print(IMU.accelerationSampleRate());
  Serial.println("Hz");
  Serial.println();
}

void loop()
{
  if (IMU.accelerationAvailable())
  {
    IMU.readAcceleration(Ax, Ay, Az);

    servoX.write(map(Ax,  -10, 10, 180, 0));
    servoY.write(map(Ay,  -10, 10, 180, 0));
  }
}
1 Like

thank very very much

hi, do you think it will be possible to calculate high on Ax from ground to peak of flyght? i mean by that it will be use in rocket tvc system and i would like to have date of high from flyght

No.

ok i will buy bmp280,