How can I control the screen brightness with PWM output?

Post Reply
jorini
Posts: 8
Joined: Fri Jan 31, 2020 9:44 pm
languages_spoken: english
ODROIDs: ODROID-C2 and C4
Has thanked: 5 times
Been thanked: 0
Contact:

How can I control the screen brightness with PWM output?

Post by jorini »

Hi,

With my Odroid-C4, I am controlling a screen through HDMI interface with Android OS. Additionally, this screen has a PWM input to control the brightness, which I want to use.

What PWM output from the Odroid-C4 should I use for screen brightness control? How will I have to configure my OS-Android for the brightness control to work?

Thanks you

User avatar
mctom
Posts: 579
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: N2+, Game Advance, a few XU4
Location: Gdansk, Poland
Has thanked: 54 times
Been thanked: 60 times
Contact:

Re: How can I control the screen brightness with PWM output?

Post by mctom »

Hi!
Tell us more about the screen you have (Brand / model/ manual / where did you read about its PWM input)
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
mad_ady
Posts: 9823
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 617 times
Been thanked: 745 times
Contact:

Re: How can I control the screen brightness with PWM output?

Post by mad_ady »

User joerg had some changes to android to allow him to control brightness through a hardware pwm.

User avatar
odroid
Site Admin
Posts: 38212
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2068 times
Been thanked: 1238 times
Contact:

Re: How can I control the screen brightness with PWM output?

Post by odroid »

https://wiki.odroid.com/accessory/displ ... th_android
But, we might need to check the functionality with C4 Android OS.

User avatar
joerg
Posts: 1406
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 96 times
Been thanked: 220 times
Contact:

Re: How can I control the screen brightness with PWM output?

Post by joerg »

I can help, but actually I am away from home. At weekend I will have some time. I remember that in source code of lights pwmchip4 ist used. So with overlay pwm_ef the chip should be enabled.

User avatar
odroid
Site Admin
Posts: 38212
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2068 times
Been thanked: 1238 times
Contact:

Re: How can I control the screen brightness with PWM output?

Post by odroid »

We can test it soon.
If it doesn't work, we might need a couple of days to implement the driver.

User avatar
codewalker
Posts: 1382
Joined: Mon Feb 25, 2013 11:03 am
languages_spoken: english
ODROIDs: all
Has thanked: 61 times
Been thanked: 101 times
Contact:

Re: How can I control the screen brightness with PWM output?

Post by codewalker »

I've changed lights library to enable the PWM control. A new update image will be ready soon.
https://github.com/codewalkerster/andro ... c1a378d745

User avatar
codewalker
Posts: 1382
Joined: Mon Feb 25, 2013 11:03 am
languages_spoken: english
ODROIDs: all
Has thanked: 61 times
Been thanked: 101 times
Contact:

Re: How can I control the screen brightness with PWM output?

Post by codewalker »

These users thanked the author codewalker for the post:
jorini (Mon Oct 04, 2021 5:57 pm)

User avatar
odroid
Site Admin
Posts: 38212
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2068 times
Been thanked: 1238 times
Contact:

Re: How can I control the screen brightness with PWM output?

Post by odroid »

These users thanked the author odroid for the post:
jorini (Mon Oct 04, 2021 5:57 pm)

jorini
Posts: 8
Joined: Fri Jan 31, 2020 9:44 pm
languages_spoken: english
ODROIDs: ODROID-C2 and C4
Has thanked: 5 times
Been thanked: 0
Contact:

Re: How can I control the screen brightness with PWM output?

Post by jorini »

Hi,
Checking the PWM output, I see that the output frequency is 1KHz.

How could I modify this frequency to be 60KHz? I use a screen that needs a 60KHz PWM input.

Thanks you.

User avatar
joerg
Posts: 1406
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 96 times
Been thanked: 220 times
Contact:

Re: How can I control the screen brightness with PWM output?

Post by joerg »

This is hard-coded in the driver:
https://github.com/codewalkerster/andro ... hts.c#L125
The driver need to be modified to fulfill your needs.
BTW. Can you give a link to the screen that needs 60kHz pwm?
These users thanked the author joerg for the post (total 2):
odroid (Tue Oct 05, 2021 10:43 am) • jorini (Wed Oct 06, 2021 5:16 pm)

jorini
Posts: 8
Joined: Fri Jan 31, 2020 9:44 pm
languages_spoken: english
ODROIDs: ODROID-C2 and C4
Has thanked: 5 times
Been thanked: 0
Contact:

Re: How can I control the screen brightness with PWM output?

Post by jorini »

Thanks. Now, I will try to compile the image with your modification. It is the first time that I do it, and I do not know the difficulty.

On the screen, I use the powertip model PH102600T009-IBC21.
joerg wrote:
Tue Oct 05, 2021 12:23 am
This is hard-coded in the driver:
https://github.com/codewalkerster/andro ... hts.c#L125
The driver need to be modified to fulfill your needs.
BTW. Can you give a link to the screen that needs 60kHz pwm?

User avatar
joerg
Posts: 1406
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 96 times
Been thanked: 220 times
Contact:

Re: How can I control the screen brightness with PWM output?

Post by joerg »

I use the powertip model PH102600T009-IBC21.
I can't find this in the www. Is this a lvds display and you use another hdmi to lvds converter board for for connecting to C4?

jorini
Posts: 8
Joined: Fri Jan 31, 2020 9:44 pm
languages_spoken: english
ODROIDs: ODROID-C2 and C4
Has thanked: 5 times
Been thanked: 0
Contact:

Re: How can I control the screen brightness with PWM output?

Post by jorini »

Hi,

You can search PH102600T009, and you will find similar models. All of them have HDMI input. The IBC21 version is a customized model with integrated touch and powered with 12V.

Thanks.
joerg wrote:
Tue Oct 05, 2021 9:39 pm
I use the powertip model PH102600T009-IBC21.
I can't find this in the www. Is this a lvds display and you use another hdmi to lvds converter board for for connecting to C4?

jorini
Posts: 8
Joined: Fri Jan 31, 2020 9:44 pm
languages_spoken: english
ODROIDs: ODROID-C2 and C4
Has thanked: 5 times
Been thanked: 0
Contact:

Re: How can I control the screen brightness with PWM output?

Post by jorini »

joerg wrote:
Tue Oct 05, 2021 12:23 am
This is hard-coded in the driver:
https://github.com/codewalkerster/andro ... hts.c#L125
The driver need to be modified to fulfill your needs.
BTW. Can you give a link to the screen that needs 60kHz pwm?
Hi,

Analyzing the PWM output of the electronics, I see that the duty cycle is not proportional to the brightness bar of the Android. I get the following values:
- Android brightness bar at minimum >> duty cycle = 3.6%
- Android brightness bar at 25% >> duty cycle = 6.3%
- Android brightness bar at 50% >> duty cycle = 11.4%
- Android brightness bar at 75% >> duty cycle = 27.2%
- Android brightness bar at maximum >> duty cycle = 93.7%

How could you correct this behavior to be linear?

Thanks you.

User avatar
mctom
Posts: 579
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: N2+, Game Advance, a few XU4
Location: Gdansk, Poland
Has thanked: 54 times
Been thanked: 60 times
Contact:

Re: How can I control the screen brightness with PWM output?

Post by mctom »

This is correct. The PWM duty cycle is not supposed to be linear, because human eyes do not perceive brightness in linear fashion.
All displays do exactly the same thing, and some people call it gamma correction, although the correct technical term is different (and I don't remember what that was).

My PiStackMon also does the same thing for LED driving. It is common to take demanded percentage value and do x^2.8 on it.
So for 50% you'd get 14,35%
or for 75% you'd get 44,6%.

Obviously they use some other algorithm, but the point is the same. :)
These users thanked the author mctom for the post (total 3):
joerg (Tue Oct 26, 2021 5:14 pm) • jorini (Tue Oct 26, 2021 6:16 pm) • odroid (Wed Oct 27, 2021 9:45 am)
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

jorini
Posts: 8
Joined: Fri Jan 31, 2020 9:44 pm
languages_spoken: english
ODROIDs: ODROID-C2 and C4
Has thanked: 5 times
Been thanked: 0
Contact:

Re: How can I control the screen brightness with PWM output?

Post by jorini »

OK! Thanks you!

Post Reply

Return to “Android”

Who is online

Users browsing this forum: No registered users and 0 guests