ESP32

Adding a Sensor

To add a Sensor to the ESP32 first search for the Sensor name on the ESPHome Website:

https://esphome.io/

In our example we search for MPU6050 and come to this page:

https://esphome.io/components/sensor/mpu6050.html

As we can read in the second Line on the page this Sensor uses I2C Bus so we also come to this page:

https://esphome.io/components/i2c#i2c

Adding I2C

To add I2C Bus to our Firmware we need to add it to our Config with the right GPIO Pins for our board.

The PIN out of our ESP32s is this:

As we can see we have SDA = GPIO21 and SLC = GPIO22.

So we connect our Sensor to this Ports and also added them to the config:

Adding MPU6050

On the Website for the MPU6050 we can see that the Sensor captures Data for Acceleration and Angle in X, Y, Z as well as Temprature.

For this example we only going to use the Acceleration Data so we add the following Lines to our Config:

Firmware and Logs

Now we can create a new Firmware and load it onto the ESP32 like before.

If we take a look at the Logs of a freshly booted device we should see the following:

Matlab

GoTo

Overview

Go Back