- Board Used: Arduino MKR WiFi 1010
- Color Sensor: Gravity TCS3430 Tristimulus Color Sensor
- I2C Multiplexer: Gravity Digital 1-to-8 I2C Multiplexer
- IDE: Arduino IDE 2.2.1
- WiFi: Usable WiFi
-
RGBSensorClient.ino: Main program file. -
Config.h: Contains configuration and constant values. -
Arduino_secrets.h: Stores credential information, especially for Arduino Cloud synchronization.
-
Version: 1.0.1
-
Recommendation: Use Arduino Cloud for quick sync across multiple development machines.
Simply connect the Arduino to a powersource, the device will start operating based on the pre-loaded code.
-
VERY IMPORTANT:
In ArduinoHttpClient.h -> WebSocketClient.h, set the buffer iTxBuffer size as follows:
uint8_t iTxBuffer[4096]
otherwise it will result incomplete or failed message transmissions.
-
Power: USB is usually sufficient. Use a high-quality USB cable. A 5V1A power supply guarantees adequate power provision.
-
Comment in the code to set the correct IP, port, WiFi ID, and password.
-
Upload the code to Arduino.
-
Use A0 to A3 as Analog-to-Digital Converter (ADC) Inputs:
-
Connect the multiplexer to the 5V, GND (Ground), SCL (Serial Clock Line), and SDA (Serial Data Line) for stable operation and communication.
-
Color Sensor Integration: The microcontroller and server software are currently configured to support up to four color sensors. It is recommended to use ports 0 to 3 on the multiplexer.
JSON structure example:
{
"Sens": [
{ "id": 0, "d": { "X": 1521, "Y": 1406, "Z": 206, "I1": 190, "I2": 79 } },
{ "id": 1, "d": { "X": 48, "Y": 12, "Z": 6, "I1": 1, "I2": 0 } },
{ "id": 2, "d": null },
{ "id": 3, "d": { "X": 80, "Y": 64, "Z": 20, "I1": 8, "I2": 6 } },
{ "id": 4, "d": null },
{ "id": 5, "d": null },
{ "id": 6, "d": null },
{ "id": 7, "d": null }
],
"adc": "1110",
"A0": "3810",
"A1": "3325",
"A2": "2574",
"A3": "1872",
"ssId": "linksys"
}- d is assigned null when the port is inactive.
- A0 to A3 represent the voltage values (not actual voltage) from the analog inputs.
- ssId is for matching purposes and is not currently used.
DFRobot Graivty: TCS3430 Tristimulus Color Sensor
DFRobot Gravity: I2C Multiplexer
