Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for 64x48 OLED Display #42

Closed
csskevin opened this issue Mar 29, 2017 · 21 comments
Closed

Support for 64x48 OLED Display #42

csskevin opened this issue Mar 29, 2017 · 21 comments

Comments

@csskevin
Copy link

Hello,
Would it be possible to add a support for a 64x48 OLED display. I do not have much experience here. Can I add it manual?
Thanks

@thijstriemstra
Copy link
Collaborator

@csskevin do you have a link to the ebay/product page and/or datasheet of the device?

@csskevin
Copy link
Author

Bought it through amazon. The contributer link https://www.wemos.cc/product/oled-shield.html

@thijstriemstra
Copy link
Collaborator

Have you tested it with the luma.examples? Can you try this command:

python examples/starfield.py --display ssd1306 --width 64 --height 48 --interface i2c

@csskevin
Copy link
Author

csskevin commented Mar 29, 2017

There I get following error:
starfield.py: error: Unsupported display mode: 64 x 48

@rm-hull
Copy link
Owner

rm-hull commented Mar 29, 2017

The good news is that it should work with a small fix, but presently won't work as-is. The device only supports certain modes - see https://github.com/rm-hull/luma.oled/blob/master/luma/oled/device.py#L124-L129

To make it work we would need to find out the correct values for the multiplex and clock divider, and add an entry like:

(64, 48): dict(multiplex=???, displayclockdiv=???, compins=???)

@csskevin I will have a look at the datasheet and see if we can suggest some values for you to try, how does that sound?

@thijstriemstra
Copy link
Collaborator

thijstriemstra commented Mar 29, 2017

ok. start a python console:

$ python

And type:

from luma.oled import device
device

This should print the path of the oled module, e.g.

>>> from luma.oled import device
>>> device
<module 'luma.oled.device' from '/home/me/projects/bar/src/luma.oled/luma/oled/device.py'>
>>> 

Now open /home/me/projects/bar/src/luma.oled/luma/oled/device.py with a text editor
and look for:

# Supported modes
settings = {
    (128, 64): dict(multiplex=0x3F, displayclockdiv=0x80, compins=0x12),
    (128, 32): dict(multiplex=0x1F, displayclockdiv=0x80, compins=0x02),
    (96, 16): dict(multiplex=0x0F, displayclockdiv=0x60, compins=0x02)
}.get((width, height))

Change this so it looks like:

# Supported modes
settings = {
    (128, 64): dict(multiplex=0x3F, displayclockdiv=0x80, compins=0x12),
    (128, 32): dict(multiplex=0x1F, displayclockdiv=0x80, compins=0x02),
    (96, 16): dict(multiplex=0x0F, displayclockdiv=0x60, compins=0x02),
    (64, 48): dict(multiplex=0x0F, displayclockdiv=0x60, compins=0x02)
}.get((width, height))

And try again.. (@rm-hull this is safe to do right? :)

@thijstriemstra thijstriemstra changed the title [Question] Support for 64x48 OLED Display? Support for 64x48 OLED Display Mar 29, 2017
@csskevin
Copy link
Author

csskevin commented Mar 29, 2017

@rm-hull This would sound perfect. Thanks very much

@thijstriemstra Thank you, the 64 x 48 width and height works, but the dimensions are not working properly. I see just a part. (I see a part from right top I think)

@thijstriemstra
Copy link
Collaborator

@csskevin can you post a picture?

@csskevin
Copy link
Author

Sorry fot the bad image quality. I started the demo.py, because on the startfield.py I see just dots.

img_20170329_225428313

@thijstriemstra
Copy link
Collaborator

no worries, thanks for posting. Hopefully @rm-hull can find the correct values for that line and it should be working ok.

@csskevin
Copy link
Author

Thank you both very much and thanks for the fast help.

@rm-hull
Copy link
Owner

rm-hull commented Mar 29, 2017

Try:

(64, 48): dict(multiplex=0x2F, displayclockdiv=0x80, compins=0x12)

If you are going to test it, please use

$ python examples/demo.py --display ssd1306 --width 64 --height 48 --interface i2c

It should look like this:

luma_000001

You can't tell from the screengrab but there should be white outline around the shapes

@csskevin
Copy link
Author

csskevin commented Mar 29, 2017

Thank you it got better

img_20170329_230929196

@rm-hull
Copy link
Owner

rm-hull commented Mar 29, 2017

Can you alter your local copy of https://github.com/rm-hull/luma.oled/blob/master/luma/oled/device.py#L171 to read:

self._const.COLUMNADDR, 0x20, 0x5F,

See what happens?

@csskevin
Copy link
Author

Thank you very very much, it works perfectly now

@rm-hull
Copy link
Owner

rm-hull commented Mar 29, 2017

Ok, so thats great. I'll roll out a fix for the general case, but I dont think we ever tested it for a 96x16 device - did you @thijstriemstra ? I suspect that never worked properly for the same reason the 64x48 didnt .. :-s

@rm-hull
Copy link
Owner

rm-hull commented Mar 29, 2017

See rm-hull/luma.oled#144

@thijstriemstra
Copy link
Collaborator

thijstriemstra commented Mar 29, 2017

I couldn't find the ticket for 96x16 other than a really old one that relates to the previous codebase, so I think you're right @rm-hull.

@thijstriemstra
Copy link
Collaborator

Smallest OLED I tested: rm-hull/luma.oled#23 (128x32)

@rm-hull
Copy link
Owner

rm-hull commented Mar 30, 2017

@csskevin can you upgrade to luma.oled 2.2.6 please and let me know if that fixes it for you? use sudo -H pip install --upgrade luma.oled

If so please close the ticket :-)

@csskevin
Copy link
Author

Thanks for your great support. It works perfectly :) 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants