Coder Social home page Coder Social logo

Brightness level about stc_diyclock HOT 7 CLOSED

zerog2k avatar zerog2k commented on May 31, 2024
Brightness level

from stc_diyclock.

Comments (7)

zerog2k avatar zerog2k commented on May 31, 2024 1

Ok apologies, I think I was looking at that ISR conditional wrongly.
I think this is the proper place to look for dimming:
https://github.com/zerog2k/stc_diyclock/blob/master/src/main.c#L491-L500
note that we are decimating the raw adc value from 8 to 5 bits
so from 256-0 (darkest to brightest) mapped to 32-0

I think this lightval acts sort of like a variable denominator in the fraction of duty cycle of led lighting. Larger denominator, shorter duty cycle; smaller denominator, longer duty cycle.

So perhaps try changing
lightval = getADCResult8(ADC_LIGHT) >> 3; to
lightval = getADCResult8(ADC_LIGHT) >> 2;
such that it's bottom range is 64 (darkest) instead of 32

from stc_diyclock.

zerog2k avatar zerog2k commented on May 31, 2024 1

You can try it and let me know how well it works.

from stc_diyclock.

zerog2k avatar zerog2k commented on May 31, 2024

The dimming is controlled somewhat creatively to get around some limitations (like running in ISR)- controlled here:
https://github.com/zerog2k/stc_diyclock/blob/master/src/main.c#L234

    if (displaycounter % lightval < 4 ) {

you can try playing around with different values (instead of 4), like 3?
from memory, lightval is raw ldr circuit adc values, and (I think?) it should be from 0-1023, and decrease (toward zero) when bright, and increase (toward 1023) when dark ?
this number here is trying to divide the raw adc lightval such that it skips lighting when displaycounter % (lightval < 4) == 0 if that's helpful

I don't have a way to test currently, but you can play around with this, and build/upload using platformio pretty easily

from stc_diyclock.

in-sympathy avatar in-sympathy commented on May 31, 2024

thanks, but it doesn't work:

setting if (displaycounter % lightval < 3 ) {

would lead to weird display refresh misbehavior, especially with the 4th digit

any other ideas on how to make the brightness level in the dark as low as possible?

from stc_diyclock.

in-sympathy avatar in-sympathy commented on May 31, 2024

thanks a lot, this seems to be doing the trick. would setting the value to 1 make it even darker then?

from stc_diyclock.

in-sympathy avatar in-sympathy commented on May 31, 2024

Sounds like a plan- did just that and pretty happy with the results - the display is now a tad dim for some, but should not be a distraction at night anymore, so I guess mission accomplished - thank you so much for your help and for this awesome firmware 🙏🏻👍🏻

from stc_diyclock.

p23f avatar p23f commented on May 31, 2024

I solved the brightness problem by 3d printing a thin 0.6mm thick screen to fit in the bottom of the acrylic case to cover the leds.

from stc_diyclock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.