A Color Sensing Glove That Sends the HEX Code to a Computer Program
Introduction: A Color Sensing Glove That Sends the HEX Code to a Computer Program
Wouldn't it be cool to see something on our desk or nearby, a color that we like, and add it directly to our projects on our computer? Now you can!
You can make this hand-worn wearable that uses a color sensor to detect colors from the environment around us. Then it lights up NeoPixels with the color we scanned, and writes the HEX code to an OLED on the glove.
This HEX can then be sent to our computer (with touch input) - directly into what we are working on to add the HEX code for us.
Supplies
The supplies I've used for this project include:
* Adafruit Flora board or Circuit Playground Classic
* Flora sewable color sensor
* 4x4 grid NeoPixels but any shape will work (I've linked to the circle x 16)
* OLED screen 128 x 64
* wires
* soldering or conductive thread to sew the connections
* you'll a small piece of conductive fabric to act as a touch input button to send the HEX value to your computer
* Felt, neoprene, or material for the glove, or a recycled glove is even more eco!
In this case, I won't be using a battery if you want to enable the feature of transferring the HEX code to the computer, we will need a cable to connect to our computer so we will use that for power too.
Wearable Electronics items purchased from Tinker Tailor.
Step 1: Draw Out Your Connections
Sometimes it can be easier to follow your connections if you map them out your project. I usually start by adding all the components I need and then drawing my mappings.
For this circuit, we will connect:
The color sensor
* Ground - Ground on Flora
* Power - Power on Flora
* SDA - SDA on Flora
* SCL - SCL on Flora
The OLED
* Ground - Ground on Flora
* Power - Power on Flora
* SDA - SDA on Flora
* SCL - SCL on Flora
NeoPixels
* Ground - Ground on Flora
* Power - Power on Flora
* DO - to pin 10 on Flora
Conductive fabric as touch input
* Fabric sewn or wire connected to pin 9 on Flora, pin 12 Circuit Playground
Step 2: Check Each Component and Connection
To do this step by step we should add the color sensor first. 769
Then we can check it's working. We will do this for all of our parts, the color sensor, the NeoPixels, and the OLED.
After you hook up the color sensor using I2C and the connections in the previous step, we will upload the code to our board.
First, we need to add a library.
Step 3: Adding a Color Sensor
Let’s open the Arduino IDE and install a library to use this sensor.
Open the Library Manager, and search for Adafruit TCS34625.
The color sensing library didn’t appear when I searched - I tried searching for color sensor, which worked. Click o click Install, and Install all.
This library is for a slightly different color sensor so I modified the sample file slightly.
#include <Wire.h> //include Wire.h to be able to communicate through I2C on Arduino board
#include "Adafruit_TCS34725.h" //Colour sensor library
//Create colour sensor object declaration, to see effects of different integration time and gain
//settings, check the datatsheet of the Adafruit TCS34725.
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);
void setup() {
Serial.begin(9600);
Serial.println("Color View Test!");
//Start-up colour sensor
if (tcs.begin()) {
Serial.println("Found sensor");
} else {
Serial.println("No TCS34725 found ... check your connections");
while (1); // halt!
}
}
void loop() {
uint16_t clear, red, green, blue;
//Collect raw data from integrated circuit using interrupts
tcs.setInterrupt(false); // turn on LED
delay(60); // takes 50ms to read
tcs.getRawData(&red, &green, &blue, &clear);
tcs. 158