TCS3425 color sensor library code upload issues

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Abaumanster
 
Posts: 4
Joined: Tue Mar 06, 2018 10:19 am

TCS3425 color sensor library code upload issues

Post by Abaumanster »

Hello, I teach Middle school Technology and Engineering here at the American International School of Lagos. My 8th graders are designing and building the classic marble sorting machine taking in to account marble size, color, size, and magnetism. For color we are using the TCS3425 Color sensor. Eventually we want that to use that sensor to input a 28JYJ-48 stepper motor to sort the marbles. Before we get to that though, I just want the students to change the color of an RGB LED with the sensor and Arduino. I'm using this webpage as guide https://learn.adafruit.com/adafruit-col ... s/overview. The circuit is straight forward and easy. Where I am struggling is the code. This is my first year teaching on the Arduino platform.

I have taken the code from the TCS3425 sensor Ardunio library. I have try to upload the code to my board but always receive an error message. I have looked at all the code in library and am struggling to make this sense of this. Can anyone provide a link or paste the code I need in a response.

Thanks for your time, as living here in Nigeria I'm a bit isolated from a coding and DIY community.

Andrew Bauman

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: TCS3425 color sensor library code upload issues

Post by adafruit_support_bill »

I have try to upload the code to my board but always receive an error message.
It would be helpful if you posted the text of the error message.

User avatar
Abaumanster
 
Posts: 4
Joined: Tue Mar 06, 2018 10:19 am

Re: TCS3425 color sensor library code upload issues

Post by Abaumanster »

Thanks for responding so quickly to me and my arduino problem.

Well after an evening of research and work I realized I was not using the Library correctly. I was copying and pasting the entire .cpp code and not working within the examples.

Working with the right code (which uploaded) I have come to a few more observations with using the color sensor. 3 things:

-One it looks like the pins that come with the the sensor must be soldered for a good connection (exactly as you state in your tutorial). Right now I just have the pins that came with the sensor pushed through the holes and into the bread board. Now the search for fine soldering iron tip begins. I can make the sensor work when I gently press the wires toward the sensor pushing the sensors contact holes against the pins

- I noticed in the code has #include <wire.h> is that a standard or universal library that is pre-loaded? I understand that it is used for SDA and SCL components

-Lastly when I run the code for the colorview sketch. My LED is always blue but the numbers in my cereal monitor change as I introduce different colored items over the sensor. I have played around with different resistors to limit the current to the blue RGB LED PIN.

Would love any feed back and thoughts on my three observations and thank you for your time

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: TCS3425 color sensor library code upload issues

Post by adafruit_support_bill »

-One it looks like the pins that come with the the sensor must be soldered for a good connection (exactly as you state in your tutorial). Right now I just have the pins that came with the sensor pushed through the holes and into the bread board. Now the search for fine soldering iron tip begins. I can make the sensor work when I gently press the wires toward the sensor pushing the sensors contact holes against the pins
If you are new to soldering, we have a helpful tutorial here: https://learn.adafruit.com/adafruit-gui ... -soldering
- I noticed in the code has #include <wire.h> is that a standard or universal library that is pre-loaded? I understand that it is used for SDA and SCL components
The wire library is installed as part of the standard Arduino IDE package.
-Lastly when I run the code for the colorview sketch. My LED is always blue but the numbers in my cereal monitor change as I introduce different colored items over the sensor. I have played around with different resistors to limit the current to the blue RGB LED PIN.
If you post photos of your circuit, we can try to spot the problem.

User avatar
Abaumanster
 
Posts: 4
Joined: Tue Mar 06, 2018 10:19 am

Re: TCS3425 color sensor library code upload issues

Post by Abaumanster »

Thanks again for your quick responses.

Below are photos.

RGB: Red is pin 3, Green is pen 5, and Blue is pin 6. Ground is to Ground

The Sensor: is 5 volts to VIN, Ground to Ground and SDA to A4 and SCL to A5.

Code I'm running is color view and I can get a reading that changes with color on my Serial Monitor

The RGB LED works when I run a color changing code. The resistors are 330ohms though I did try different values as a silly guess.

Just can't get my RGB to turn colors when the Serial Monitor value changes.

My students and I would love some help with this puzzle.

Thank you again for your time and great support
Attachments
monitor.jpg
monitor.jpg (44.03 KiB) Viewed 662 times
adafruit circuit.jpg
adafruit circuit.jpg (102.28 KiB) Viewed 662 times
adafruit.jpg
adafruit.jpg (49.08 KiB) Viewed 662 times

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: TCS3425 color sensor library code upload issues

Post by adafruit_support_bill »

From what I can see, the wiring looks correct. But you will need to solder those headers for reliable operation.
https://learn.adafruit.com/adafruit-col ... rsion-only
The RGB LED works when I run a color changing code.
Please post your color changing code that works.

User avatar
Abaumanster
 
Posts: 4
Joined: Tue Mar 06, 2018 10:19 am

Re: TCS3425 color sensor library code upload issues

Post by Abaumanster »

Here the code I use to cycle the RGB through a range of colors.

https://learn.adafruit.com/adafruit-ard ... ino-sketch

I will be soldering the contacts soon once I receive a fine tipped iron. Though if the Serial monitor is showing data and its changing with different colors, wouldn't that suggest the sensor is working?

Is there another set of code I need to combine with library code colorview to make the sensor "talk" to the RGB LED ?

Thanks for your time and insight

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: TCS3425 color sensor library code upload issues

Post by adafruit_support_bill »

That code assumes that your led is wired to pins 9, 10 and 11. If you change it to use the same pins as the color view sketch - i.e. the ones that are connected in your photo, does it still work?

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”