Never make this mistake if you are using i2c display with u8g2 library

Never make this mistake if you are using i2c display with u8g2 library

a month ago, April 27, 2024
Reading time: 2 mins

I have been using olikraus/u8g2: U8glib library for monochrome displays, to work with monochrome displays of different types.

Recently I built a smart controller device

It uses a 0.66-inch i2c OLED display.

I used a single i2c bus to connect multiple devices as usual. I was using the MPU-6050 accelerometer module in addition to the display. In the PCB below, the horizontal header on the top is for the OLED display, which uses GPIO1 and GPIO2 for SCL and SDA and the same is shared with the I2C bus on the left where I have connected the Accelerometer.

I later realized that there is a limitation with the u8g2 library. If you are using the u8g2 library, the display needs to be separate from other i2c devices, so you will need at least two different i2c buses for your project.

I am using esp32-s3 which supports software i2c and it is possible to use any usable GPIO pins as i2c pins.

Previous
Using font icons in Webflow in seconds (the easiest way)
Next
Avoid trailing slashes in Gatsby site URLs
© 2024 Anil Maharjan