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

Oled low brightness. #16

Open
usstrike opened this issue May 12, 2019 · 12 comments
Open

Oled low brightness. #16

usstrike opened this issue May 12, 2019 · 12 comments
Labels
enhancement New feature or request

Comments

@usstrike
Copy link

Is it possible to adjust the brightness of the screen?

@antiprism
Copy link
Owner

Hi

There is no mpd_oled option to control the brightness.

From a quick search, I am unsure if it is possible to implement this properly in software. There appears to be a command for SSD1306 to control contrast, but it seems that it only has a limitted effect on brightness, and the full brightnes range involves a variable resistor (maybe a variable resistor on its own is enough).

There are some interesting threads here
https://forum.arduino.cc/index.php?topic=515370.0
https://forums.adafruit.com/viewtopic.php?f=47&t=38569

Adrian.

@arthurlutz
Copy link

I've managed to see dimming oled using https://flows.nodered.org/node/node-red-contrib-oled (with the "Dimmed" block). Down under it is a javascript library : https://github.com/baltazorr/oled-i2c-bus/blob/master/oled.js#L340

@antiprism
Copy link
Owner

Hi Arthur

The javascript code refers to "contrast", so I imagine this works the same way as the dimming function included in the mpd_oled OLED driver code, in which case setting the contrast to 0 in mpd_oled might work to dim an SSD1306 screen.

I have ordered an SSD1306 screen so I should be able to test this soon.

Adrian.

@supercrab
Copy link

I've noticed during testing that setting some of the OLED types gives differing brightness values. I think there's a command and some data that gets sent to the screen during initialisation that could be used to support this.

i'll do some digging.

@antiprism
Copy link
Owner

Hi Mase

Thanks for looking at this. I am in the processes of changing mpd_oled to use the U8g2 library, and this provides a setContrast function

https://github.com/olikraus/u8g2/wiki/u8g2reference#setcontrast

I imagine it will do all that can be done in software to change the brightness. I will add an option for it.

Adrian.

@supercrab
Copy link

U8g2 is great, the only trouble is that it takes a while to compile. Have you considered compiling on a non Pi and dropping the binary over?

Anyway, I found it. It's in ArduiPi_OLED.cpp:667 there is a method to set the brightness void ArduiPi_OLED::setBrightness(uint8_t Brightness)

I might implement this in my older branch, if I get time.

@supercrab
Copy link

Bah, I tested this but it made no difference to the brightness :(

1 similar comment
@supercrab
Copy link

Bah, I tested this but it made no difference to the brightness :(

@antiprism
Copy link
Owner

Hi Mase

The total build time for U8g2 library is less than 10 minutes on a Pi Zero, which isn't too bad, but it doesn't really affect development time as once it has been built mpd_oled just links to it.

I have sometimes cross-compiled on the Pi 4 and copied the binary over to the Pi Zero to test, but usually for bigger changes I write the code on the Pi 4, but only to ensure a successful build, and then copy over the code to the Pi Zero and change it there to make it work.

The brightness function may work for the SSD1306, but I don't think you can change the brightness of the SSH1106 using software.

Adrian.

@supercrab
Copy link

OK brightness has no effect but precharge setting like you suggested in your links does work :)

@supercrab
Copy link

Where there is a SSD1306_Set_Precharge_Period command the value after defines the brightness 0 - 34

@supercrab
Copy link

supercrab commented Mar 11, 2021

@arthurlutz I have implemented contrast and pre charge period control in my fork of mpd_oled.

I did this as an experiment for testing purposes but works pre charge is -e 0-34and brightness is-t 0-255`

https://github.com/supercrab/mpd_oled

@antiprism antiprism added the enhancement New feature or request label Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants