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
January 10, 2017 01:57AM
The pins are normally held a HIGH by the activated internal pull-up resistors and forced to low via the ground pin by the encoder resp. switch. So you can check the voltage on the signal pins, they should be at 3.3V when the encoder is not connected and either 0V or 3.3V when the encoder is connected, depending on the state it is in.

I have no experience neither with the ramps-fd nor with marlin kimbra, but I have used the Tiny OLED successfully with an Arduino Due using Andrews modified RAMPS 1.4.

Can you post a photo of your Tiny OLED and how it is connected to the ramps-fd?
Re: DIY Tiny OLED I2C full graphics controller
March 25, 2017 03:21PM
What would need to be edited in Repetier-firmware to get this to work properly?
Re: DIY Tiny OLED I2C full graphics controller
March 26, 2017 08:01AM
I don't use Repetier firmware, but may be this thread will help you...
Re: DIY Tiny OLED I2C full graphics controller
March 26, 2017 09:09AM
Quote
enif
I don't use Repetier firmware, but may be this thread will help you...

Nice find.

If I'm understanding that correctly, the display is already implemented and I just need to comment in/out the relevant lines in uiconfig.h

If so, that's awesome.

Thanks for linking me to that.
ilo
Re: DIY Tiny OLED I2C full graphics controller
April 15, 2017 11:10PM
I had enable the #define U8GLIB_SSD1306 and sd but my oled stucked in menu, not responding to encoder. The x,y and z is keep flashing as shown in the attached picture.Did I missed anything on tweaking the Marlin firmware?
I'm using Marlin 1.1.0-RC8. My oled and encoder is working fine( tested with example sketches).
Attachments:
open | download - oledmenu1.jpg (230.6 KB)
open | download - oledmenu2.jpg (216.7 KB)
Re: DIY Tiny OLED I2C full graphics controller
April 16, 2017 02:16AM
I still use an older version of Marlin, but from what I read, the blinking coordinates just mean that the corresponding axes have not been homed yet. So that part would be normal in your case.

As for the non responding rotary encoder, I assume that there is some problem in the pin assignment. Check out your values for BTN_EN1, BTN_EN2 and BTN_ENC (probably defined in pins_RAMPS.h) and verify them with your wiring.
ilo
Re: DIY Tiny OLED I2C full graphics controller
April 16, 2017 05:22AM
Quote
enif
I still use an older version of Marlin, but from what I read, the blinking coordinates just mean that the corresponding axes have not been homed yet. So that part would be normal in your case.

As for the non responding rotary encoder, I assume that there is some problem in the pin assignment. Check out your values for BTN_EN1, BTN_EN2 and BTN_ENC (probably defined in pins_RAMPS.h) and verify them with your wiring.

Thanks! The encoder works now. I forgot the code section for pin assignment. To make it work(Marlin1.1.0-RC8),

At Conditionals_LCD.h add:
// Generic support for SSD1306 / SH1106 OLED based LCDs.
#if ENABLED(U8GLIB_SSD1306) || ENABLED(U8GLIB_SH1106)
#define ULTRA_LCD //general LCD support, also 16x2
#define DOGLCD // Support for I2C LCD 128x64 (Controller SSD1306 / SH1106 gaphic Display Famiy)
+#define ULTIPANEL
+ #define NEWPANEL

#endif

and at pins_RAMPS.h add:
#if ENABLED(NEWPANEL)
.
.
+#elif defined(U8GLIB_SSD1306)
+ #define BTN_EN1 31
+#define BTN_EN2 33
+#define BTN_ENC 35
+ #define BEEPER_PIN 37
+ #define LCD_SDSS 53
+ #define SD_DETECT_PIN -1
+ #define KILL_PIN -1
Re: DIY Tiny OLED I2C full graphics controller
May 18, 2017 02:59PM
I'm trying to get this working. I have the OLED working. Setup was a snap with the current version of Marlin. I connected an encoder as shown in the schematic. No joy. So I added the following lines to Conditionals_LCD.h:

#define ULTIPANEL
#define NEWPANEL

After re-uploading the firmware I got a flashing screen. After some monkeying with the encoder I got the screen to change but would not allow any other movement via the encoder. Next step was to add the other lines to Pins_RAMPS.h:

#elif defined(U8GLIB_SSD1306)
#define BTN_EN1 31
#define BTN_EN2 33
#define BTN_ENC 35
#define BEEPER_PIN 37
#define LCD_SDSS 53
#define SD_DETECT_PIN -1
#define KILL_PIN -1

This will not compile. I'm sure I am doing something wrong. My apologies as I get lost on really complex code for the Arduino etc. I suspect I do not have these line entries in the correct place in the pins file.

Lastly, if this matters. I am not using a buzzer.

Thank you in advance.

Edited 1 time(s). Last edit at 05/18/2017 03:00PM by Twmaster.


--
TW
Re: DIY Tiny OLED I2C full graphics controller
May 19, 2017 01:24AM
Are you really sure that you have U8GLIB_SSD1306 defined? And not U8GLIB_SH1106?
I use the latter one for the 1.3" displays, the former for 0.96" displays.
Re: DIY Tiny OLED I2C full graphics controller
May 19, 2017 01:54AM
Yes SSD1306 in Configuration.h (from the file)

//
// SSD1306 OLED full graphics generic display
//
#define U8GLIB_SSD1306

//

Thank you.


--
TW
Re: DIY Tiny OLED I2C full graphics controller
May 19, 2017 04:43AM
Please post the compiler output, so that we can see the error messages.
Re: DIY Tiny OLED I2C full graphics controller
May 19, 2017 11:20AM
Ok. Fresh off the IDE....

Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from /Users/Twmaster/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/avr/include/avr/io.h:99:0,
                 from /Users/Twmaster/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/avr/include/avr/pgmspace.h:90,
                 from sketch/Marlin.h:32,
                 from sketch/ultralcd.h:26,
                 from sketch/ultralcd.cpp:23:
sketch/ultralcd.cpp: In function 'void lcd_update()':
ultralcd.h:84: error: 'BLEN_C' was not declared in this scope
     #define EN_C (_BV(BLEN_C))
                       ^
sketch/ultralcd.h:150:36: note: in expansion of macro 'EN_C'
     #define LCD_CLICKED (buttons & EN_C)
                                    ^
sketch/ultralcd.cpp:2724:9: note: in expansion of macro 'LCD_CLICKED'
     if (LCD_CLICKED) {
         ^
exit status 1
'BLEN_C' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

And the code in pins_RAMPS.h:

 #endif

  #if ENABLED(NEWPANEL)

    #elif defined(SSD1306_OLED_I2C_CONTROLLER)
      #define BTN_EN1 31
      #define BTN_EN2 33
      #define BTN_ENC 35
      #define BEEPER 37
      #define LCD_SDSS 53
      #define SDCARDDETECT -1
      #define KILL_PIN -1

  

   #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)

Edited 1 time(s). Last edit at 05/19/2017 11:24AM by Twmaster.


--
TW
Re: DIY Tiny OLED I2C full graphics controller
May 19, 2017 02:28PM
Somehow your last message does not fit well with your initial version, where you use U8GLIB_SSD1306 and define it in Configuration.h.
Where does SSD1306_OLED_I2C_CONTROLLER come from and where is it defined?

And the way you are you using #elif seems rather suspicious to me. Why not just #if and use #elif to replace the following #if ?
Re: DIY Tiny OLED I2C full graphics controller
May 19, 2017 02:33PM
I was simply following the comments and code snippets in the thread. I am not a coder. (Although I wish I were)

The example I was using is in the last post by ilo.

As I think I said in my initial post I'm sure I am doing something wrong.

Thank you.


--
TW
Re: DIY Tiny OLED I2C full graphics controller
May 19, 2017 03:54PM
Ok, I understand. So it's probably best, I simply show you my changes for making my TINYOLED work on Marlin 1.1.x. The added lines are those that are indicated with a "+", the other lines are just showing the context where the changes were made.

1) Additions to Configuration.h
% diff -p Configuration.h{.ori,}
*** Configuration.h.ori	2017-05-19 19:56:42.864881489 +0200
--- Configuration.h	2017-05-19 21:47:15.481863054 +0200
***************
*** 1425,1430 ****
--- 1425,1437 ----
  //
  //#define OLED_PANEL_TINYBOY2
  
+ //
+ // TinyOLED 128x64 OLED from [forums.reprap.org]
+ //
+ //#define U8GLIB_SH1106   // used for most 1.3" OLEDs (default)
+ //#define U8GLIB_SSD1306  // used for most 0.96" OLEDs (uncomment if needed)
+ #define TINYOLED 
+ 
  //=============================================================================
  //=============================== Extra Features ==============================
  //=============================================================================

2) Additions to Conditionals_LCD.h
% diff -p Conditionals_LCD.h{.ori,}
*** Conditionals_LCD.h.ori	2017-05-19 20:22:08.937765646 +0200
--- Conditionals_LCD.h	2017-05-19 20:29:27.988815577 +0200
***************
*** 67,72 ****
--- 67,82 ----
  
    #endif
  
+   #if ENABLED(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 REVERSE_ENCODER_DIRECTION
+     #define REVERSE_MENU_DIRECTION
+   #endif
+ 
    #if ENABLED(OLED_PANEL_TINYBOY2)
      #define U8GLIB_SSD1306
      #define ULTIPANEL
***************

3) Additions to pins_RAMPS.h]
% diff -p pins_RAMPS.h{.ori,}
*** pins_RAMPS.h.ori	2017-05-19 20:03:18.576811985 +0200
--- pins_RAMPS.h	2017-05-19 21:35:10.588615329 +0200
***************
*** 327,332 ****
--- 327,340 ----
        // not connected to a pin
        #define SD_DETECT_PIN 49
  
+     #elif ENABLED(TINYOLED)
+       #define BTN_EN1 31
+       #define BTN_EN2 33
+       #define BTN_ENC 35
+       #define BEEPER_PIN 37
+       #define LCD_SDSS 53
+       #define SD_DETECT_PIN -1
+       #define KILL_PIN -1
      #else
  
        // Beeper on AUX-4
Re: DIY Tiny OLED I2C full graphics controller
May 19, 2017 04:00PM
Thank you again. After work I'm going to blow away my current Marlin folder and create a new from the Zipped file.

I'll report back my results. I had the OLED working. Now to beat the encoder into submission.

smoking smiley


--
TW
Re: DIY Tiny OLED I2C full graphics controller
May 19, 2017 06:06PM
Still not compiling. But new errors.

Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from sketch/MarlinConfig.h:31:0,
                 from /Users/Twmaster/Documents/Marlin/Marlin-RC/Marlin/Marlin.ino:37:
Conditionals_LCD.h:28: error: unterminated #ifndef
 #ifndef CONDITIONALS_LCD_H // Get the LCD defines which are needed first
 ^
In file included from sketch/pins.h:63:0,
                 from sketch/MarlinConfig.h:33,
                 from /Users/Twmaster/Documents/Marlin/Marlin-RC/Marlin/Marlin.ino:37:
pins_RAMPS.h:376: error: #endif without #if
 #endif // ULTRA_LCD
  ^
exit status 1
unterminated #ifndef

Also, in the code segments you posted I do nto have any listings at all for the "tinyboy" LCD.

Marlin 1.1.0_RC


--
TW
Re: DIY Tiny OLED I2C full graphics controller
May 19, 2017 08:54PM
And It compiles now.

I downloaded the 1.1.x version and it's compiled. I have to go take care of some personal business and will upload the firmware to the board when I return and report the results.

Thank you for your help.


--
TW
Re: DIY Tiny OLED I2C full graphics controller
May 19, 2017 11:37PM
And I am happy to report it mostly works. The only real issue I have is with the encoder. You have to turn the thing three clicks to get it to move to the next position on the menu. The encoder also seems to work backwards from what I expected. But it now works. The rest I hope can be fixed via tweaking.

Thank you again. I am grateful.


--
TW
Re: DIY Tiny OLED I2C full graphics controller
May 20, 2017 01:37AM
In Conditionals.h just comment out the line
#define REVERSE_ENCODER_DIRECTION
and in Configuration.h uncomment and adjust the values of
#define ENCODER_PULSES_PER_STEP 1
#define ENCODER_STEPS_PER_MENU_ITEM 5
too your liking. Hope that helps to resolve the remaining problems.
Re: DIY Tiny OLED I2C full graphics controller
May 20, 2017 01:23PM
That does solve it for me. Perfect! Some tweaking on the menu steps and it now works as I prefer. I've added the buzzer and need to complete the configuration of my Prusa-ish printer. This was a big hurdle to cross.

I want to thank you for posting this project. Thank you for the kind help and also thanks to all who contributed to this.

I really dig these little OLED displays and use them extensively through my projects. I even prefer them over the common 1602 and 2004 LCDs for text.


--
TW
Re: DIY Tiny OLED I2C full graphics controller
May 20, 2017 04:01PM
You're welcome! I'm glad to know that you got it working now. :-)
Re: DIY Tiny OLED I2C full graphics controller
June 19, 2017 07:23PM
And I am happy to report with some help from the folks on the dev team I have this OLED/Encoder/Beeper working on Repetier 1.0-dev

I'll post the settings to configure this later this week once I can sit down and sort it all out into all the steps needed.

Edited 1 time(s). Last edit at 06/19/2017 07:24PM by Twmaster.


--
TW
Re: DIY Tiny OLED I2C full graphics controller
July 19, 2017 10:29PM
we have the lastest marlin bugfix 1.1.x that works with TinyOLED, please have a look of details from www.facebook.com/hkmakers.hk
Attachments:
open | download - IMG-20170404-WA0001.jpg (41 KB)
Re: DIY Tiny OLED I2C full graphics controller
July 19, 2017 10:29PM
we have the lastest marlin bugfix 1.1.x that works with TinyOLED, please have a look of details from www.facebook.com/hkmakers.hk



Edited 1 time(s). Last edit at 07/19/2017 10:29PM by fredchan.
Re: DIY Tiny OLED I2C full graphics controller
August 02, 2017 05:34AM
Next upgrade - a 2.42" OLED display ?
[www.ebay.com]

:-)
Re: DIY Tiny OLED I2C full graphics controller
August 02, 2017 10:28AM
Quote
bipsen
Next upgrade - a 2.42" OLED display ?
[www.ebay.com]

:-)

I already have a 2.42" OLED working. However that one you link on FeeBay will not work. I have 2 and I've tried. They claim it's also I2C but nobody can seem to get that to actually work as I2C.


--
TW
Re: DIY Tiny OLED I2C full graphics controller
December 10, 2017 04:58AM
Hi,

I'm looking to use the side mounted rotary encoder version of this with a 2.42" inch ssd1309 oled display,
what changes do I need to make to the scad for the larger display(I'm still fairly new to using openscad)

any hints would be appreciated
pheonixfire
Re: DIY Tiny OLED I2C full graphics controller
December 10, 2017 07:13AM
As the 2.42" OLED is much bigger and has the pins on the side instead of at the top, I guess modifying the 1.3"/0.96" desing of the display cover is likely to be more difficult than redesigning a fitting cover from scratch. If you want to follow the same pattern I used for the smaller OLED, you can take the same SCAD file and just rewrite the following arrays: blocks, cavities, rearblocks and rearcavities...
Re: DIY Tiny OLED I2C full graphics controller
December 10, 2017 09:23PM
I was considering using a ribbon cable to connect the display to the pcb, is there any resources you would recommend
that would help me to understand the code in the scad file?

any hints would be appreciated
pheonixfire
Sorry, only registered users may post in this forum.

Click here to login