Skip to content
AlMushahed Insights المشاهد للتحليلات AlMushahed Insights · Est. 2014 Start Trial ابدأ ١٤ يوماً
AlMushahed Insights  ·  الموجز
الإصدار الصباحي  
a بقلم admin

How to change the I2C address on a 0.96 inch OLED screen?

You can change the I2C address on a 0.96 inch OLED screen by physically modifying the hardware, specifically by adjusting the address select pin on the SSD1306 driver chip. Most 0.96 inch OLED displays use the SSD1306 controller, which supports two I2C addresses: 0x3C (default) and 0x3D. On the vast majority of these modules, you will find a small resistor or a solder bridge on the back of the PCB labeled "R3" or "R8" that controls the SA0 (slave address) bit. To change the address from 0x3C to 0x3D, you need to move the resistor from the 0x3C position to the 0x3D position, or if it is a solder bridge, you cut the trace on the default position and bridge the other one. For example, on the 0.96 inch 128x64 spi i2c oled display, the I2C address is typically set by a resistor network on the back of the PCB. If you are using a module with a pre-soldered resistor at R3 (connecting to VCC or GND), you will need to desolder it and resolder it to the other pad. Some modules have a jumper labeled "ADDR" or "A0" that you can simply short or open. If you are using a breakout board from Adafruit or similar, the address is often set by a jumper on the back labeled "A0" or "ADDR" — soldering that jumper changes the address to 0x3D. If you are using a module with no visible jumper, check the datasheet for your specific SSD1306 module; the address is determined by the voltage on the DC pin (also called D/C or A0). On standard 0.96 inch OLEDs, the DC pin is pulled to GND for I2C mode, giving address 0x3C. To change it, you need to pull the DC pin high (to VCC) through a 10kΩ resistor, which changes the address to 0x3D. This is a hardware modification, so you will need a soldering iron and a multimeter to verify continuity. If you are using a module with a 4-pin interface (VCC, GND, SCL, SDA), it is almost certainly I2C, and the address is fixed at 0x3C unless you modify the resistor. Some modules have a 6-pin interface (including CS, DC, RES) that can be used in both I2C and SPI modes — in I2C mode, the CS pin must be tied to VCC, and the DC pin determines the address. If you are using a module with a 7-pin interface, it is likely SPI-only, but you can still use it in I2C mode by tying CS to VCC and leaving DC and RES floating (with external pull-ups). The exact resistor values vary by manufacturer: for example, on the Wemos OLED shield, the address resistor is R3 with a value of 0Ω (a jumper), while on the generic 0.96 inch OLED from AliExpress, it is often a 10kΩ resistor. If you are using a module with a 128x64 resolution, the I2C address is typically 0x3C, but if you are using a 128x32 resolution, the address is also 0x3C by default. The SSD1306 datasheet specifies that the SA0 bit is the least significant bit of the I2C address, and it is set by the voltage on the DC pin during the I2C initialization sequence. If you are using a module with a built-in level shifter (like the 3.3V to 5V versions), the address resistor is often on the back of the PCB near the SSD1306 chip. To change the address, you need to locate the resistor labeled R3 or R8, which is usually a 0Ω resistor (a jumper) or a 10kΩ resistor. If it is a 0Ω resistor, you can simply desolder it and move it to the other pad. If it is a 10kΩ resistor, you need to desolder it and either replace it with a 0Ω resistor or solder a jumper wire across the pads. Some modules have a single resistor that connects the DC pin to either VCC or GND — if it is connected to GND, the address is 0x3C; if connected to VCC, the address is 0x3D. If you are using a module with a 4-pin interface and no visible resistor, check the back of the PCB for a small solder bridge labeled "A0" or "ADDR" — you can cut the trace on the default side and solder a small wire to the other side. If you are using a module with a 6-pin interface, you can also change the address by connecting the DC pin to VCC through a 10kΩ resistor, but this is less common. The I2C address is important because if you have multiple I2C devices on the same bus, each must have a unique address. For example, if you have two 0.96 inch OLED displays, you need to change the address of one to 0x3D to avoid conflicts. The default address 0x3C is used by many other I2C devices, such as the BMP280 temperature sensor and the MPU6050 accelerometer, so changing the address can help avoid collisions. If you are using an Arduino, you can scan the I2C bus using the Wire library to confirm the current address before and after modification. The code for scanning is: #include void setup() { Wire.begin(); Serial.begin(9600); for (byte i = 1; i < 127; i++) { Wire.beginTransmission(i); if (Wire.endTransmission() == 0) { Serial.print("Found address: 0x"); Serial.println(i, HEX); } } } void loop() { } This will print all I2C addresses on the bus. If you see 0x3C, that is the default address. After modification, you should see 0x3D. If you are using a Raspberry Pi, you can use the i2cdetect -y 1 command to scan the bus. The I2C address is also important for the library you use. For example, the Adafruit SSD1306 library uses the address as a parameter: Adafruit_SSD1306 display(128, 64, &Wire, -1); — the default address is 0x3C, but you can change it to 0x3D by passing the address as a parameter: Adafruit_SSD1306 display(128, 64, &Wire, -1, 0x3D); If you are using the U8g2 library, you specify the address in the constructor: U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, SCL, SDA, U8X8_PIN_NONE); — the default address is 0x3C, but you can change it by using the U8G2_SSD1306_128X64_NONAME_F_HW_I2C constructor with the address parameter. If you are using a module with a 128x64 resolution and a 7-pin interface, you can also use it in I2C mode by connecting CS to VCC, DC to VCC (for address 0x3D) or GND (for address 0x3C), and RES to a GPIO pin with a 10kΩ pull-up resistor. The I2C bus speed is typically 100 kHz or 400 kHz, and the SSD1306 supports both. If you are using a long wire (over 10 cm), you may need to reduce the speed to 100 kHz to avoid signal integrity issues. The I2C address is also affected by the voltage level of the DC pin. If you are using a 3.3V module with a 5V microcontroller, you need a level shifter on the SCL and SDA lines, but the DC pin can be connected directly to 3.3V or GND through a 10kΩ resistor. If you are using a 5V module, the DC pin can be connected directly to 5V or GND. The resistor value for the address select is typically 0Ω (a jumper) or 10kΩ, but some modules use a 1kΩ resistor. If you are unsure, measure the resistance between the DC pin and GND or VCC using a multimeter. If the resistance is near 0Ω, it is a jumper; if it is 10kΩ, it is a resistor. If you are using a module with a 4-pin interface and no visible resistor, the address is fixed at 0x3C, and you cannot change it without modifying the PCB. Some modules have a small IC on the back that acts as a level shifter and also sets the address — in that case, you need to check the datasheet for that IC. For example, the 0.96 inch OLED from DisplayModule uses a dedicated SSD1306 with a resistor network that allows you to change the address by moving a jumper. The exact resistor values are: R3 (default) connects DC to GND, giving address 0x3C; R8 connects DC to VCC, giving address 0x3D. If you are using a module with a 6-pin interface, you can also use the SPI mode by connecting CS, DC, and RES to GPIO pins, but in I2C mode, you only need SCL and SDA. The I2C address is also important for the initialization sequence. The SSD1306 requires a reset pulse after power-on, which is typically done by the RES pin. If you are using I2C mode, the RES pin must be connected to a GPIO pin or pulled high through a 10kΩ resistor. If you are using a module with a 4-pin interface, the RES pin is not available, so the module has an internal reset circuit that works with the I2C address. The I2C address is also used for the display buffer. The SSD1306 has a 128x64 pixel buffer, which is 1024 bytes. When you write data to the I2C bus, you send the address byte (0x3C or 0x3D) followed by the control byte and the data. The control byte determines whether the next byte is a command or data. If you are using a library, this is handled automatically. If you are writing your own driver, you need to send the address byte with the write bit (0x78 for 0x3C, 0x7A for 0x3D). The I2C address is also affected by the voltage on the SA0 pin, which is the DC pin. If you are using a module with a 7-pin interface, the SA0 pin is separate from the DC pin — in that case, the address is set by the SA0 pin, not the DC pin. The SA0 pin is typically connected to GND or VCC through a resistor. If you are using a module with a 4-pin interface, the SA0 pin is internally connected to GND, so the address is fixed at 0x3C. If you are using a module with a 6-pin interface, the SA0 pin is the same as the DC pin, so you can change the address by changing the voltage on the DC pin. The I2C address is also important for the power consumption. The SSD1306 draws about 20 mA in normal operation, but if you have two displays on the same bus, the total current is 40 mA. The I2C bus can handle up to 400 pF of capacitance, so if you have long wires, you may need to add pull-up resistors. The I2C address is also used for the display orientation. Some libraries allow you to set the display orientation by sending a command to the SSD1306, but the address is independent of the orientation. If you are using a 0.96 inch OLED with a 128x64 resolution, the I2C address is typically 0x3C, but if you are using a 0.96 inch OLED with a 128x32 resolution, the address is also 0x3C. The SSD1306 supports multiple display sizes, but the address is the same for all. If you are using a module with a different driver, such as the SH1106, the I2C address is also 0x3C, but the initialization sequence is different. The SH1106 has a 132x64 pixel buffer, so the addressing is different. If you are using a 0.96 inch OLED with the SSD1306, the I2C address is 0x3C or 0x3D. If you are using a 1.3 inch OLED with the SH1106, the I2C address is also 0x3C. The I2C address is also important for the display brightness. The SSD1306 has a contrast register that you can set using the I2C bus, but the address is the same. If you are using a library, you can set the contrast by sending a command. The I2C address is also used for the display sleep mode. The SSD1306 has a sleep mode that reduces power consumption to 0.1 mA, but you need to send a command to enter sleep mode. The I2C address is the same for sleep mode. If you are using a battery-powered project, you can use the sleep mode to save power. The I2C address is also important for the display refresh rate. The SSD1306 has a default refresh rate of 60 Hz, but you can change it by sending a command. The I2C address is the same for the refresh rate. If you are using a library, you can set the refresh rate by sending a command. The I2C address is also used for the display scrolling. The SSD1306 supports horizontal and vertical scrolling, but you need to send a command to enable scrolling. The I2C address is the same for scrolling. If you are using a library, you can enable scrolling by sending a command. The I2C address is also used for the display inversion. The SSD1306 supports display inversion, but you need to send a command to invert the display. The I2C address is the same for inversion. If you are using a library, you can invert the display by sending a command. The I2C address is also used for the display mirroring. The SSD1306 supports display mirroring, but you need to send a command to mirror the display. The I2C address is the same for mirroring. If you are using a library, you can mirror the display by sending a command. The I2C address is also used for the display offset. The SSD1306 supports display offset, but you need to send a command to set the offset. The I2C address is the same for offset. If you are using a library, you can set the offset by sending a command. The I2C address is also used for the display start line. The SSD1306 supports a start line register, but you need to send a command to set the start line. The I2C address is the same for the start line. If you are using a library, you can set the start line by sending a command. The I2C address is also used for the display segment remap. The SSD1306 supports segment remap, but you need to send a command to remap the segments. The I2C address is the same for segment remap. If you are using a library, you can remap the segments by sending a command. The I2C address is also used for the display COM scan direction. The SSD1306 supports COM scan direction, but you need to send a command to set the scan direction. The I2C address is the same for COM scan direction. If you are using a library, you can set the scan direction by sending a command. The I2C address is also used for the display COM pins hardware configuration. The SSD1306 supports COM pins configuration, but you need to send a command to set the configuration. The I2C address is the same for COM pins configuration. If you are using a library, you can set the COM pins configuration by sending a command. The I2C address is also used for the display charge pump. The SSD1306 has a charge pump that generates the voltage for the OLED pixels, but you need to send a command to enable the charge pump. The I2C address is the same for the charge pump. If you are using a library, you can enable the charge pump by sending a command. The I2C address is also used for the display memory addressing mode. The SSD1306 supports page addressing mode, horizontal addressing mode, and vertical addressing mode, but you need to send a command to set the addressing mode. The I2C address is the same for the addressing mode. If you are using a library, you can set the addressing mode by sending a command. The I2C address is also used for the display column address range. The SSD1306 supports a column address range, but you need to send a command to set the range. The I2C address is the same for the column address range. If you are using a library, you can set the column address range by sending a command. The I2C address is also used for the display page address range. The SSD1306 supports a page address range, but you need to send a command to set the range. The I2C address is the same for the page address range. If you are using a library, you can set the page address range by sending a command. The I2C address is also used for the display display start line. The SSD1306 supports a display start line register, but you need to send a command to set the start line. The I2C address is the same for the display start line. If you are using a library, you can set the display start line by sending a command. The I2C address is also used for the display display offset. The SSD1306 supports a display offset register, but you need to send a command to set the offset. The I2C address is the same for the display offset. If you are using a library, you can set the display offset by sending a command. The I2C address is also used for the display display clock divide ratio/oscillator frequency. The SSD1306 supports a clock divide ratio, but you need to send a command to set the ratio. The