Raspberry pi Pico not connecting to laptop

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?

This behavior is sometimes caused by a bad USB cable or a cable that only supports power, not power and data.

If you have a different-type board, such as an ESP-8266, that uses the same USB connector, is it recognized using your current cable?

You might want to visit this page for uploading instructions.

You need to hold the reset button first and then plug the cable into the board.

Have you tried with the Pico completely disconnected from the breadboard? Do you press the button with the USB cable unpowered and then release it after power is applied?

I've used 3 different cables, of which all were data transfer cables. I was given them by my unis electronics department. I changed the raspberry pi Pico board for a working one as I tested an led on and off code on it and it started blinking. So I'm pretty sure that this time the board would be causing a problem. Thank you for the suggestion, it is greatly appreciated! Are there any other things that could be causing this problem?

I connected the cable and the board first, then held down the bootsel button. While held down, I connected the cable and the laptop and waited for a file popup to appear, so then I could release the button after. However, it never appeared.

You have to release the button for the "file popup" to appear. If you keep it pressed, it will not appear.

ok, ty, i have now managed to get to the stage where i have the file pop up in my file store and my board is being detected by my laptop. However, when i drag and drop the .uf2 file i have (RPI_PICO-20241129-v1.24.1.uf2) into the rp1-rp2 file from my downloads, a loading bar shows but doesn't actually move/load. I then proceeded to select the board and COM port and then clicked upload, but it keeps returning the same error 'No drive to deploy.
Failed uploading: uploading error: exit status 1'. How might I solve this?

I've only programmed the Pico in MicroPython using Thonny and C++ using the SDK so I don't know how to help with downloads from the Arduino IDE although I would expect you to be able to just drag and drop a .uf2 from any source. I guess for Arduino there is some sort of "core" that gets combined with the download to act as an API to the underlying RP2040 hardware.

If you use the Arduino IDE, you do not need to drag and drop. Just click on the upload button at the top of the IDE.

Here is an article that may be of help.

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