A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By hbouzas
#18801 I just finished programming the LUA code for the ESP8266 based color detection module. This module is also configureable remotely, no need of serial. This first pass will use an ad-hoc communication mechanism as follows ( next I will try to squeeze in MQTT)
The reading of the color components is done via a TCP request to the board. The reading returns a frequency in KHz proportional to the intensity of the color. The frequencies in KHz are returned in a JSON string. The value of the intensity for all colors is also returned. Percentage components of color can be calculated from the frequency readings as these are proportional to the color intensity.

The sequence for reading is done by sending the following strings via TCP on port 9999:
acquire
(wait 5 seconds for acquisition to complete)
readf to read the frequency values
readp to read the percent values

The return message is in JSON format as follows:
Frequency:
{"RGBF": [{ "Red:": "1640", "Green": "1230", "Blue:": "2250", "All:": "6250"}]}}]}
each number representing a frequency in KHz proportional to the intensity of the light for red, green, blue and unfiltered (all).

Percentage:
{"RGBP": [{ "Red:": "33", "Green": "42", "Blue:": "25"}]}}]}
each number representing a percentage of the intensity of the light for red, green, blue.
You do not have the required permissions to view the files attached to this post.