Color to Sound Converter
by Philanthropology in Circuits > Arduino
1799 Views, 17 Favorites, 0 Comments
Color to Sound Converter
I created a device that would take in color and transform RGB data into a perceivable frequency. The original idea came from Neil Harbisson, an artist that attached a color sensor to his head that interfaced with his brain to allow him to hear color.
Supplies
Arduino Uno
RGB LED
Jumper wires
TCS34275 color sensor
Passive Buzzers
Soldering iron
Breadboard
Connect Color Sensor
The first step I took in this project was to connect the TCS34725 to my breadboard and Arduino.
The four connections I used from the color sensor were: GND, 3V3, SCL, SDA.
GND was connected to a ground pin on the Arduino Uno.
3V3 was connected to 5V.
SCL was connected to A4.
SDA was connected to A5.
Connect RGB LED
Once the color sensor is connected to the breadboard and Arduino you're going to want to connect an RGB LED to receive visual feedback from the color sensor.
I connected the RGB LED to the breadboard.
The red pin was connected to pin ~3
The green pin was connected to pin ~5
The blue pin was connected to pin ~6
The cathode was connected to another GND pin
Connect Passive Buzzers
Now it is time to connect the passive buzzers to the breadboard and Arduino.
Each passive buzzer has a positive and negative pin.
The negative pin for each buzzer was connected to ground on the breadboard.
The positive pin for buzzer #1 was connected to ~9
The positive pin for buzzer #2 was connected to ~10
The positive pin for buzzer #3 was connected to ~11
Code
This is a piece of code I used by Zin Tech Ideas. It was modified to include a conversion of RGB data into sound frequency.
//Code by Zin Tech Ideas - Edited by Jack Kaiser
#include <Wire.h>
#include "Adafruit_TCS34725.h"
#define redpin 3
#define greenpin 5
#define bluepin 6
#define commonAnode true
int buzzer = 9;
int buzzer2 = 10;
int buzzer3 = 11;
byte gammatable[256];
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);
void setup() {
Serial.begin(9600);
if (tcs.begin()) {
} else {
Serial.println("No TCS34725 found ... check your connections");
while (1);
}
pinMode(redpin, OUTPUT);
pinMode(greenpin, OUTPUT);
pinMode(bluepin, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(buzzer2, OUTPUT);
pinMode(buzzer3, OUTPUT);
for (int i=0; i<256; i++) {
float x = i;
x /= 255;
x = pow(x, 2.5);
x *= 255;
if (commonAnode) {
gammatable[i] = 255 - x;
} else {
gammatable[i] = x;
}
}
}
void loop() {
float red, green, blue;
tcs.setInterrupt(false);
delay(60);
tcs.getRGB(&red, &green, &blue);
tcs.setInterrupt(true);
Serial.print("R:\t"); Serial.print(int(red));
Serial.print("\tG:\t"); Serial.print(int(green));
Serial.print("\tB:\t"); Serial.println(int(blue));
analogWrite(redpin, int(red));
analogWrite(greenpin, int(green));
analogWrite(bluepin, int(blue));
int r = red;
int g = green;
int b = blue;
r = map(red, 0, 255, 0, 3000);
g = map(green, 0, 255, 0, 3000);
b = map(blue, 0, 255, 0, 3000);
tone(9, r);
tone(10, g);
tone(11, b);
}
Explore
You have now created a device that turns color into sound! This device has many creative uses that can be found by simply playing.