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

Calibrating an ESP8266 Bulb #149

Open
herobrine30396 opened this issue Aug 5, 2024 · 9 comments
Open

Calibrating an ESP8266 Bulb #149

herobrine30396 opened this issue Aug 5, 2024 · 9 comments

Comments

@herobrine30396
Copy link

I've used a cheap Wipro bulb and converted it to an ESP8266 DiyHue bulb. The problem is colour reproduction. Red is way too dim, and Blue is too bright. I've tried using b = b * 50 / 100 and g = g * 80 / 100 as suggested in Slack, but this only works up to an extent. With this change, selecting the colour in the bulb's web interface at full brightness yields the correct colours, but playing with the brightness seems to mess it up. When I tried using Hue Sync for Windows, the colours shown in the app were not what the bulb emits. I've also noticed that the colours were wrong when using Amazon's Alexa, and the Blue channel was too bright even with the code modification. I think there should be a way to calibrate or tune a device for accurate colour reproduction since each light is different.

@hendriksen-mark
Copy link
Member

Hi, in the webui for the light you can select a multiplier.
But if 50% does not work then maybe something is wrong with the light.Screenshot_20240805-062132_Chrome.jpg

@herobrine30396
Copy link
Author

But this only works for WS2811 lights. The light bulb I'm using uses an RGB-CCT circuit.

@hendriksen-mark
Copy link
Member

Oke i will look into this to make them the same webui.

@herobrine30396
Copy link
Author

Okay, thanks!

hendriksen-mark added a commit that referenced this issue Aug 5, 2024
@hendriksen-mark
Copy link
Member

i did not make the same webui but added rgb_multiplier to the sketch. please try it and give feedback.

@herobrine30396
Copy link
Author

Okay. I uploaded the code, and now the RGB multiplier works. Blue works perfectly at 60, and Red works perfectly at 100, but there's a problem with the Green. Now, I have to set the Green to 10 to get accurate colours, but with the previous code, 70 was enough to do this.

@herobrine30396
Copy link
Author

I've tried changing the gamma correction to

r = r <= 0.04045f ? r / 12.92f : pow((r + 0.055f) / (1.0f + 0.055f), 2.4f);
g = g <= 0.04045f ? g / 12.92f : pow((g + 0.055f) / (1.0f + 0.055f), 2.4f);
b = b <= 0.04045f ? b / 12.92f : pow((b + 0.055f) / (1.0f + 0.055f), 2.4f);

and now the RGB multiplier works better. With this formula, Blue works at 90, Red works at 100, and Green works at 30. A problem I noticed with this was that setting the colour picker to white gives a more purple colour than white, but it works with every other colour in the picker.

@mariusmotea
Copy link
Member

Every RGB light is different, the gamma correction we use is generic. Normally with a good balanced RGB light you don't need to change anything. A light manufacturer need to tune this formula after every led type change.

@herobrine30396
Copy link
Author

Yes, I didn't expect the light to be perfectly calibrated, since it's cheap. It would be a good idea to have documentation for anyone who would like to calculate the gamma correction for their specific light.

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

No branches or pull requests

3 participants