Tcs34725 Color sensor sample.

For general Flowcode discussion that does not belong in the other sections.
Post Reply
ayhan1
Posts: 44
http://meble-kuchenne.info.pl
Joined: Sun Mar 21, 2021 2:13 pm
Has thanked: 18 times
Been thanked: 1 time

Flowcode v10 Tcs34725 Color sensor sample.

Post by ayhan1 »

Hello everyone. Is there an example for using the Tcs34725 Color sensor?

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 702 times

Re: Tcs34725 Color sensor sample.

Post by medelec35 »

Hello.
These forums are for Flowcode v9 and v10
Can you please edit your post and select the v9 or v10 post icon?
Post Icons.png
Post Icons.png (8.36 KiB) Viewed 3521 times
Is your Tcs34725 the Grove colour sensor or just a breakout board?
What target device are you using e.g just a microcontroller like 16F18877 or a BL011 or BL0055?
How are you wanting to view the results e.g LCD(type?), gLCD (type?) or UART?

As there are no examples, we require the above information to create one for you.
Martin

ayhan1
Posts: 44
Joined: Sun Mar 21, 2021 2:13 pm
Has thanked: 18 times
Been thanked: 1 time

Re: Tcs34725 Color sensor sample.

Post by ayhan1 »

Thank you for your answer.
Flowcode V10
Arduino uno dip r3
TCS34725 sensor
RGB common anode led

EDIT: I have attached the example I made. But it didn't work
Attachments
RENK-1.fcfx
(13.82 KiB) Downloaded 461 times

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 702 times

Re: Tcs34725 Color sensor sample.

Post by medelec35 »

Hello.
The attached project will only simulate if you use that attached updated component.
To do that before the updates are pushed.
Browse to this location using file explorer, it's hidden by default so just paste the link into your address bar.

Code: Select all

C:\ProgramData\MatrixTSL\FlowcodeV10\Components
Replace the existing files with the attached Grove_I2C_Color_Sensor.fcpx file.
If Flowcode is already open, then you will need to reload your project for the new components to work
If you run any component updates, then the components you added will be overwritten.
The Original component won't stop the hardware from working.
The simulation works by adjusting the RGB controls on the 2D panel.
The Red, Green & Blue text will change colour depending on the settings.
TCS34725 Simulation.png
TCS34725 Simulation.png (175.64 KiB) Viewed 3478 times
The data and clock pins are chosen to work with Eblocks2 Grove board BL0129 and the Grove I2C colour sensor PCB.
If you don't have them then you will need to change pins accordingly.

You will need to take in to account that the sensor can output a 16bit value, if bright enough.
The RGB led only takes an 8 bit value.
Therefore you may need to play around with the sensor gain to make it work better.
Attachments
TCS34725FN-Uno-RGB.fcfx
(34.5 KiB) Downloaded 449 times
Grove_I2C_Color_Sensor.fcpx
(83.73 KiB) Downloaded 478 times
Martin

ayhan1
Posts: 44
Joined: Sun Mar 21, 2021 2:13 pm
Has thanked: 18 times
Been thanked: 1 time

Re: Tcs34725 Color sensor sample.

Post by ayhan1 »

Thank you very much for your detailed answer. I will try right away

ayhan1
Posts: 44
Joined: Sun Mar 21, 2021 2:13 pm
Has thanked: 18 times
Been thanked: 1 time

Re: Tcs34725 Color sensor sample.

Post by ayhan1 »

Unfortunately it didn't work. I uploaded the program you sent to the arduino, but I could not get color from the rgb led. Then I saw some problems that caught my attention, I changed them but it still didn't work.
1-SDA-SCL terminals are connected in reverse I guess
2-RGB leds are not connected to pwm terminals. I connected the RGB led to pins R-3, G-5, B-6.
I changed the pins in the program.
The program works fine now

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 702 times

Re: Tcs34725 Color sensor sample.

Post by medelec35 »

Indeed, I did state
medelec35 wrote:
Fri Mar 31, 2023 11:21 pm
The data and clock pins are chosen to work with Eblocks2 Grove board BL0129 and the Grove I2C colour sensor PCB.
If you don't have them then you will need to change pins accordingly.
What I should have done is matched the RGB LED pins, sorry about that.

If you post your working .fcfx project I can then see if I can improve it.

I'm glad its working for you.

Thanks for letting us know
Martin

Post Reply