Hello,
On the OLED Display SSD1306, on the I2c address, we can only select 0x78 or 0x7A
In my case the I2C address is 0x3C.
Confirmed with an I2C scanner and with this example : https://www.instructables.com/Monochrom ... ino-SSD13/
How can we change the address ?
OLED SSD1306 I2C Address
-
- Posts: 9
- http://meble-kuchenne.info.pl
- Joined: Fri Sep 10, 2021 8:59 am
- Been thanked: 1 time
-
- Matrix Staff
- Posts: 1895
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 491 times
- Been thanked: 664 times
Re: OLED SSD1306 I2C Address
Hello,
Address 0x3C = 0x78
0x3C is a 7-bit address and 0x78 is the 8-bit address but they are the same.
To get the display working ensure you have pull up resistors to VCC on the SDA and SCL lines. 1K to 10K should work well.
Address 0x3C = 0x78
0x3C is a 7-bit address and 0x78 is the 8-bit address but they are the same.
To get the display working ensure you have pull up resistors to VCC on the SDA and SCL lines. 1K to 10K should work well.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Re: OLED SSD1306 I2C Address
Hello Ben,
I didn't find any example about SSD1306-I2C in FC9 with ESP32.
This program in IDE Arduino works perfectly :
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
Wire.setClock(400000);
Wire.begin();
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed")); }
display.clearDisplay();
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(SSD1306_WHITE); // Draw white text
display.cp437(true); // Use full 256 char 'Code Page 437' font
display.clearDisplay();
display.setCursor(0,0);
display.println(F("Status:Free"));
display.display();
}
void loop() {
}
My OLED1306.fcfx example program don't work.
Maybe the I2C pins assignment.
Thank you for your help.
I didn't find any example about SSD1306-I2C in FC9 with ESP32.
This program in IDE Arduino works perfectly :
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
Wire.setClock(400000);
Wire.begin();
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed")); }
display.clearDisplay();
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(SSD1306_WHITE); // Draw white text
display.cp437(true); // Use full 256 char 'Code Page 437' font
display.clearDisplay();
display.setCursor(0,0);
display.println(F("Status:Free"));
display.display();
}
void loop() {
}
My OLED1306.fcfx example program don't work.
Maybe the I2C pins assignment.
Thank you for your help.
- Attachments
-
- OLED1306.fcfx
- (10.78 KiB) Downloaded 258 times
-
- Matrix Staff
- Posts: 1610
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 567 times
- Been thanked: 531 times
Re: OLED SSD1306 I2C Address
I'm using a wifi kit32 which has a SSD1306.
I can confirm your flowchart working for my display using 0x78. The only things I changed was the pins as my display is built in to the ESP32.
The Baud Select from 100k to 400k as 100k is way too slow.
Interlaced to yes otherwise will cause the display to look wrong.
The font to Calibri 14 since interlaced will make the default font fairly small.
Have you tried a 1 second flash test?
I can confirm your flowchart working for my display using 0x78. The only things I changed was the pins as my display is built in to the ESP32.
The Baud Select from 100k to 400k as 100k is way too slow.
Interlaced to yes otherwise will cause the display to look wrong.
The font to Calibri 14 since interlaced will make the default font fairly small.
Have you tried a 1 second flash test?
Martin
-
- Matrix Staff
- Posts: 1895
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 491 times
- Been thanked: 664 times
Re: OLED SSD1306 I2C Address
Also you didn't comment about the hardware pull up resistors on the SCL/SDA pins?
You can enable software pullups if required and this is probably what the Arduino code is doing.
You can enable software pullups if required and this is probably what the Arduino code is doing.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Re: OLED SSD1306 I2C Address
I just made this wiring :
i have to find how enable the internal pull up...
it would be interesting if the initialization routines could return an information if everything went well
i have to find how enable the internal pull up...
it would be interesting if the initialization routines could return an information if everything went well
-
- Matrix Staff
- Posts: 1610
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 567 times
- Been thanked: 531 times
Re: OLED SSD1306 I2C Address
My recommendation is not to use internal weak pull-up resistors.
As there are around 45K it could cause timing issues.
Hardware will not work as well as if you use the values Ben has stated.
As there are around 45K it could cause timing issues.
Hardware will not work as well as if you use the values Ben has stated.
Martin
Re: OLED SSD1306 I2C Address
My OLED Adafruit own pull-up resistors. I wired an oscilloscope on the I2C signals. No activity on the SDA and SCL. The signals are 3.3V level.
I monitor the COM port and the see a problem on the DEBUG info :
[0;31mE (373) i2c: i2c_param_config(647): i2c clock choice is invalid, please check flag and frequency[0m
[0;31mE (383) i2c: i2c_master_cmd_begin(1166): i2c driver not installed[0m
[0;31mE (383) i2c: i2c_master_cmd_begin(1166): i2c driver not installed[0m
[0;31mE (383) i2c: i2c_master_cmd_begin(1166): i2c driver not installed[0m
......
I tried to change frequency ( 100K , 400K or 1M ) , the problem was the same.
I updated the library and recompile the program. The problem was the same.
I also try to create a simple program to send a message on I2C, the problem is the same.
No activity on the SDA and SCL
I monitor the COM port and the see a problem on the DEBUG info :
[0;31mE (373) i2c: i2c_param_config(647): i2c clock choice is invalid, please check flag and frequency[0m
[0;31mE (383) i2c: i2c_master_cmd_begin(1166): i2c driver not installed[0m
[0;31mE (383) i2c: i2c_master_cmd_begin(1166): i2c driver not installed[0m
[0;31mE (383) i2c: i2c_master_cmd_begin(1166): i2c driver not installed[0m
......
I tried to change frequency ( 100K , 400K or 1M ) , the problem was the same.
I updated the library and recompile the program. The problem was the same.
I also try to create a simple program to send a message on I2C, the problem is the same.
No activity on the SDA and SCL
-
- Valued Contributor
- Posts: 883
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 173 times
- Been thanked: 203 times
Re: OLED SSD1306 I2C Address
Hi gregobac
Can you for the test with the oscilloscope print nonstop "test"?
It's more comfortable
and you can also trie to set the I2C to software mode?
regards
Stefan
Can you for the test with the oscilloscope print nonstop "test"?
It's more comfortable
and you can also trie to set the I2C to software mode?
regards
Stefan