aFewBits / stc-led-clock

Replacement firmware for STC 8051 based DIY LED clock kits
MIT License
54 stars 20 forks source link

Flickering display #12

Open antonioag95 opened 5 years ago

antonioag95 commented 5 years ago

I've recently flashed this firmware on a brand new chip and I noticed that depending on the light received by the photoresistor the display flickers. Is that the normal behaviour? In light and darkness circumstances it works fine, the problem only seems to occur - for example - on sunsets.

mars16 commented 5 years ago

I confirm that there is a twinkle in the twilight. I have a clock with green indicators and processor ..404AS With a minimum and maximum illumination flicker is not observed. Thank you for doing programs for these models of watches. I have a few suggestions that you might like: Display the days of the week with the numbers "-1-", "-2-", etc. Letters are not displayed correctly. Make a second delay before entering the menu to avoid accidental clicks. Duplicate the activated alarm with a dot in the lower right corner. Enter a programmable daily correction of time +/- 0.5-5 seconds, this model of the clock does not differ by the accuracy of the course :) I do not know how to write programs, but I will be glad if something from my wishes is useful to you. Thanks for attention!

aFewBits commented 5 years ago

Corrected possible issue with the range of aOnTicks variable that I believe is causing the flicker. I'll leave the issue open, please test the latest push and post your results.

Another thought - make sure that you flash the STC chip with the clock speed set to 22.184MHz. Using the default of 11.059 can cause a similar problem.

antonioag95 commented 5 years ago

Thank you for your quick support. I've tried it but the issue is still there. It looks like it is detecting an always different light level and it tries to dim. Again this problem occurs only in specific light condition.

Thank you for reminding to set the clock speed to 22.184, but it was already set to the correct value.

The command I use to flash the STC chip is:

stcgal -p /dev/ttyUSB0 -P stc15 -t 22184 main.hex

Maker39 commented 5 years ago

I saw the display flicker only when illuminated with a fluorescent lamp with electromagnetic ballast or a cheap LED lamp. The reason, as it seems to me, lies in the "fast" adjustment of the brightness of the clock. I like how quickly I change the brightness when turning off artificial lighting in the evening and when turned on at night. Probably attempts to “slow down” the automatic brightness adjustment programmatically will not be able to eliminate all possible beats with modern lighting.

denmmx commented 5 years ago

Have same issue with randomly flickering display at sunset time. 404AS chip, flashed with latest version at 22,184MHz, no fluorescent lamp/LED lamps illumination. Also no flickering in full darkness, only when low illumination around.

FLamorce commented 5 years ago

Corrected possible issue with the range of aOnTicks variable that I believe is causing the flicker. I'll leave the issue open, please test the latest push and post your results.

Another thought - make sure that you flash the STC chip with the clock speed set to 22.184MHz. Using the default of 11.059 can cause a similar problem.

I had the same problem, but after the Check MCU I saw it was 11.059 so I set it to that before flashing, and had the flickering. I reflashed it at 22.1184 and no flashing. Thanks a lot for the good work!

aFewBits commented 5 years ago

Would someone please measure the analog voltage at the junction of the LDR and 10K resistor when the clock is flickering? This will be the analog voltage read by the STC chip which is inverted and used to control the brightness. I would expect it would be close to 5V at full darkness. Since the input is ratiometric to the 5V supply, please measure the supply voltage and provide that as well since that would be the voltage required for full scale analog input.

After measuring the LDR/10K with your meter on the DC range, switch it to AC and make the same measurement a second time. If you measure an AC voltage, the LDR is indeed fast enough to react to the 50/60HZ of the mains voltage powering the light. You can measure this with an oscilloscope if you have one as this will be more informative than a meter reading.

Please post any responses here.

antonioag95 commented 5 years ago

Voltage from USB power source: 5.04V

LDR/10K DC while flickering: between 4.00V and 4.10V but also > 4.70V (it is more visible at this point)

I assure you that I don't see the flickering problem at night so I think that when the voltage is more close to 5V (extremely full darkness) the problem is not there.

LDR/10K AC is present.

Unfortunately, I don't have an oscilloscope.

Thank you for your interest.

mars16 commented 5 years ago

On the oscillogram with natural light, the pulsations are not noticeable, but flicker is present at dusk. Additionally installed capacitors did not change the situation. http://ixbt.photo/photo/169260/49326kzEEH4D4yc/1279802w.jpg