![i2c – LILYGO TTGO T-Show can not detect MPU 6050 Accelerometer, Gyroscope and Temperature Sensor i2c – LILYGO TTGO T-Show can not detect MPU 6050 Accelerometer, Gyroscope and Temperature Sensor](https://techtoguide.com/wp-content/uploads/2023/10/Why-wont-my-servo-and-ultrasonic-sensor-work-together.png)
[ad_1]
I have been making an attempt to attach a MPU 6050 Accelerometer, Gyroscope and Temperature Sensor to a LILYGO TTGO T-Show to get readings displayed on the serial monitor (for starters). The wiring is fairly easy. I have to energy up the MPU6050 with 3V, and join the SDA and SCL. I adopted this tutorial (https://randomnerdtutorials.com/esp32-mpu-6050-accelerometer-gyroscope-arduino/).
That is the code used:
#embrace <Adafruit_MPU6050.h>
#embrace <Adafruit_Sensor.h>
#embrace <Wire.h>
Adafruit_MPU6050 mpu;
void setup(void) {
Serial.start(115200);
whereas (!Serial)
delay(10); // will pause Zero, Leonardo, and so on till serial console opens
Serial.println("Adafruit MPU6050 check!");
// Attempt to initialize!
if (!mpu.start()) {
Serial.println("Failed to seek out MPU6050 chip");
whereas (1) {
delay(10);
}
}
Serial.println("MPU6050 Discovered!");
mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
Serial.print("Accelerometer vary set to: ");
change (mpu.getAccelerometerRange()) {
case MPU6050_RANGE_2_G:
Serial.println("+-2G");
break;
case MPU6050_RANGE_4_G:
Serial.println("+-4G");
break;
case MPU6050_RANGE_8_G:
Serial.println("+-8G");
break;
case MPU6050_RANGE_16_G:
Serial.println("+-16G");
break;
}
mpu.setGyroRange(MPU6050_RANGE_500_DEG);
Serial.print("Gyro vary set to: ");
change (mpu.getGyroRange()) {
case MPU6050_RANGE_250_DEG:
Serial.println("+- 250 deg/s");
break;
case MPU6050_RANGE_500_DEG:
Serial.println("+- 500 deg/s");
break;
case MPU6050_RANGE_1000_DEG:
Serial.println("+- 1000 deg/s");
break;
case MPU6050_RANGE_2000_DEG:
Serial.println("+- 2000 deg/s");
break;
}
mpu.setFilterBandwidth(MPU6050_BAND_5_HZ);
Serial.print("Filter bandwidth set to: ");
change (mpu.getFilterBandwidth()) {
case MPU6050_BAND_260_HZ:
Serial.println("260 Hz");
break;
case MPU6050_BAND_184_HZ:
Serial.println("184 Hz");
break;
case MPU6050_BAND_94_HZ:
Serial.println("94 Hz");
break;
case MPU6050_BAND_44_HZ:
Serial.println("44 Hz");
break;
case MPU6050_BAND_21_HZ:
Serial.println("21 Hz");
break;
case MPU6050_BAND_10_HZ:
Serial.println("10 Hz");
break;
case MPU6050_BAND_5_HZ:
Serial.println("5 Hz");
break;
}
Serial.println("");
delay(100);
}
void loop() {
/* Get new sensor occasions with the readings */
sensors_event_t a, g, temp;
mpu.getEvent(&a, &g, &temp);
/* Print out the values */
Serial.print("Acceleration X: ");
Serial.print(a.acceleration.x);
Serial.print(", Y: ");
Serial.print(a.acceleration.y);
Serial.print(", Z: ");
Serial.print(a.acceleration.z);
Serial.println(" m/s^2");
Serial.print("Rotation X: ");
Serial.print(g.gyro.x);
Serial.print(", Y: ");
Serial.print(g.gyro.y);
Serial.print(", Z: ");
Serial.print(g.gyro.z);
Serial.println(" rad/s");
Serial.print("Temperature: ");
Serial.print(temp.temperature);
Serial.println(" degC");
Serial.println("");
delay(500);
}
The pinout config for the TTGO T Show is proven beneath:
I linked the pins based mostly on this as follows:
TTGO MPU6050
3V —-> Vcc
G —-> Gnd
22 —-> SCL
21 —-> SDA
However I preserve getting the next error on the serial monitor.
ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1324
ho 0 tail 12 room 4
load:0x40078000,len:13508
load:0x40080400,len:3604
entry 0x400805f0
Adafruit MPU6050 check!
Failed to seek out MPU6050 chip
What’s unusual is that the MPU 6050 works completely effective with the identical pin connection on the traditional Node MCU ESP 32 system. Any thought why it will not work on the TTGO?
[ad_2]