Reading Multiple I2C sensors on ESP32

westech
Posts: 3
Joined: Mon Jun 24, 2019 11:47 pm

Reading Multiple I2C sensors on ESP32

Postby westech » Tue Jun 25, 2019 12:09 am

Greetings!

Yes I am a newbee. I have a small project were I need to read the sensor data from 3 I2C sensors. a BME280 (Temp, Humidity and pressure), MPU 6050 (gyro) and a Time of Flight VL53L0X. Is it best practice for all 3 to use the same I2C pins or is it better to use different pins on the ESP32 WROOM?

My objective is to set up an AP Webserver to display the data on a tablet.

The next step once I have the hardware wired up and reporting the data, is to create a CSS to display the data on the control screen.

I'm loving the ESP32! I have 3 more coming in. One right now has a port of GRBL to control stepper motors and I'm amazed at how easy it was to control via bluetooth.

Thanks

Max

rodmcm
Posts: 65
Joined: Sat Sep 02, 2017 3:31 am

Re: Reading Multiple I2C sensors on ESP32

Postby rodmcm » Wed Jun 26, 2019 9:13 am

Probably the reason that no one has answered you is that there are hundreds of answers to this on a simple Google search

westech
Posts: 3
Joined: Mon Jun 24, 2019 11:47 pm

Re: Reading Multiple I2C sensors on ESP32

Postby westech » Wed Jun 26, 2019 4:16 pm

I know you can have multiple sensors over a single I2C line, But if I'm not using any other pins, is it more efficient for the ESP32 to read from separate pins? Also on the firmware side does that create any issues?

I know interrupts can be an issue if you are ready the data.

There must be a best practices if you are reading 3-4 sensors.

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: Reading Multiple I2C sensors on ESP32

Postby ESP_Sprite » Thu Jun 27, 2019 6:38 am

Sooo.... what have you figured out yourself? We don't quite know what you want to do, and as a newb, it may be a lot more useful to put your reasoning for a tentative solution up, so we can either acknowledge it's a feasible solution or tell you any flaws we see with it. Things to think of: would a lack of speed be an issue? How hard is it to control devices over multiple lines? (Hint: how many I2C controllers does the ESP32 have?)

Who is online

Users browsing this forum: No registered users and 56 guests