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

Initial support for SSD1306 128x32 or 128x64 OLED displays #312

Merged
merged 2 commits into from
Aug 6, 2022

Conversation

diyelectromusic
Copy link
Contributor

Initial support for SSD1306 OLED I2C displays. Note: This requires latest develop branch of Circle.

Submitted for experimentation and initial testing. All comments welcome!

Kevin

@probonopd
Copy link
Owner

Like these?

image

@diyelectromusic
Copy link
Contributor Author

Like these?

image

Yep. And the squarer ones that are double height (although they aren't used to their best).

But as I say we'll need to move to a newer version of the develop branch on Circle.

@diyelectromusic
Copy link
Contributor Author

Yes that failure is due to the wrong version of Circle, but I don't really know how to update that...

@probonopd
Copy link
Owner

probonopd commented Jul 17, 2022

Yes that failure is due to the wrong version of Circle, but I don't really know how to update that...

The "proper way" in Git would go somewhat like this: https://github.com/probonopd/MiniDexed/wiki/Development#updating-synth_dexed-git-submodule.

But here the issue is that if we want to update circle, which is referenced by Synth_Dexed, so we'd need to fork Synth_Dexed to do it the "proper way". Hence I am doing it differently, "on the fly", which means that we don't need to fork the Synth_Dexed repo:

diyelectromusic@a57c5b6

@probonopd
Copy link
Owner

probonopd commented Jul 17, 2022

Do you see any chance we might be able to display the algorithms on the (small) display? Maybe once you are in the algorithm selection menu and while you are rotating the knob, use the full screen to display just the selected algorithm, similar to

image

Source: https://www.youtube.com/watch?v=_BwTXK8seks

if space is not sufficient, then maybe use symbols similar to the Korg opsix (but rotate the algorithm diagram by 90 degrees):

image

Source: https://www.deepsonic.ch/deep/docs_manuals/korg_opsix_manual_e2.pdf

@probonopd
Copy link
Owner

Does MiniDexed_2022-07-17-606a92b work for you?

@diyelectromusic
Copy link
Contributor Author

diyelectromusic commented Jul 17, 2022

Do you see any chance we might be able to display the algorithms on the (small) display? (...)

Not at the moment, no, as the support in circle just mirrors the "character mode" of the HD44780 - it isn't an actual graphics mode. I went this was as all your menu handling assumes all those "special" control characters and a textual display too...

But eventually I know there is interest in "proper" graphics in circle so it might be possible, but then you'd have to re-write whole chunks of your UI to match...

@probonopd
Copy link
Owner

probonopd commented Jul 17, 2022

Yes, what I mean is to use character mode everywhere and just switch to graphics mode while oen is selecting algorithms. Is that possible? I was hoping this would require the smallest change.

@probonopd
Copy link
Owner

probonopd commented Jul 17, 2022

With a display like this

image

# HD44780 LCD
LCDEnabled=1
LCDPinEnable=0
LCDPinRegisterSelect=0
LCDPinReadWrite=0
LCDPinData4=0
LCDPinData5=0
LCDPinData6=0
LCDPinData7=0
LCDI2CAddress=0x00

# SSD1306 LCD
# For a 128x32 display, set LCDColumns=20; LCDRows=2
# For a 128x64 display, set LCDColumns=20; LCDRows=4
SSD1306LCDI2CAddress=0x3c
SSD1306LCDWidth=128
SSD1306LCDHeight=64

# Default is 16x2 display (e.g. HD44780)
LCDColumns=20
LCDRows=4

I have it working on a 128x64 display, but strangely only every second row of pixels is used. This seems to be similar ThingPulse/esp8266-oled-ssd1306#179 where someone said "program looked at the wrong place where the 128 x 32 Pixel Display was still defined". Could it be that something similar is going on here?

What I am seeing on my MiniDexed display is basically this effect:

image

At http://forum.espruino.com/conversations/269330/ someone says that adding a 100ms delay before initialising the display helps, someone else says there are different types of displays which might require slightly differet initialization code.

@diyelectromusic
Copy link
Contributor Author

diyelectromusic commented Jul 18, 2022

I have it working on a 128x64 display, but strangely only every second row of pixels is used.

Hmm. That's what I was getting with LCDHeight=64 and LCDRows=2 (as I'd expect)... I was using one of these and 64/4 seemed to work for me, I'll take another look and make sure I've not spelled the option wrong or anything like that!

@diyelectromusic
Copy link
Contributor Author

This seems to be similar ThingPulse/esp8266-oled-ssd1306#179 where someone said "program looked at the wrong place where the 128 x 32 Pixel Display was still defined". Could it be that something similar is going on here?

Nothings impossible, but that reads like some hard-coding throughout, but I don't believe that is going on here... but will take another look.

At http://forum.espruino.com/conversations/269330/ someone says that adding a 100ms delay before initialising the display helps, someone else says there are different types of displays which might require slightly differet initialization code.

They are referring to the Adafruit SSD1306 driver which supports I2C, SPI or software SPI. This code only supports I2C. From what I can see, once the access method is set up, the actual initialisation of the SSD1306 appears the same, but feel free to correct me if I'm wrong...

I'll try to have a look with the new build later to see if I get the same.

@diyelectromusic
Copy link
Contributor Author

I'll try to have a look with the new build later to see if I get the same.

Well using that build you've linked to seems to work ok for me. With one of those 128x64 screens like the one you show, it works as follow for me:

  • Height=32; Rows=2 - this gives the pattern you show - the display is stretched vertically with every other row in use.
  • Height=64; Rows=2 - this only uses the top half of the screen with no gaps.
  • Height=64; Rows=4 - this also only uses the top half of the screen with no gaps.

So for me, actually rows=2 or 4 makes no difference, but Height=32 or 64 is the key.

Given all that, I'm not sure why yours isn't working...?

(there does seem to be a minor bug where the display goes a little odd on the first encoder click, but it sorts itself out with the second. Maybe there is some cursor initialisation/position thing missing... I'll have to have a look).

@diyelectromusic
Copy link
Contributor Author

Yes, what I mean is to use character mode everywhere and just switch to graphics mode while oen is selecting algorithms. Is that possible? I was hoping this would require the smallest change.

It would first require graphics support in circle, which doesn't exist for the SSD1306 I'm afraid.

@probonopd
Copy link
Owner

probonopd commented Jul 28, 2022

strangely only every second row of pixels is used

Possibly it was due to a faulty SSD1306, I can't say for sure. In any case, I managed to destroy my old module (probably due to a bad attempt at unsoldering the pin connector) (VCC-GND-SCL-SDA and non-switchable i2c address) and purchased a new one. The new one is slightly different (a bit smaller PCB; GND-VCC-SCL-SDA and switchable i2c addresses using a resistor) -- and it works flawless!

So with those "generic" modules, there seem to be different versions, both electrically and physically. Makes it a bit harder to write concise instructions (and model 3D files). Just one thing to be aware of.

@diyelectromusic
Copy link
Contributor Author

Yes, I've seen them with VCC/GND swapped and also with SDA/SCL swapped. Thankfully that doesn't affect the code though, it just means it's hard to draw wiring diagrams! :)

Glad its working!

@probonopd probonopd merged commit 768d763 into probonopd:main Aug 6, 2022
@probonopd
Copy link
Owner

Thank you very much @diyelectromusic. Have used it with success for a while now, merged!

@diyelectromusic diyelectromusic deleted the ssd1306new branch January 18, 2023 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants