TCS3200D Color Sensor

I work with an arduino nano every and I have a question about the power supply of my color sensor. If I connect the Vcc pin of my sensor to the 5V pin on my arduinoboard everything works as it should. My program gives me the different frequencies in my serial monitor, but the Vcc pin needs to be connected to the D11 pin on my board , because of the electric schematic we got from school. If I connect it to the D11 pin it gives only 0 as value in my serial monitor. I thought setting the D11 pin on HIGH with the digitalwrite command was the same as being connected to the 5V pin on my arduinoboard. Is it the same? Or am I doing something else wrong?

My code:

int PinColorSenS0 = 3;
int PinColorSenS1 = 5;
int PinColorSenS2 = 7;
int PinColorSenS3 = 9;
int PinColorSenVCC = 11;
int PinColorSenOUT = 2 ;
int PulseWidth = 0;

void setup() {

pinMode(PinColorSenS0, OUTPUT);
pinMode(PinColorSenS1, OUTPUT);
pinMode(PinColorSenS2, OUTPUT);
pinMode(PinColorSenS3, OUTPUT);
pinMode(PinColorSenVCC, OUTPUT);
pinMode(PinColorSenOUT, INPUT);
digitalWrite(PinColorSenVCC, HIGH);
digitalWrite(PinColorSenS0, LOW);
digitalWrite(PinColorSenS1,HIGH);

delay(100);
Serial.begin(9600);
delay(100);
}

void loop() {
digitalWrite(PinColorSenS2, LOW);
digitalWrite(PinColorSenS3, LOW);
PulseWidth = pulseIn(PinColorSenOUT, LOW);
Serial.print("PWRED = ");
Serial.print(PulseWidth);
Serial.print(" ");
delay(200);
}

Welcome to the forum

Please follow the advice on posting code given in Read this before posting a programming question in order to make your sketch easy to follow, download and test

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

If the code exceeds the 9000 character inline limit then attach it to a post

An Arduino pin is not designed to power other devices and can only supply a limited amount of current and may have been damaged. Please post a link to the sensor that you are using and also post the schematic that you got from school. A photograph of the schematic will be good enough

Thank you for the quick response!!

I found the issue, I interpretted the schematic wrongly. The simplified circuit I used to calibrate the color sensor doesn't include a Darlington transistor(ULN2003A). In the regular circuit it is included so we can connect the Vcc pin of the color sensor to the D11 pin on the arduino board. To calibrate and test the sensor I will just connect the Vcc to the 5V on the board.

Let's hope that you have not damaged the Arduino !

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.