Tutorial Colour Glove



1 glove (a solid material is most suitable. we used a neoprene glove)
1 Adafruit Flora
1 Adafruit color sensor
1 speaker 
conductive thread
sewing needle
soldering iron and solder
3 press buttons (optional 4 more)

Preparation:  Draw the electrical circuit


Before getting started, draw the electrical circuit plan on a sheet of paper. This will help you getting the connections right without confusions.

The speaker only needs 2 connections: an ingoing one (to receive an analog input) and an outgoing one (to ground it).

The sensor will have to be connected in 4 points: 3.3V  and ground for the power circuit, SCL and SDA for the value transmission.

During the project, always make sure that the conductive threads do not overlap. If two separate connections touch, there might be a short circuit.

Step 1: Prepare the speaker

Our speaker had cables attached (1), so we carefully clipped them off. Since we want to be able to detach the buzzer, we soldered press buttons to each pole (2). Again, make sure they do not touch! Now sew the opposite button parts on the glove and make sure they are connected to the right outlets (2).

A third button (which will not be sewn with the conductive thread) can be placed on top so that the speaker sits tighter.

1 – Speaker with cables
2 – buttons on glove and speaker

Step 2: Connections with crocodile clips

Before you sew the remaining elements to the glove, we highly recommend testing the electrical circuit with crocodile clips. If there is a bad connection, you will be able to fix it now.


Step 3: Upload code to Flora

Now it gets a bit tricky. Use the Arduino software to upload the code onto the Flora. Of course you can always alter the code, in order to change the speaker output or specify the color values (we programmed it to read yellow, orange, red, blue and green).

Have a look at the  Colour Glove code here.

(A tutorial from the Internet served as the starting point for our code.)

Optional step 4: Solder press buttons onto the flora

For more flexibility, you can solder press buttons to the respective pins. The counterparts can then be applied either on a piece of fabric / felt or directly onto the glove. Look at your electrical circuit in order to place the Flora correctly on the glove.

Alternatively, the flora can also be sewn directly onto the glove (through the small holes of the pins). The seams must be really tight, otherwise a loose connection could occur.

Step 5: Sew the connections to the speaker

From the sewn-on press buttons under the Flora, you can now start sewing the connections between speaker, Flora and sensor with the conductive thread.

First, connect the speaker and the flora. The positive terminal from the speaker goes to “#12”, the minus terminal to one of the “ground” pins. The best way to do this is to have a conductive seam on the left and the other one on the right around the wrist. Sew the conductive seam to the top of the glove, where the flora is placed.

Make sure that the seams are sewn neatly and very tightly around the buttons (e.g. to the flora).

Now would be a good moment to test whether your sewn connections work. Just place both speaker and Flora  on the press buttons and connect the rest of the circuit with crocodile clips. If it works, you can continue with the next step.

Step 6: Sew the connections to the RGB sensor


Sew the connections from sensor to Flora step by step (4 in total) and make sure to test them regularly.

Since the sensor is very small, make sure to leave room between the knots and seems. If threads overlap it could again lead to a short circuit.

Once you are done sewing you should have 4 connection between Flora and sensor.

Good luck!


// Libraries einbinden

#include "Wire.h"

const int speakerOut = 12;

// Color Sensor-Objekt initialisieren
// Parameter siehe: https://learn.adafruit.com/adafruit-color-sensors/program-it

Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS,

// setup() wird einmal beim Start des Arduino ausgeführt

void setup() {
// Serielle Kommunikation zur Ausgabe der Wert im seriellen Monitor
Serial.println("Color Glove Sensor");
// überprüfen, ob Color Sensor sich auch zurückmeldet
if (tcs.begin()) {
// Alles OK
Serial.println("Sensor gefunden");

else {
// Kein Sensor gefunden. Programm an dieser Stelle einfrieren
Serial.println("TCS34725 nicht gefunden ... Ablauf gestoppt!");
while (1); // Halt!

//set pin 12 to output
pinMode(speakerOut, OUTPUT);

// loop() wird wiederholt, solange der Arduino läuft
void loop() {

// Der Sensor liefert Werte für R, G, B und einen Clear-Wert zurück
uint16_t clearcol, red, green, blue;
float average, r, g, b;
delay(100); // Farbmessung dauert c. 50ms
tcs.getRawData(&red, &green, &blue, &clearcol);

// Farbbestimmung für Rot, Grün, Blau, Orange und Gelb
// Durchschnitt von RGB ermitteln
average = (red + green + blue) / 3;

// Farbwerte durch Durchschnitt,
// alle Werte bewegen sich jetzt rund um 1
r = red / average;
g = green / average;
b = blue / average;

// Clear-Wert und r,g,b seriell ausgeben zur Kontrolle
// r,g und b sollten sich ca. zwischen 0,5 und 1,5
// bewegen. Sieht der Sensor rot, dann sollte r deutlich über 1.0
// liegen, g und b zwischen 0.5 und 1.0 usw.

Serial.print("\tClear:"); Serial.print(clearcol);
Serial.print("\tRed:"); Serial.print(r);
Serial.print("\tGreen:"); Serial.print(g);
Serial.print("\tBlue:"); Serial.print(b);

// Versuch der Farbfeststellung anhand der r,g,b-Werte.
// Am besten mit Rot, Grün, Blau anfangen die die Schwellenwerte
// mit der seriellen Ausgabe entsprechend anpassen

if ((r > 1.4) && (g < 0.9) && (b < 0.9)) {

tone(speakerOut, 1600);

else if ((r < 0.95) && (g > 1.2) && (b < 0.9)) {
tone(speakerOut, 100);

else if ((r < 0.8) && (g < 1.2) && (b > 1.2)) {

tone(speakerOut, 1300);

// Gelb und Orange sind etwas tricky, aber nach etwas
// Herumprobieren haben sich bei mir diese Werte als
// gut erwiesen

else if ((r > 1.15) && (g > 1.15) && (b < 0.7)) { Serial.print("\tGELB"); tone(speakerOut, 2300); delay(1000); noTone(speakerOut); delay(1000); } else if ((r > 1.4) && (g < 1.0) && (b < 0.7)) {
tone(speakerOut, 1900);

// Wenn keine Regel greift, dann ehrlich sein

else {
Serial.print("\tNICHT ERKANNT");
// myservo.write(nonePos);
tone(speakerOut, 500);

// Zeilenwechsel ausgeben

// Wartezeit anpassen für serielles Debugging