Hi Everyone,
Just wondering if this project proposal is feasible? I've been searching on the internet for a while regarding the samples of RGB Color detector with an LCD and speaker but i can't find anything related to this. Our proposal is to make the Speaker talk on whatever the color detector will detect.
Ex.
I put a red paper on the color detector, LCD will print out "R=255, B=0, G=0" and the speaker will talk "Color is RED".
Is this possible? Will appreciate a help from you guys.
Thank you so much.
Is this possible?
I put a red paper on the color detector,
Yes
LCD will print out "R=255, B=0, G=0
No. It will print the colour combination it sees. It will not see zero components in the G and B channels.
the speaker will talk "Color is RED".
Yes
@Tootzskie:
Mr. Grumpy has given the specific answers. I'm going to talk a bit more in general terms.
I have attached an RGB color wheel, you will see that for "pure" colors, only one channel (R/G/B) will be active and the other channels will be 0. But generally, you get some signal on all of the channels. You can normalize this, you can "map" this, but you must deal with it in some fashion that you can program in a conditional statement.
So, if the Arduino says, "Red" you cannot just look at the R-channel as 255 and G/B as 0, you must set up ranges. For example,
R == 5
G == 3
B == 250
What is the color above? You cannot use a simple "if" construction in your code. You must match the response to the speech synthesizer which will have limited responses.
Ray
![](https://europe1.discourse-cdn.com/arduino/original/4X/1/6/c/16c2bcf2dbe3d66377ea083c7f66ac624d0f8158.jpeg)
![rgb-color-wheel-sm.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/1/6/c/16c2bcf2dbe3d66377ea083c7f66ac624d0f8158.jpeg)
mrburnette:
@Tootzskie:
Mr. Grumpy has given the specific answers. I'm going to talk a bit more in general terms.
I have attached an RGB color wheel, you will see that for "pure" colors, only one channel (R/G/B) will be active and the other channels will be 0. But generally, you get some signal on all of the channels. You can normalize this, you can "map" this, but you must deal with it in some fashion that you can program in a conditional statement.
So, if the Arduino says, "Red" you cannot just look at the R-channel as 255 and G/B as 0, you must set up ranges. For example,
R == 5
G == 3
B == 250
What is the color above? You cannot use a simple "if" construction in your code. You must match the response to the speech synthesizer which will have limited responses.
Ray
![](https://europe1.discourse-cdn.com/arduino/original/4X/1/6/c/16c2bcf2dbe3d66377ea083c7f66ac624d0f8158.jpeg)
Oh i see now, the problem is I'm having a hard time getting the codes for the speaker. Can you help me with this sir? Since i'm not very familiar with the language of Arduino.
the problem is I'm having a hard time getting the codes for the speaker.
What are you using to output the sound?
How is it wired?
What have you done so far?
Please post your code.
Grumpy_Mike:
What are you using to output the sound?
How is it wired?
What have you done so far?
Please post your code.
I'm planning to use a 8 ohm speaker(if this is possible).
Below is my code so far(TCS3200 Color detector and LCD):
// include the library code:
#include <LiquidCrystal.h>
#define S0 8
#define S1 9
#define S2 12
#define S3 11
#define sensorOut 10
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int frequency = 0;
int OutPut= 10;//naming pin10 of uno as output
void setup() {
pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
pinMode(sensorOut, INPUT);
// Setting frequency-scaling to 20%
digitalWrite(S0,HIGH);
digitalWrite(S1,LOW);
}
void loop() {
lcd.print("R=");//printing name
digitalWrite(4,LOW);
digitalWrite(5,LOW);//setting for RED color sensor
frequency = pulseIn(OutPut, LOW);//reading frequency
frequency = map(frequency, 25,70,255,0);
lcd.print(frequency);//printing RED color frequency
lcd.print(" ");
lcd.setCursor(7, 0);//moving courser to position 7
delay(500);
lcd.print("B=");// printing name
digitalWrite(4,LOW);
digitalWrite(5,HIGH);// setting for BLUE color sensor
frequency = pulseIn(OutPut, LOW);// reading frequency
frequency = map(frequency, 25,70,255,0);
lcd.print(frequency);// printing BLUE color frequency
lcd.print(" ");
lcd.setCursor(0, 1);
delay(500);
lcd.print("G=");// printing name
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);// setting for GREEN color sensor
frequency = pulseIn(OutPut, LOW);// reading frequency
frequency = map(frequency, 25,70,255,0);
lcd.print(frequency);// printing GREEN color frequency
lcd.print(" ");
lcd.setCursor(0, 0);
delay(500);
}
I'm planning to use a 8 ohm speaker(if this is possible).
And what hardware are you going to use to produce the speech?
Why all the delays?
Please read this:-
How to use this forum
Because your post is breaking the rules about posting code.
Grumpy_Mike:
And what hardware are you going to use to produce the speech?
Why all the delays?
Please read this:-
How to use this forum
Because your post is breaking the rules about posting code.
Oh i'm sorry, already edited my post regarding the code. Should i remove the delays? and what hardware can you suggest me to produce the speech as i am not aware in any hardware that could produce the speech.
How much speech do you want. You can get about three seconds from the internal program memory. Otherwise you need at least an SD card and normally an D/A chip. You can get these as a shield like the AdaFruit wav shield. Or you can get modules like MP3 player boards.