Welcome! Log In Create A New Profile

Advanced

DIY Tiny OLED I2C full graphics controller

Posted by enif 
Re: DIY Tiny OLED I2C full graphics controller
June 01, 2019 03:55AM
@war6000:
I have downloaded and compiled your version of Marlin as is. I can hook up the 0.96" and the 1.3" OLED and both work fine right away, and they stay visible and stable.


So from all I can see, there is no problem with your Marlin configuration...
Re: DIY Tiny OLED I2C full graphics controller
June 01, 2019 04:38PM
@enif
Wow!! Thanks for the quick reply and all your help, much appreciated. Btw which version of the graphics library are you using. I’m using [github.com]
Re: DIY Tiny OLED I2C full graphics controller
June 01, 2019 05:24PM
@enif
THANK YOU very much since you assured me the marlin was not the issue I went ahead and uninstall arduino deleted all libraries then got me a portable arduino ide and downloaded 1.18.1 library and now is working. I then switched to 1.19.1 and got the flashing issue. I'm assuming there is something different in the latest version of the library. Again thank you very much for your help

Re: DIY Tiny OLED I2C full graphics controller
June 02, 2019 02:13AM
@war6000: You are very welcome! smiling smiley)) I am glad that it works now!
Re: DIY Tiny OLED I2C full graphics controller
July 27, 2019 04:40AM
Hello everyone.

Thankyou enif for your inspiration.

I am very practical, soldering, connecting no problem but coding and arduino is not a strong point for me, i can just about fumble my way through a marlin sketch.
I have upgraded my ender 3 to a MKS GEN L motherboard (RAMPS based) and replaced the stock display with a MKS TFT touchscreen but i miss some of the features of the original controller so i wanted to make your tiny OLED I2C project for my printer.
I bought the parts and started to work out what pins to connect everything to but what i have found is that there are no pins available for the I2C on my motherboard so ive been trying to work out another option.

There is an off the shelf product by MKS called the MKSoled12864, it even has entries in the latest version of marlin to make configuration easier. I could buy this but i want mine to be as compact as possible, i dont want a beeper or SD card reader.
So by trying to copy the MKSOLED, taking inspiration and guidance from the OG post here, and hoping to achieve a "MKSOLED-lite" i have come up with the attached diagram.
Could someone who is familiar with this sort of thing have a look and see if i have made any major mistakes please? I would be very grateful.

One thing i am not sure on is SH1106 or SSD1306.
I think this is the "language" the OLED panel speaks so do i just need to select the correct one for my panel? will it be stated on the OLED panel description when i buy it? is one better than the other?
Attachments:
open | download - OLED lite.jpg (897.7 KB)
Re: DIY Tiny OLED I2C full graphics controller
July 27, 2019 07:13AM
When I read your message, I first could not believe that the MKS GEN L board does not provide the I2C pins D20 and D21 - but indeed it looks that way sad smiley

So if you want to use I2C with your board (and since you say that connecting and soldering is not a problem for you), the only possibility I can think of is to solder very thin wires (such as wirewrap) directly to the corresponding pins 43 (SCL) and 44 (SDA) of the ATmega2560 chip...

Here a link to a drawing of the ATmega2560 pinout where you can see which pins have to be connected.

As for the SPI based OLEDlite I am sorry, but I cannot really help you.
Re: DIY Tiny OLED I2C full graphics controller
July 27, 2019 08:12AM
Thanks for the reply, im not sure i am confident soldering such tiny traces but i think i am going to try a spi based project of my own design, this ,, "SPIOLED-lite" as i call it. i think all of the theory checks out and the MKSOLED is configured this way so i will give it a go and et you know how it turns out.
Re: DIY Tiny OLED I2C full graphics controller
July 30, 2019 04:38PM
i'm stuck on adapting this too. i was trying to use this with the MKS BASE 1.3 that is the controller for my Turnigy Fabrikator Mini V1.5, a Tinyboy derivative.

There are no I2C pins that I can identify on the board. What sucks is that google thinks its smarter than me and INSISTS that I must mean that I want SBASE not BASE pinouts. This is the best I have found so far-



I got excited when I saw D20 and D21, but then realized my mistake that those are not pins 20 & 21. sad smiley

if the OLED controlle could do ST9720, then it would work as an SPI LCD I think. At least that is how I am using a RRD 12864 GLCD on LPC port of RRF.

Edited 1 time(s). Last edit at 07/30/2019 04:38PM by sinned.
Re: DIY Tiny OLED I2C full graphics controller
July 30, 2019 08:03PM
You do want D20 (SDA) & D21(SCL) these are physical pins 44 and 43 on a mega2560 chip

[www.arduino.cc]
Re: DIY Tiny OLED I2C full graphics controller
July 31, 2019 08:47PM
I can not get this figured out, it's driving me nuts. I don't remember it being this hard.
This is the board I am using -

[www.diymore.cc]

I am fairly confident that I made the edits in the files right, but I get no display at all. Encoder and buzzer work-I hear clicks as i turn the encoder and button push.

I tried 2 different OLED modules and RAMPS/Mega and the MKS board.

I don't think the oleds are bad. Is there a succinct summary of the edits all in one place? I feel like somehow either I missed something or something from the multiples posts with edits is conflicting.

I will clean up my files and post snippets later.

EDIT: Do we have to assign the address of the OLED module somewhere? As its the only device, I can't imagine having to, but thought to ask.





Edited 2 time(s). Last edit at 07/31/2019 10:51PM by sinned.
Re: DIY Tiny OLED I2C full graphics controller
August 01, 2019 02:51AM
Have you made sure that the pins labeled D20 and D21 on your schematic are indeed D20 and D21, e.g. by running the blink sketch on these pins and measuring the voltage on the pins?

I read here that your diagram is from version 1.1 not 1.3. Also note that the labels on the board itself say something link "BZ" and "SS", so it would be a pity to go through all the trouble to find out at the end that the diagram you used was not correct. You can also try using the multimeter to check if you have 0 ohms between the "D20"/"D21" pins and the chip pins 43 and 44 (with no power on the MKS Base board of course...).
Re: DIY Tiny OLED I2C full graphics controller
August 01, 2019 09:19AM
Hi,
I would do two simple checks:

The first is to use a multimeter to check if the pins you are using (20 and 21) are actually SDA (44) and SCL (43) on the ATmega2560 chip.



The second is to upload the "i2c_scanner" sketch to make sure that the oled is actually connected, you can find it here: [playground.arduino.cc]

I din't understand what marlin you are using, maybe I missed it, however, with version 1.1 you can simply enable "#define OLED_PANEL_TINYBOY2" in configuration.h and eventually change the pins of the buttons in "pins_xxxxxxxx.h" if they do not correspond to the your.

Edited 1 time(s). Last edit at 08/01/2019 09:25AM by Skytter.


- Geeetech I3 Pro B "Tuning" GT2560 A+ con sesto Stepper Driver e 3 estrusori - Doppio Alimentatore e Scheda Mosfet per l'HeatBed - Dondolo per I3 Pro B - Diamond HotEnd color mixing - Mk8 Extruder 0.2 nozzle.
- TronXY X5S con Ruramps4d in fase di test.
- Progetto "MiniMaker" full stroke 200x200x180 printer in a 300x300x300 cube.

My Thingiverse: [www.thingiverse.com]
Re: DIY Tiny OLED I2C full graphics controller
August 01, 2019 10:02AM
Quick update from me on my version of this which does not require I2C.
I have received all the parts i need to build and finished my enclosure design so i will be printing later and then assembling, compiling a new firmware (using the MKS12864OLED option which is already in marlin) and testing the controller in the next couple of days.

Without having a beeper or SD card it is possible that my version could be run from a single 10 pin connector like the "Stock CR10 controller" I think i will be able to reassign the pins myself by editing a few bits of marlin but for my preliminary tests i will be running individual dupont connectors to different parts of EXP1 and EXP2.

I will be back in a couple of days to update.

Re: DIY Tiny OLED I2C full graphics controller
August 01, 2019 03:31PM
@Skytter & enif -

Quote
enif
Have you made sure that the pins labeled D20 and D21 on your schematic are indeed D20 and D21, e.g. by running the blink sketch on these pins and measuring the voltage on the pins?

That is indeed the problem sad smiley The AUX-1 header looks to be:

5V-GND-RX0-TX0
5V-GND-NC - NC

And the pins are actually connected to the FTDI. Apparently, if you try to communicate over those and USB at the same time, it does not like it.

So I need to decide if I have a steady enough hand to try soldering jumper wires to the chip to get to SDA/SCL or go a different way.

In retrospect, I think what created my false sense of possibility is intermingling of TinyBoy & Turnigy Fabrikator Mini. Looking closer at the pics from fredchan and mming1106 , they actually have ramps/mega's stuffed under their printers instead of the MKS Base board.

Edited 1 time(s). Last edit at 08/01/2019 03:31PM by sinned.
Re: DIY Tiny OLED I2C full graphics controller
August 04, 2019 11:52AM
Hi Enif,

Just wanted to say thanks again for your inspiration.
My SPI based "MarKS-OLED-lite" controller is up and running. working perfect.
I will post up my own thread showing what i did to achieve it, but big credit to you for the initial idea.
Re: DIY Tiny OLED I2C full graphics controller
August 04, 2019 01:12PM
If anyone is wanting to do this from a SPI interface because you dont have I2C headers. see this post:
[reprap.org]
Re: DIY Tiny OLED I2C full graphics controller
February 22, 2020 12:54AM
I try this in my case oled is working but encoder is not working i tried other encoder bu it's fail
Re: DIY Tiny OLED I2C full graphics controller
February 25, 2020 04:12AM
Hi, first of all, I do really appreciate all the time and efford that has gone into the making of the OLED implementation.

But I do have a Problem on LPC1786 (MKS SGEN_L)

The Display shows everything as it should in the first one or two minutes. (Iam using the E1 pins on the board for SCL and SDA)
But after somewhere in between 30s and 10min it shifts the Lines.

I tried it on an MKR Zero (With U8G2) it works fine on 3.3v. It also does not shift lines, and it is indeed an SSD1306 Controller.

On the SGENL i tried level shifting SDA/SCL to 5v, to no success.
I Also used an LD1117V33 to step down the 5v power from AUX1 to 3.3v, to also, no success.

For Cabling i am using USB2.0 Cable with dupont headers crimped on and GND connected to the shielding.
I read an issue on the Marlin Github Page by (Issue #13257) and tried some things to little or no success (Still new to coding.)
So, i can't really get it to work properly.


Re: DIY Tiny OLED I2C full graphics controller
March 31, 2020 05:10PM
@Johetan have you tried using oled Library 1.18.1 instead of the latest one?
Re: DIY Tiny OLED I2C full graphics controller
April 26, 2020 03:27PM
@ Johetan:

When trying to make my Tiny OLED work under Marlin 2.0.5.3 with the BigTreeTech BTT SKR V1.4, I ran into the same problem as you with that shifted display. I also tried all kind of remedies, such as the ones you tried as well, but with no success...

Finally I looking at the file Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cp, I saw that there were some commented out statements, which looked as if the developer left them in, not being sure that they should really be removed... So I decommented them, recompiled and uploaded. It's now already a few hours running - and so far no shift in the OLED display :-)

Here are the changes I made in Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cp,:
85,86c85,86
< //#define I2C_CMD_MODE  0x080
< #define I2C_CMD_MODE    0x000
---
> #define I2C_CMD_MODE  0x080
> //#define I2C_CMD_MODE    0x000
137c137
<       //u8g->pin_list[U8G_PI_SET_A0] = 1;
---
>       u8g->pin_list[U8G_PI_SET_A0] = 1;
147c147
<       // u8g_i2c_stop();
---
>       u8g_i2c_stop();
151c151
<         //u8g->pin_list[U8G_PI_SET_A0] = 1;
---
>         u8g->pin_list[U8G_PI_SET_A0] = 1;
166c166
<       // u8g_i2c_stop();
---
>       u8g_i2c_stop();
170c170
<         //u8g->pin_list[U8G_PI_SET_A0] = 1;
---
>         u8g->pin_list[U8G_PI_SET_A0] = 1;
184c184
<       // u8g_i2c_stop();
---
>       u8g_i2c_stop();

Let's see if this really solves the problem for good...
Re: DIY Tiny OLED I2C full graphics controller
April 26, 2020 03:33PM
I just received one the these new 32-bit boards from Bigtreetech, the BTT SKR V1.4 based on the LPC1768 ARM32-bit processor. This board runs well with Marlin2, I use version 2.0.5.3 downloaded from here and compile it with PlatformIo.

Of course, my first question was, how to get my Tiny Oled I2C display controller to work with this new board... As it turns out, this was not too difficult, it was just a matter of finding where to attach the 8 basic display controller pins [VCC, GND, SCL, SDA, EN1, EN2, ENC, BUZ] to the SKR V1.4 board, and how to modify Marlin2 for supporting the Tiny Oled.

The SKR V1.4 has a I2C header that is used for [VCC, GND, SDA, SCL]. For the rotary encoder pins EN1 and EN2 I used pins 3.26 and 3.25 on the EXP2 connector, and for the encoder push button pin ENC and the buzzer pin BUZ I used pins 0.28 and 1.30 on the EXP1 connector of the SKR V1.4. Here a photo and a diagram showing the connection:



As for Marlin2, the changes are very similar to those of Marlin1, just small changes in files Marlin/Configuration.h, Marlin/src/inc/Conditionals_LCD.h and Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h are needed. The changes I made are shown below:

*** Marlin/Configuration.h.orig	2020-04-24 11:08:24.412939944 +0200
--- Marlin/Configuration.h 	2020-04-25 21:19:12.211398559 +0200
***************
*** 2040,2045 ****
--- 2040,2050 ----
  //#define OLED_PANEL_TINYBOY2
  
  //
+ // Tiny OLED 128x64 OLED, see [reprap.org]
+ //
+ #define OLED_PANEL_TINYOLED
+ 
+ //
  // MKS OLED 1.3" 128 × 64 FULL GRAPHICS CONTROLLER
  // [reprap.org]
  //
*** Marlin/src/inc/Conditionals_LCD.h.orig	2020-04-24 11:04:36.192130049 +0200
--- Marlin/src/inc/Conditionals_LCD.h	2020-04-26 08:20:25.209172849 +0200
***************
*** 83,88 ****
--- 83,100 ----
    #define IS_U8GLIB_SSD1306
    #define IS_ULTIPANEL
  
+ #elif ENABLED(OLED_PANEL_TINYOLED)
+  
+    #ifndef U8GLIB_SSD1306   // define U8GLIB_SSD1306 in Configuration.h if not using SH1106 version
+      #define U8GLIB_SH1106 // SSD1306 and SH1106 are similar, but have slightly different horizontal shift
+    #endif
+    #define ULTIPANEL
+    #define NEWPANEL
+    #define ULTRA_LCD
+    #define DOGLCD
+    #define REVERSE_ENCODER_DIRECTION
+    #define REVERSE_MENU_DIRECTION
+  
  #elif ENABLED(RA_CONTROL_PANEL)
  
    #define LCD_I2C_TYPE_PCA8574
*** Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h.ori	2020-04-24 12:17:53.422178359 +0200
--- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h	  2020-04-24 17:53:55.223979116 +0200
***************
*** 248,253 ****
--- 248,260 ----
      #define LCD_PINS_ENABLE                P1_21
      #define LCD_PINS_D4                    P1_19
  
+   #elif ENABLED(OLED_PANEL_TINYOLED)
+      #define BTN_EN1                        P3_26
+      #define BTN_EN2                        P3_25
+      #define BTN_ENC                        P0_28  // (58) open-drain
+      #define BEEPER_PIN                     P1_30
+      #define KILL_PIN                       -1
+ 
    #elif ENABLED(CR10_STOCKDISPLAY)
      #define BTN_ENC                        P0_28  // (58) open-drain
      #define LCD_PINS_RS                    P1_22
Please note that these changes are for my version of the Tiny Oled I2C display controller, as documented in this thread. I you use any other variant of this project, your mileage may vary...

If you get the problem with the shifted display that Johetan reported above, see also my reply to him - I am not sure if my method is the proper solution, but so far I have not had the problem again...
Re: DIY Tiny OLED I2C full graphics controller
May 12, 2020 03:49PM
can we make controler with 1602 lcd?
Re: DIY Tiny OLED I2C full graphics controller
May 15, 2020 06:50AM
@enif: You don't need to add these lines:
Quote
enif
+ #define NEWPANEL
+ #define ULTRA_LCD
+ #define DOGLCD
as U8GLIB_SSD1306 will define ULTRA_LCD & DOGLCD; and ULTIPANEL will define ULTRA_LCD & NEWPANEL.
And edit u8g_com_HAL_LPC1768_ssd_hw_i2c.cp file like yours doesn't fix the shifting problem for me.

I define my OLED in Configuration.h to keep thing simpler whenever I want to flash firmware:
Quote

#define Ore_no_OLED
#if ENABLED(Ore_no_OLED)
#define IS_U8GLIB_SSD1306
#define IS_ULTIPANEL
#define ENCODER_PULSES_PER_STEP 4
#define ENCODER_STEPS_PER_MENU_ITEM 1
#endif //!Ore_no_OLED

Quote
SohaibSdq
can we make controler with 1602 lcd?
Yes, you can. Like this:
Quote

#define ORE_NO_1602
#if ENABLED(Ore_NO_1602)
#define LCM1602
#define IS_ULTIPANEL
#define LCD_WIDTH 16
#define LCD_HEIGHT 2
#endif

Edited 5 time(s). Last edit at 05/15/2020 07:05AM by hdragoon.
Sorry, only registered users may post in this forum.

Click here to login