Page 1 of 6

OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Thu Nov 02, 2023 6:10 pm
by pmgreene01
I want to use 128x64 OLED display in my Arduino Nano project. I have been using a 1602 character display over I2C, but need more real estate.

I have purchased several OLED modules and can't get them to work with Flowcode. I am currently running an SH11106 display using the Adafruit library and the demo program and is is working fine in the Arduino IDE. After reading some posts, I added pull up resistors (2k) to optimize the signals, but is does function without any pullups in the Arduino IDE.

No matter what I do, I can't get it to do anything in Flowcode. I checked the address with an Arduino I2C scanner. As I said, I added the pullups and my I2C signals are very clean. I also tried the SSD1306 component, but that did not work.

I am wondering if anyone has a suggestion of how to get a graphical display to work with an Arduino Nano. I am also wondering if there is a way to incorporate the Adafruit libraries into Flowcode so that I can just call the functions I need from that.

The libraries that I use in Arduino IDE are the Adafruit_SH110x and Adafruit GFX libraries. I only need to write text to the screen, so I just need a simple program that will let me place the cursor and write strings.

Looking for any suggestions or part numbers of displays that people have made with with Flowcode.

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Thu Nov 02, 2023 8:08 pm
by chipfryer27
Hi

Can you attach your chart?

Does it work in simulation?

Regards

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Fri Nov 03, 2023 12:42 am
by pmgreene01
Thanks for the reply.

I attached my program. It is pretty simple.

I just tried it again and it did start to write text, but the "ClearDisplay" does not work, so the last image from the Adafruit demo is still on the screen. I attached a picture of that as well.

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Fri Nov 03, 2023 12:57 pm
by chipfryer27
Hi

Have you tried rebooting and powering up the display whilst only running FC?

Although I don't have your exact chip and display, I do have a Nano and SSD1306 displays and can't remember any issues using them together. If I get time I'll try and dig them out over the weekend.

Regards

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Sat Nov 04, 2023 4:40 pm
by pmgreene01
Update. I recreated the program from scratch. Now it runs, but "ClearDisplay" still does not work. I got around that by drawing a rectangle over the entire screen area and then writing my text values for the value labels. Then I have a loop where I update the sensor values.

My problem now is that the display updates are really slow. I am writing 3 values to the screen that each have a max of 3 characters and a decimal point. The update rate on the display is about 2.5Hz with nothing else happening and no delay timers. The simulation in Flowcode runs much faster than the actual screen. I am wondering it this is as good as it gets or if there is a setting that can make it faster. I have the i2c rate at 1 Mhz. I am wondering if there is another setting that is slowing it down or if this is as good as it gets.

I attached the diagram.

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Sat Nov 04, 2023 5:13 pm
by chipfryer27
Hi

Sounds like there may be a bug in the "ClearDisplay" macro.

Datasheet for the display suggests a maximum of 400KHz for i2c

Regards

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Sat Nov 04, 2023 10:33 pm
by pmgreene01
Noted on the I2C rate, I tried that just because the updates are so slow. It didn't really improve the update rate.

Is 2.5 Hz the best I can expect for just displaying a few numbers? I really thought this display would be an improvement over a 16x2 character display, but not unless I can get it to update faster. Not sure where to look to make it faster.

Thank you for answering my questions,

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Sat Nov 04, 2023 11:45 pm
by chipfryer27
Hi

I looked at your chart, thinking perhaps that when you drew your rectangle you were "colouring it in", which would tie up time, but I don't see anything that would slow things to a crawl.

This is the only relevant post I found from about a year ago

viewtopic.php?f=5&t=1499&p=8594&hilit=sh1106+slow#p8594 which required an update to resolve.

Regards

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Sun Nov 05, 2023 3:21 pm
by pmgreene01
I did the library update, but no success in speeding things up.

I uploaded a video to Youtube to show how slow the updates are. https://youtu.be/jmP96dvl_9c

Since "ClearDisplay" does not work, I draw a rectangle and you can see how long it takes to fill in the rectangle with the background color.

If anyone has any suggestions to get the updates to happen a little faster, then I would appreciate it.

Thanks

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Sun Nov 05, 2023 5:29 pm
by mnfisher
I rewrote ClearDisplay - as ClearDisplay2. Could you try this? Here just compile the program (not as a component) - it should just print a 'Hello' and then clear the display repeatedly...

There is a lot of data to write to i2c so it's always going to be fairly slow?

Try the new version below....

If you want to test as a component - either export ClearDisplay2 or overwrite the code for ClearDisplay and re-export..

Martin