Hi, I need to make a circuit which does the following thing: When it sees a red object it will send output 0 until it sees a green objec= t (like a well colored cubic toy), after it sees green it will send output = 1 until it sees red again. ( If it is hard to implement I'm ok with just ou= tput 0 when it sees red and outputs 1 when it sees green, I mean it is ok i= f the outputs not continuous but it would be great if they are continuous)= =20 I have basys3 and have to use VHDL. I think I should use TCS34725 sensor ht= tps://www.adafruit.com/product/1334 but I'm not sure I just assumed, I woul= d be really glad if someone helps Some extra questions: If it is possible I will implement it on a toy RCcar = is it possible to connect it with Bluetooth module to get inputs or how sho= uld I do it ?- I can use another board JUST FOR CONNECTIONS my main Project= should be on BASYS-3 Thanks =20
Color sensor with BASYS3 VHDL
Started by ●March 18, 2019
Reply by ●March 18, 20192019-03-18
On Monday, March 18, 2019 at 2:28:50 PM UTC-4, utkud...@gmail.com wrote:> Hi, I need to make a circuit which does the following thing: >=20 > When it sees a red object it will send output 0 until it sees a green obj=ect (like a well colored cubic toy), after it sees green it will send outpu= t 1 until it sees red again. ( If it is hard to implement I'm ok with just = output 0 when it sees red and outputs 1 when it sees green, I mean it is ok= if the outputs not continuous but it would be great if they are continuous= )=20>=20 > I have basys3 and have to use VHDL. I think I should use TCS34725 sensor =https://www.adafruit.com/product/1334 but I'm not sure I just assumed, I wo= uld be really glad if someone helps>=20 > Some extra questions: If it is possible I will implement it on a toy RCca=r is it possible to connect it with Bluetooth module to get inputs or how s= hould I do it ?- I can use another board JUST FOR CONNECTIONS my main Proje= ct should be on BASYS-3>=20 > ThanksAre you familiar with finite state machines (FSM)? I think FSM will be the= best circuit for this task since you want it to remember which color it la= st saw. =20 The inputs to the FSM will need to come from a much more complex circuit th= at reads the state of the color sensor via I2C and makes a decision as to t= he color it is seeing. This will need to pick three states of the input co= lor, red, green and neither. =20 To get the color data to make these decisions will require a controller cir= cuit to read the registers in the chip. Looking at the data sheet it looks= like this is not completely straight forward but requires a sequence of op= erations to make the chip sample the light through ADCs. So you should mak= e sure you understand this process. You may want to read the library code = to see the sequence of operations implemented there while correlating that = with the data sheet. =20 So read the data sheet, look at the code and make sure you understand what = is required to get the data out of the color sensor. Once you design that = circuit you can try testing it by just driving I/O lines with the data valu= es and looking at them on the oscilloscope. If you pump the samples out se= rially, you can see it on the oscilloscope with the low order bits toggling= furiously but the higher order bits fairly stable but changing as you chan= ge colors. =20 When you think you are reading the color chip correctly, add the circuit to= weight the values and produce the two signals "red" and "green". See if y= ou can get these to work. =20 I would say you should construct a test bench and simulate it, but explaini= ng to you how to construct a model of the color chip might be more than you= can do. If you think you can do that, the test bench would be much better= than working on the actually FPGA because you can "see" any signal in the = design.=20 Rick C.