-
Connecting the M5Stack to the color sensor
10/08/2021 at 04:48 • 0 commentsUsing the color Unit of the M5Stack for the sensor is very easy.
Use the included Grove cable to make the connection.
If you are using the TCS34725 development board, please solder the pin headers to the terminals. Next, screw on the two parts of the case output from the 3D printer. To stabilize the light environment, the 3D printer parts should be painted matte black.
Create a cable with Grove terminals on one side and a 2.54 pitch pin socket on the other side to connect the M5Stack to the TCS34725.
The connection should look like this.
M5Stack(Glove connecotor) TCS34725(QI connector) Vout 3V3 G GND SCL SCL SDA SDA -
Initializing the M5Stack
10/08/2021 at 04:28 • 0 commentsThe M5Stack used in this project can be programmed visually.
If you are using M5Stack for the first time, please follow the documentation on the official website to download M5burner and install the UIFlow firmware.
Then set up Wi-Fi to connect from M5Stack and UIFlow.If you do not have Wi-Fi, there is also a desktop version of UIFlow that allows USB connection.
Using UIFlow is very convenient because the UI of the M5Stack can be created intuitively with GUI.
-
Color format types and conversions
10/08/2021 at 02:13 • 0 commentsThe RGB format divides the intensity of the three primary colors of light (red, green, and blue) into 256 steps, and combines them to represent 1667216 colors.
In printing, on the other hand, colors are represented by combining the three primary colors of color cyan, magenta, and yellow with black. The CMYK color format is a format for representing colors in this type of system.
Color maker uses the CMYK format to mix paints to create new paint colors. On the other hand, the color sensor that reads the color of an object uses the RGB format, so we will learn how to convert from RGB to CMYK.The conversion from RGB to CMYK is very simple and can be expressed by the following formula
First, convert the RGB with values from 0 to 255 from 0 to 1.
R' = R/255
G' = G/255
B' = B/255
From the obtained RGB values, the K value is calculated, and then the CMY value is calculated.
K = 1-max(R', G', B')
C = (1-R'-K) / (1-K)
M = (1-G'-K) / (1-K)
Y = (1-B'-K) / (1-K)