ARM Code for color sensor

You could use a pin which generates an interrupt on each rising edge of 
the color sensors signal. When you measure the time between the 
interrupts you can calculate the frequency.
Guest
Neethu P wrote:
> Sir,
> I am using TCS3200 color sensor. In the data sheet, it is specified that
> the output of the mentioned sensor is frequency in the form of square
> pulses. How can I find out the frequency value from that output? Anyone
> have the code for TCS3200 color sensor with ARM LPC1769? Please help.

You can connect the pin from the sensor that generates this waveform and 
connect it to an Oscilloscope or Logic Analyzer.
Guest
Neethu P wrote:
> Sir,
> I am using TCS3200 color sensor. In the data sheet, it is specified that
> the output of the mentioned sensor is frequency in the form of square
> pulses. How can I find out the frequency value from that output? Anyone
> have the code for TCS3200 color sensor with ARM LPC1769? Please help.

can u please share code for tcs3200 colour sensor as i am facing the
same problem........plz
Guest
charushilakhandait@gmail.com wrote:
> as i am facing the same problem

Uuh, you face the problem that you can't use a search engine with the 
terms 'TCS3200 color sensor code' too?
1
    /*     Arduino Color Sensing Tutorial
2
     *      
3
     *  by Dejan Nedelkovski, www.HowToMechatronics.com
4
     *  
5
     */
6
     
7
    #define S0 4
8
    #define S1 5
9
    #define S2 6
10
    #define S3 7
11
    #define sensorOut 8
12
    int frequency = 0;
13
    void setup() {
14
      pinMode(S0, OUTPUT);
15
      pinMode(S1, OUTPUT);
16
      pinMode(S2, OUTPUT);
17
      pinMode(S3, OUTPUT);
18
      pinMode(sensorOut, INPUT);
19
      
20
      // Setting frequency-scaling to 20%
21
      digitalWrite(S0,HIGH);
22
      digitalWrite(S1,LOW);
23
      
24
      Serial.begin(9600);
25
    }
26
    void loop() {
27
      // Setting red filtered photodiodes to be read
28
      digitalWrite(S2,LOW);
29
      digitalWrite(S3,LOW);
30
      // Reading the output frequency
31
      frequency = pulseIn(sensorOut, LOW);
32
      // Printing the value on the serial monitor
33
      Serial.print("R= ");//printing name
34
      Serial.print(frequency);//printing RED color frequency
35
      Serial.print("  ");
36
      delay(100);
37
      // Setting Green filtered photodiodes to be read
38
      digitalWrite(S2,HIGH);
39
      digitalWrite(S3,HIGH);
40
      // Reading the output frequency
41
      frequency = pulseIn(sensorOut, LOW);
42
      // Printing the value on the serial monitor
43
      Serial.print("G= ");//printing name
44
      Serial.print(frequency);//printing RED color frequency
45
      Serial.print("  ");
46
      delay(100);
47
      // Setting Blue filtered photodiodes to be read
48
      digitalWrite(S2,LOW);
49
      digitalWrite(S3,HIGH);
50
      // Reading the output frequency
51
      frequency = pulseIn(sensorOut, LOW);
52
      // Printing the value on the serial monitor
53
      Serial.print("B= ");//printing name
54
      Serial.print(frequency);//printing RED color frequency
55
      Serial.println("  ");
56
      delay(100);
57
    }
Code from the first search engine hit:
https://howtomechatronics.com/tutorials/arduino/arduino-color-sensing-tutorial-tcs230-tcs3200-color-sensor/

Reply

A question of your own? This thread is over 8 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.