Close

Colour sensing

A project log for Colour sorting machine for Lego

Automatically sort random Lego pieces by colour!

robgRobG 01/08/2024 at 12:080 Comments

I've parked the feeder problems for now, since the TCS34725 colour sensor arrived in the post the other day and I've been playing with that instead.

I knew it was going to be tricky, and I wasn't wrong, but it's halfway there. I can now classify a brick from a library of 'known' colours with reasonable success, even when it's placed at different distances (and therefore vastly different lighting/brightness) from the sensor. I'm using a modified form of the 'redmean' colour distance algorithm, extended to include a fourth brightness dimension using a weighting factor that I'm still experimenting with. 

I'm also going to try and find a tiny lens to fit to the sensor, so that its field of view is focussed to a small spot, meaning that the Lego piece size doesn't matter too much. I'll probably also try a separate, more distant light source so that lighting is a bit less dependent on sensor distance.

Nothing much to see yet, photos to follow...

Discussions