Brief project overview:
Im trying to make a gyroscope using a raspberry pi pico and coding it on arduino ide. The end result of this is to have a working circuit for a gyroscope, using a raspberry pi pico and a MPU-6050 module. When connected correctly and the code is uploaded, the data should be displayed in real lime in the arduino serial monitor.
Issue:
I have ran my code (displayed below) and it is correct.
#include <Wire.h>
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
// Create an instance of the sensor
Adafruit_MPU6050 mpu;
void setup() {
Serial.begin(115200);
// Initialize I2C communication for the MPU6050
if (!mpu.begin()) {
Serial.println("Could not find a valid MPU6050 sensor. Please check wiring!");
while (1); // Stop execution if initialization fails
}
// Configure sensor settings
mpu.setAccelerometerRange(MPU6050_RANGE_2_G); // Set accelerometer sensitivity
mpu.setGyroRange(MPU6050_RANGE_250_DEG); // Set gyroscope sensitivity
Serial.println("MPU6050 Initialized!");
}
void loop() {
sensors_event_t accelerometer, gyroscope, temp;
// Read sensor data
mpu.getEvent(&accelerometer, &gyroscope, &temp);
// Print accelerometer data
Serial.print("Accelerometer X: "); Serial.print(accelerometer.acceleration.x); Serial.print(" m/s^2 ");
Serial.print("Y: "); Serial.print(accelerometer.acceleration.y); Serial.print(" m/s^2 ");
Serial.print("Z: "); Serial.print(accelerometer.acceleration.z); Serial.println(" m/s^2 ");
// Print gyroscope data
Serial.print("Gyroscope X: "); Serial.print(gyroscope.gyro.x); Serial.print(" rad/s ");
Serial.print("Y: "); Serial.print(gyroscope.gyro.y); Serial.print(" rad/s ");
Serial.print("Z: "); Serial.print(gyroscope.gyro.z); Serial.println(" rad/s ");
// Add a small delay for readability
delay(500);
}
I then proceeded to do the physical connections on a breadboard using the guide below,
, then I attempted to connect the raspberry pi pico to my laptop using a micro-usb cable and before i connected the cable to my computer, i pressed and held down the 'BOOTSEL' button on the raspberry pi, waiting for a file pop up to come, but it never shows. I have 2 usb ports on my laptop and have tried them both. My laptop is an ACER Aspire 5. I have attempted to do the same thing with a different cable, but the issue persists. I have gone into my device manager and unchecked the 'allow this computer to turn off this device' box, found in the power management tab of the port itself in device manager. Hoever, none of these things worked. I have also swapped out my pico as I thought it was faulty to another one that i know is working, but initially, the pop up came up, but then the board kept disconnecting and reconnecting, bringing the popup on for a few seconds, then off. Does anyone have any suggestions as to how I can solve this issue?
