olikraus / u8g2

U8glib library for monochrome displays, version 2
Other
5.01k stars 1.04k forks source link

Request for SSD1306 72x40 oled support #1047

Closed nikthefix closed 4 years ago

nikthefix commented 4 years ago

There are new modules all over ebay and aliexpress using this configuration:

https://www.aliexpress.com/item/33047094998.html?spm=a2g0o.productlist.0.0.a0636686fuUxju&algo_pvid=f9be7ce0-c128-4a1e-85d5-58f4653bd0f6&algo_expid=f9be7ce0-c128-4a1e-85d5-58f4653bd0f6-0&btsid=77a37fc2-c177-48fe-8448-2333f335f89d&ws_ab_test=searchweb0_0,searchweb201602_9,searchweb201603_52

I've modified the SH1106 code to support this in my code but it would great to have you include it properly in the lib.

Thanks for the great work!

olikraus commented 4 years ago

Any reason why you have modified the SH1106 code? Shouldn't it be SSD1306 code instead? Can you share your modifications?

olikraus commented 4 years ago

I have ordered one of these OLEDs

nikthefix commented 4 years ago

Hi,

Yes I actually did both just to see which would be the most sensible starting point and ended up using ssd1306 64x32 with some override commands in the main sketch (just raw wire.writes) so that I didn't need to change the libs at all. With this display module there is one BIG issue. There is no external IREF so using any of the popular SSD1306 libs will produce a very dim display. During the init phase we need to send:

Command 0xAD //IREF mode Command 0x30// 0=External ...or b00110000=Internal where A[4] sets internal mode and A[5] sets the current reference to 19uA or 30uA giving 150uA and 240uA segment currents respectively. The display is really bright at 240uA with a good diming range from the contrast control.

None of the libraries I've looked at cater for this - maybe because this feature is only documented in SSD1306B v1.1 data sheet and not in SSD1306 v1.

Another oled which will soon be hitting ebay/ ali etc in module form (I have a man on the inside!) is the SSD1306 72x32 0.41". I've ordered a few of the bare screens to mount to a custom pcb and will experiment and compare. There is also a SSD1331 64x64 colour oled which I'm going to try - not found a mounted version of this yet so may have to build this too.

I'm a huge fan of your work.

Many Thanks

Nick

On Fri, Nov 15, 2019 at 6:43 PM olikraus notifications@github.com wrote:

Any reason why you have modified the SH1106 code? Shouldn't it be SSD1306 code instead? Can you share your modifications?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/olikraus/u8g2/issues/1047?email_source=notifications&email_token=AKUUVMOCXM5MX4UBCJM4GVDQT3UUZA5CNFSM4JNZNH4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEGLHFQ#issuecomment-554480534, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKUUVMIP6356DF3TSFVJM6DQT3UUZANCNFSM4JNZNH4A .

nikthefix commented 4 years ago

BTW, this is the module I was referring to and suspect it's the one you've ordered:

https://www.aliexpress.com/i/33047094998.html?ws_ab_test=searchweb0_0,searchweb201602_0_10130_453_454_10618_536_317_537_319_10059_10696_10084_10083_10547_10546_10887_10307_321_10548_322_10065_10068_10103_10884_10545,searchweb201603_0,ppcSwitch_0&algo_pvid=6ce2eb17-0771-4255-bd4c-c8cb8d541c57&algo_expid=6ce2eb17-0771-4255-bd4c-c8cb8d541c57-4

Other variants of this module may have external IREF as is the case with the other popular SSD1306 oled modules. I guess using internal IREF reduces component count a little and allows user control of max brightness in software.

Nick

On Fri, Nov 15, 2019 at 6:43 PM olikraus notifications@github.com wrote:

Any reason why you have modified the SH1106 code? Shouldn't it be SSD1306 code instead? Can you share your modifications?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/olikraus/u8g2/issues/1047?email_source=notifications&email_token=AKUUVMOCXM5MX4UBCJM4GVDQT3UUZA5CNFSM4JNZNH4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEGLHFQ#issuecomment-554480534, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKUUVMIP6356DF3TSFVJM6DQT3UUZANCNFSM4JNZNH4A .

olikraus commented 4 years ago

I have ordered this display: https://www.ebay.com/itm/I2C-White-0-42-inch-OLED-Display-Module-72x40-Arduino-Raspberry-Pi-W-SSD1306/293291415905

nikthefix commented 4 years ago

Yes this is what i have except that yours shows an early iteration misprint in the silk screen - 70x40 instead of 72x40.

Nick

On Sat, Nov 16, 2019 at 3:53 PM olikraus notifications@github.com wrote:

I have ordered this display: https://www.ebay.com/itm/I2C-White-0-42-inch-OLED-Display-Module-72x40-Arduino-Raspberry-Pi-W-SSD1306/293291415905

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/olikraus/u8g2/issues/1047?email_source=notifications&email_token=AKUUVMKZNTFORHYO7RVKQBLQUAJOPA5CNFSM4JNZNH4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEHUMRI#issuecomment-554649157, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKUUVML3ONRKPNMBLDE2I3TQUAJOPANCNFSM4JNZNH4A .

olikraus commented 4 years ago

Oh, you mean it is actually 72x40? Let's see then...

MadhavL commented 4 years ago

@olikraus @nikthefix Bump... Just got an SSD1306 0.42 72x40 display, initially tried with the Adafruit SSD1306 library, but then found a custom library from an OLED manufacturer in China that works. Really want to use U8G2 on the display though!

Any plans on adding support for this display soon?

MadhavL commented 4 years ago

Hi, Yes I actually did both just to see which would be the most sensible starting point and ended up using ssd1306 64x32 with some override commands in the main sketch (just raw wire.writes) so that I didn't need to change the libs at all. With this display module there is one BIG issue. There is no external IREF so using any of the popular SSD1306 libs will produce a very dim display. During the init phase we need to send: Command 0xAD //IREF mode Command 0x30// 0=External ...or b00110000=Internal where A[4] sets internal mode and A[5] sets the current reference to 19uA or 30uA giving 150uA and 240uA segment currents respectively. The display is really bright at 240uA with a good diming range from the contrast control. None of the libraries I've looked at cater for this - maybe because this feature is only documented in SSD1306B v1.1 data sheet and not in SSD1306 v1. Another oled which will soon be hitting ebay/ ali etc in module form (I have a man on the inside!) is the SSD1306 72x32 0.41". I've ordered a few of the bare screens to mount to a custom pcb and will experiment and compare. There is also a SSD1331 64x64 colour oled which I'm going to try - not found a mounted version of this yet so may have to build this too. I'm a huge fan of your work. Many Thanks Nick On Fri, Nov 15, 2019 at 6:43 PM olikraus @.***> wrote: Any reason why you have modified the SH1106 code? Shouldn't it be SSD1306 code instead? Can you share your modifications? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#1047?email_source=notifications&email_token=AKUUVMOCXM5MX4UBCJM4GVDQT3UUZA5CNFSM4JNZNH4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEGLHFQ#issuecomment-554480534>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKUUVMIP6356DF3TSFVJM6DQT3UUZANCNFSM4JNZNH4A .

Hi @nikthefix , greetings from India!

Just asking for some friendly advice. What's the best way to proceed with an SSD1306 72X40 display? I've assembled it onto a custom PCB. We're building a smart glass for people with disabilities!

Also, I did notice that the display is quite dim compared to other displays. Could you please elaborate a bit on how to fix that (I'm not extremely proficient at Arduino/libraries/hardware displays, but might be able to figure this out with some guidance from you)

Thanks so much! Madhav

olikraus commented 4 years ago

The display didn't reach my lab until now. It usually takes more than 20 days for parts from far East to reach Europe.

olikraus commented 4 years ago

You won't believe, I just checked my mail (for sure I check it every day), so this little thing reached me today morning: IMG_20191203_173436383

As usualy buydisplay added a nice huge paper box around it, probably 20 times too large, but obviously perfectly protected for a long journey.

nikthefix commented 4 years ago

Hi Madhav,

All you need to do to get the higher brightness is add two commands to the display init routine in whichever library you are using.

0xAD //iref 0x30 //set to internal ref @240uA

You can add these in the library at the location where the multiplex ratio is set.

See the attached examples which I can confirm work correctly with this display (both spi and i2c versions provided). ER-OLEDM0.42-1_Arduino_Tutorial.zip

MadhavL commented 4 years ago

Haha what an absolute coincidence!!

Can't believe it.

Look forward to you testing it out :))

Hope to hear from you on updates soon.

Best, Madhav

On Tue, Dec 3, 2019, 10:13 PM olikraus notifications@github.com wrote:

You won't believe, I just checked my mail (for sure I check it every day), so this little thing reached me today morning: [image: IMG_20191203_173436383] https://user-images.githubusercontent.com/1084992/70070575-27134800-15f4-11ea-90c6-b0d55b8ae6b6.jpg

As usualy buydisplay added a nice huge paper box around it, probably 20 times to large, but obviously perfectly protected for a long journey.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/olikraus/u8g2/issues/1047?email_source=notifications&email_token=AEW4NWNTDEVBTYY3K6LLSQ3QW2EC3A5CNFSM4JNZNH4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF2AVJQ#issuecomment-561253030, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEW4NWPWAHORPGLETWEDOK3QW2EC3ANCNFSM4JNZNH4A .

olikraus commented 4 years ago

All the constructors are there, but i will add the HW_I2C constructors to the examples only...

U8G2_SSD1306_72X40_ER_F_HW_I2C
U8G2_SSD1306_72X40_ER_1_HW_I2C
U8X8_SSD1306_72X40_ER_HW_I2C 
MadhavL commented 4 years ago

Is it possible to add SPI support?

Hardware and software SPI?

Thanks for such quick responses. Really a fan of all your work

On Wed, Dec 4, 2019, 1:10 AM olikraus notifications@github.com wrote:

All the constructors are there, but i will add the HW_I2C constructors to the examples only...

U8G2_SSD1306_72X40_ER_F_HW_I2C U8G2_SSD1306_72X40_ER_1_HW_I2C U8X8_SSD1306_72X40_ER_HW_I2C

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/olikraus/u8g2/issues/1047?email_source=notifications&email_token=AEW4NWJ3UOMSRB7Z7QXIL6LQW2YZ5A5CNFSM4JNZNH4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF2SDPI#issuecomment-561324477, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEW4NWOPMVXCHLUWQBVZY7TQW2YZ5ANCNFSM4JNZNH4A .

v1993 commented 4 years ago

@epicboss200 I might be wrong, but for me it looks like display olikraus got have no SPI support based on available pins.

olikraus commented 4 years ago

@epicboss200 I might be wrong, but for me it looks like display olikraus got have no SPI support based on available pins.

True, but the SPI constructors are automatically generated.

olikraus commented 4 years ago

The SPI constructors are documented here: https://github.com/olikraus/u8g2/wiki/u8g2setupcpp#ssd1306-72x40_er

MadhavL commented 4 years ago

Yes, I see Olikraus display doesn't have SPI pins, but there are several modules/displays with this resolution that do. I have a 0.42 72*40 SSD1306 with SPI.

Are you saying that if I call the constructor for I2C you mentioned above, the SPI constructors are generated?

On Wed, Dec 4, 2019, 2:13 AM olikraus notifications@github.com wrote:

@epicboss200 https://github.com/epicboss200 I might be wrong, but for me it looks like display olikraus got have no SPI support based on available pins.

True, but the SPI constructors are automatically generated.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/olikraus/u8g2/issues/1047?email_source=notifications&email_token=AEW4NWIUXJFTBUSL4UBCYUTQW3AIVA5CNFSM4JNZNH4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF2YBAQ#issuecomment-561348738, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEW4NWN6XAVJD7DUPCCSFCLQW3AIVANCNFSM4JNZNH4A .

olikraus commented 4 years ago

Gallery entry: https://github.com/olikraus/u8g2/wiki/gallery#3-dec-2019-ssd1306-72x40-042-oled

the SPI constructors are generated?

of course... : https://github.com/olikraus/u8g2/commit/00ad8eaa91ca4007a970e51bba097866699ba838

olikraus commented 4 years ago

Thanks a lot for pointing out this new display. I really like this small but active display community :-)

I have created beta 2.27.3 with support for the above mentioned display (I2C and SPI interfaces!)

You can download the latest U8g2 beta release from here: https://github.com/olikraus/U8g2_Arduino/archive/master.zip

  1. Remove the existing U8g2_Arduino library (https://stackoverflow.com/questions/16752806/how-do-i-remove-a-library-from-the-arduino-environment)
  2. Install the U8g2_Arduino Zip file via Arduino IDE, add zip library menu (https://www.arduino.cc/en/Guide/Libraries).
olikraus commented 4 years ago

Hmm... I think there is an issue with large wiki pages:

The wiki page took too long to render. Please edit this wiki page’s content so it renders faster.

https://github.com/olikraus/u8g2/wiki/u8g2setupcpp will not load at the moment.

--> modified the format, seems to work again

MadhavL commented 4 years ago

Great work, Olikraus!

I'm going to have some fun with this library on these new displays, will let you know how it goes!

Honestly, OLED displays are super interesting to me because of the vast possibilities. I think Nick has some good inside information on new oleds :)

On Wed, Dec 4, 2019, 2:42 AM olikraus notifications@github.com wrote:

Hmm... I think there is an issue with large wiki pages:

The wiki page took too long to render. Please edit this wiki page’s content so it renders faster.

https://github.com/olikraus/u8g2/wiki/u8g2setupcpp will not load at the moment.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/olikraus/u8g2/issues/1047?email_source=notifications&email_token=AEW4NWJYQZPVPJFV7L3NPRDQW3DTLA5CNFSM4JNZNH4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF22QWY#issuecomment-561358939, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEW4NWOO5G3NZGFCWTU5FCLQW3DTLANCNFSM4JNZNH4A .

MadhavL commented 4 years ago

Hi Nick,

Thanks so much for the help!

Thanks also for the library and example :)

I'm going to explore this and let you know if I have any questions/issues.

Thanks, Madhav

Tue, Dec 3, 2019, 10:47 PM nikthefix notifications@github.com wrote:

Hi Madhav,

All you need to do to get the higher brightness is add two commands to the display init routine in whichever library you are using.

0xAD //iref 0x30 //set to internal ref @240uA

You can add these in the library at the location where the multiplex ratio is set.

See the attached examples which I can confirm work correctly with this display (both spi and i2c versions provided). ER-OLEDM0.42-1_Arduino_Tutorial.zip https://github.com/olikraus/u8g2/files/3917804/ER-OLEDM0.42-1_Arduino_Tutorial.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/olikraus/u8g2/issues/1047?email_source=notifications&email_token=AEW4NWLQCI6SJ6LCFUEFWSTQW2IA7A5CNFSM4JNZNH4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF2EJJQ#issuecomment-561267878, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEW4NWLPNWPQS6WD72S3IU3QW2IA7ANCNFSM4JNZNH4A .

MadhavL commented 4 years ago

Hi Madhav,

All you need to do to get the higher brightness is add two commands to the display init routine in whichever library you are using.

0xAD //iref 0x30 //set to internal ref @240uA

You can add these in the library at the location where the multiplex ratio is set.

See the attached examples which I can confirm work correctly with this display (both spi and i2c versions provided). ER-OLEDM0.42-1_Arduino_Tutorial.zip

Hi @nikthefix

I had already tried this library (found it from ERs display product page on BuyDisplay). I can see in the library cpp file that these hex commands are already there. However, my display has the same brightness with this library/initialization commands.. There's no difference.

I am running the OLED soldered onto on a custom PCB without an external IREF.

Are you sure these commands are correct? I saw the command table in the datasheet, and found external/internal IREF setting hex AD, but couldn't find commands to set A[5] such that Iseg is 240uA.

Can you help me out here?

Are the commands correct for setting IREF internal mode and setting IREF such that ISEG is set to 240uA max?

Command 0xAD //IREF mode Command 0x30// 0=External ...or b00110000=Internal where A[4] sets internal mode and A[5] sets the current reference to 19uA or 30uA giving 150uA and 240uA segment currents respectively. The display is really bright at 240uA with a good diming range from the contrast control.

nikthefix commented 4 years ago

Bit 5 of the 2nd byte sets the internal current reference value so:

0x30 = internal / 240uA (b00110000) 0x10= internal / 150uA (b00010000)

Have you tried changing the Vcom Deselect level (absolutely not necessary with the above mentioned module but a useful experiment perhaps)

0xDB 0x20 - power on default - 77% of vcc

try

0xDB 0x30 - 83% of vcc

Changing either of these settings should make a clear difference. If not then perhaps you could upload a schematic of your carrier board. Are unused pins tied according to the datasheet where indicated? How does your board differ from the ER-OLEDM0 if at all? Decoupling of power? Are you powering 3.3v or 5v thru a regulator? If using SPI is there anything else sharing the bus? Charge pump functioning?

I have this display (both the module and bare display soldered to FFC adapter and breadboarded) working as brightly if not brighter than my other 128x64 ssd1306 displays using these int codes. The data sheet stipulates that these settings should be transmitted with the display in sleep mode (Display Off Command - Init codes - Display On Command).

I can't think of any other likely culprits but please report back with your findings.

Nick

On Wed, Dec 4, 2019 at 6:50 AM epicboss200 notifications@github.com wrote:

Hi Madhav,

All you need to do to get the higher brightness is add two commands to the display init routine in whichever library you are using.

0xAD //iref 0x30 //set to internal ref @240uA

You can add these in the library at the location where the multiplex ratio is set.

See the attached examples which I can confirm work correctly with this display (both spi and i2c versions provided). ER-OLEDM0.42-1_Arduino_Tutorial.zip https://github.com/olikraus/u8g2/files/3917804/ER-OLEDM0.42-1_Arduino_Tutorial.zip

Hi @nikthefix https://github.com/nikthefix

I had already tried this library (found it from ERs display product page on BuyDisplay). I can see in the library cpp file that these hex commands are already there. However, my display has the same brightness with this library/initialization commands.. There's no difference.

I am running the OLED soldered onto on a custom PCB without an external IREF.

Are you sure these commands are correct? I saw the command table in the datasheet, and found external/internal IREF setting hex AD, but couldn't find commands to set A[5] such that Iseg is 240uA.

Can you help me out here?

Are the commands correct for setting IREF internal mode and setting IREF such that ISEG is set to 240uA max?

Command 0xAD //IREF mode Command 0x30// 0=External ...or b00110000=Internal where A[4] sets internal mode and A[5] sets the current reference to 19uA or 30uA giving 150uA and 240uA segment currents respectively. The display is really bright at 240uA with a good diming range from the contrast control.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/olikraus/u8g2/issues/1047?email_source=notifications&email_token=AKUUVMKXTBKWEN6VQBSOWMLQW5HMRA5CNFSM4JNZNH4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF353EA#issuecomment-561503632, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKUUVMOWHLDJDJ53ATRG34TQW5HMRANCNFSM4JNZNH4A .

nikthefix commented 4 years ago

BTW Madhav,

Have you checked this display out?

https://www.aliexpress.com/item/4000245224527.html?spm=a2g0o.productlist.0.0.3c843964tCSVGS&algo_pvid=d8615d5c-d08a-4176-910c-ed32b1cdb97e&algo_expid=d8615d5c-d08a-4176-910c-ed32b1cdb97e-17&btsid=1757c05f-2128-423b-b6be-5e9e988dc216&ws_ab_test=searchweb0_0,searchweb201602_5,searchweb201603_52

1024×768 Colour 0.5" !!!

Expensive but for your HUD / smart glasses could make a good MK2.