Adafruit TCS34725 RGB Sensor Demo

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's up guys I told you I would order the Adafruit sensor and I did that's it there let's uh zoom in so we can have a better look okay you just scared the crap out of me like so thank you all right this is the Adafruit TCS 3 for 725 RGB sensor you can see the little sensor right there we've got a nice bright white LED and the supporting Hardware around it including AF 3.3 volt regulators so you can power this from 3.3 volts or 5 volts works very nicely so this is an I squared C devices you can see here we have s da and s CL and they of course go to a 4 and a 5 otherwise all it needs is a power and a ground which we're getting off from our Arduino now what we're going to do is we're going to read a color value and do our best to attempt to turn it into a value on this RGB LED now this is a common cathode most of them are common cathode and if we come in here you can see this is our red pin that's our common ground green and blue now you want to put resistors on these pins I'm using 1k resistors so these aren't too bright because I don't have a 2k resistor on the green I'm using two 1k resistors the green is the brightest color you don't want it to overpower everything and those go-to pins red goes to pin 3 green goes to pin 5 and blue goes to pin 6 the reason we're doing that those are PWM pins you can see the squiggles there because we need to output analog values to them and that's really all there is to the hardware setup here let's go take a look at the code okay here we go this is the code for the Adafruit TCS 3 for 75 RGB sensor and I have adapted almost all of this code from the original by Adafruit so we're gonna need to include two libraries the wire library for I squared C and the Adafruit T cs3 for 725 to talk to the sensor now for our LED we're gonna need three pins they have to be PWM pins so you can pick whatever you want I pick three five and six that'll work now if you're using a common anode led which is kind of rare most of them you'll find your common cathode but if you're using the common anode set that to true otherwise leave it a false next we're going to use the gamut table it's a bite type variable we'll get into that more later then we're going to create an instance of the Adafruit T cs3 for 725 called TCS and we'll use these values here which I'm not really going to get into now our setup our serial began at 9600 you could put it wherever you want a nice little happy message to get started now if the sensor starts correctly so if TCS begins then it's going to print out a nice little message sensor found if else if it doesn't start correctly it's going to say no sensor found and the program will stop next we need to set those pins for outputs if we don't set them for outputs nothing good will happen and then we have this little gamma thing here and this is going to convert those color values into more human eyeball readable values okay then we're going to come down here to our loop we're going to create some variables called clear red green and blue and we're gonna set our interrupts to false and turn on the LED and we're going to wait 60 seconds then we're going to do TCS get raw data we'll read the red we'll read the green we'll read the blue and we'll read the clear values then we'll turn off the LED and we'll print out those values then we're going to change them into some hex code using these values you see here and our gamma table then all we have to do is turn on our RGB LED using the analog write command red pin blah blah blah blah and go through there in a little turnaround ask for our calculations if you don't like the way your colors are coming out feel free to mess with the code okay that's it there's a link to the code down below alright the code has been uploaded and I have some color samples for us to look at the first one we're going to look at is red oh excuse me so I put red over there and we get a mostly red light next up is green the Verde we put the green over there we get a mostly green light finally we have yellow put that over there and we get a kind of yellow light it ain't real good but it's kind of yellow and then we have blue and we get a very nice blue light now if we go white I see no change whatsoever it doesn't know white it may it gets a little brighter that's all same with black we don't get much out of black but it does seem to know red pretty well green and the blue but it has definitely definitely has trouble with yellow just gives me a kind of a greenish color it certainly it works better than this crappy Chinese yup sensor so definitely better I'll put a link to this down below along with the code that's it I hope you guys enjoyed this if you did give me a thumbs up feel free to comment share and don't forget to subscribe wish me luck I should be gambling by the time you watch this video big thanks to all my patron especially the new patrons that came on board means a lot to me someone asked me I believe it was my Canuck friend a digger d if they wanted to contribute but didn't want to do patreon there's now a link down below to a paypal me slash learn electronics you can send the one-time PayPal donation if you want to help support the channel that's it I'm out peace [Music] you
Info
Channel: learnelectronics
Views: 32,241
Rating: 4.8577776 out of 5
Keywords: Adafruit TCS34725 RGB Sensor Demo, tcs34725 arduino, rgb color sensor arduino
Id: dCnjwxkWZ-w
Channel Id: undefined
Length: 7min 43sec (463 seconds)
Published: Mon Mar 05 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.