LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting colors and signal duration. Is it possible?

Solved!
Go to solution

I have built a transport line in witch im going to transport some lego bricks and sort them in different color and sizes (2x2, 2x4)... My only sensor is a color sensor and i would like for it to also detect the length of the brick as well as the color. I have a set velocity on the conveyor-belt, so determing the size of the bricks shouldnt be impossible IMO. However, i dont know how...for example, Im thinking that it should be possible for the sensor to know the difference of detecting something for 0.5 sec and 1 sec

 

TLDR: help me sort my legobricks

0 Kudos
Message 1 of 97
(10,256 Views)

Hi

If no brick is present you get the background color, so make sure it is different from all other colors!

And then from the length of the color signal you know the length of the brick.

greetings from the Netherlands
0 Kudos
Message 2 of 97
(10,237 Views)

Thank you for replying!

I get what your saying, like I understand the physics behind it, but the issue here is that I'm not very familiar with labview blocks and how they work collectively... A code example would be much appreciated 


@Albert.Geven wrote:

Hi

If no brick is present you get the background color, so make sure it is different from all other colors!

And then from the length of the color signal you know the length of the brick.


 

0 Kudos
Message 3 of 97
(10,224 Views)

Can you send the vi that you have already. So I get a feeling of the sensor you have and the samplespeed available.

Any labview version will do.

greetings from the Netherlands
0 Kudos
Message 4 of 97
(10,220 Views)

Here is a sample VI... (like i said, i have next to no experience in labview) 

 

So this is what the system is supposed to do;

1) Random lego brick lands on the conveyor belt driven by one motor.

2) 1 Color sensor detects what color it is and how long it is 

3) This sends a command to a secondary motor which is supposed get in a specified position.

4) It also has to log the data. System needs to know what color and size is in what position

5) Also supppsed to make a user interface in which i can "order" any of the registered bricks (these are duplo-bricks) 

 

First problem for me is part 2) 

0 Kudos
Message 5 of 97
(10,217 Views)

Hi

I have to find the lego software as I don't have it installed at the moment, and maybe don't have the newer version maybe at all.

But As far as I can see you get a color enum from the measurement vi.

What you can do is skip at no color (do nothing) and count up as long as it is the same color and the number is a size for the length.

I see that you are programming in LV 15 and I will try to give you an idea on how to do this.

Assuming the color measurement vi is fast enough to count.

I'll try later today or tomorrow.

 

greetings from the Netherlands
Message 6 of 97
(10,209 Views)

Thank you so much! Really appreciate it 

0 Kudos
Message 7 of 97
(10,209 Views)

I've managed to create a switch that, when turned on, starts counting... (Switch simulates the color sensor) However, I would like for the counted time to reset to zero every time the switch turns off so that its easier to meassure the size of the bricks...(?) If you have a better, easier solution to this though, do so as you please. 

 

Really appreciate the help 🙂 

0 Kudos
Message 8 of 97
(10,198 Views)

Hi

Sorry I did not post earlier. But I have made an example with only fake vi's (not fake news) to show what is possible. I don't have the lego brick software at the moment but you can ask if you don't understand.

 

A shift register is a kind of memory during looping to remember old values.

 

USe your own enums from LEGO, mine are just arbitrary except that I copied the color but had to remove the type definition. Especially the 2 subVI's are almost empty.

 

And please use the error in and out connection to detect errors but also define the order of execution if parrallel wires are present.

 

 

greetings from the Netherlands
Download All
0 Kudos
Message 9 of 97
(10,177 Views)

Thank you so much! This is great 🙂

 

We'll work on this for a while, try to understand as much as we can, and then we're probably going to ask you a few questions later today as we're probably going to get stuck with some issues. 

0 Kudos
Message 10 of 97
(10,165 Views)