- Add GitHub Pages web interface in /docs directory - Add WebSerial example Arduino sketch - Implement color plotting on CIE 1931 chromaticity diagram - Add realtime color visualization and conversion 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| cie1931_diagram.svg | ||
| index.html | ||
| README.md | ||
| script.js | ||
OPT4048 CIE Color Plotter
This web interface allows you to visualize color measurements from an Adafruit OPT4048 color sensor in real-time using the Web Serial API.
How to Use
-
Upload the Arduino sketch: First, upload the
opt4048_webserial.inosketch from the examples folder to your Arduino board. -
Connect to this web page: You can either:
- Host the page locally
- Use GitHub Pages (if this repository is published there)
-
Connect to your Arduino: Click the "Connect to Arduino" button and select your Arduino from the popup menu.
-
View measurements: The sensor readings will appear on the CIE chromaticity diagram, showing you exactly where the measured color falls in the CIE color space.
Features
- Displays CIE x,y coordinates in real-time
- Plots the color point on a standard CIE 1931 chromaticity diagram
- Shows lux (brightness) and color temperature (CCT) values
- Provides approximate RGB color visualization
- Monitors serial output for debugging
Browser Compatibility
This interface uses the Web Serial API, which is currently supported in:
- Google Chrome (version 89+)
- Microsoft Edge (version 89+)
- Opera (version 75+)
It is not supported in Firefox or Safari due to their Web Serial API implementation status.
About the OPT4048 Sensor
The OPT4048 is a high-precision tristimulus XYZ color sensor by Texas Instruments. The Adafruit breakout board makes it easy to interface with this sensor using I2C.
This sensor provides accurate color measurements in XYZ color space, which can be converted to standard CIE 1931 xy chromaticity coordinates.
File Structure
index.html- The main webpagescript.js- JavaScript code for communication and visualizationcie1931_diagram.svg- SVG image of the CIE 1931 chromaticity diagram
License
MIT license, all text here must be included in any redistribution