COLOUR SENSOR – POWER UP YOUR ROBOT!
TOP TIPS ON USING THE COLOUR SENSOR
- Spend a little time thinking about how the sensors works
- Think the position of your sensor on the robot
- Be clear on what you are getting the colour sensor to sense. Remember it can sense colour, ambient light and reflected light. What are you looking to sense?
- Make use of the ‘Port View’ to see what your Colour is sensing
HOW IT WORKS – THE BASICS
The Colour Sensor will, as the name suggests, detect colour – seven ‘colours’ in fact. These are black, blue, green, yellow, red, white and brown. It can also detect when there is no colour – in other words it doesn’t sense any of the other seven colours.
It can tell the difference between black, blue, green, yellow, red, white and brown BUT it can also measure ambient light and reflected light.
LET’S ATTACH THE SENSOR…
When using the Colour sensor to detect colour on a surface or the reflected light from a surface, the position of the sensor is very important. The sensor generates the light that it needs so limiting the amount of external light that gets into the sensor is key. So a height of about 3 coins (5mm) seems to work really well. You could further adapt your sensor by fitting a ‘shield’ to minimise external light.
LET’S GET PROGRAMMING…
We are focusing on stopping and starting our robot – using colour, then ambient light and then reflected light.
Shows the Colour Sensor, sensing colour…
Shows the Colour Sensor, sensing reflected light… This will be really useful. Watch the video and get familiar with how it works.
FOLLOW A LINE
Get the robot to FOLLOW A LINE (or more accurately: FOLLOW THE EDGE OF A LINE) – it is a Mindstorms classic! There is a really nice tutorial on it so see the GREAT SUPPORT FROM LEGO EDUCATION section below. Or, I have annotated a program that I wrote for my robot – see if you can understand how it works. Maybe try it on your robot – but you will need to change some of the values. Experiment!
TO CALIBRATE OR NOT TO CALIBRATE?
Calibrating your sensor makes it more reliable when working in different lighting conditions. So if you have practised in a dark room but the competition table is in a bright room – things could get tricky with your colour sensor. Calibration teaches the sensor what is ‘Black’ and what is ‘White’ in the environment you are in. Remember – you can only do this on the Desktop version. You can run the program prior to your robot doing the Robot Mat.
GREAT SUPPORT FROM LEGO EDUCATION
From the LOBBY (the starting page), go to ROBOT EDUCATOR – BEYOND BASICS – and choose SWITCH – don’t be put off by the fact that it is in BEYOND BASICS! There is a really nice Sample Program within it – so you can change the settings and deconstruct how the program works.
I mention calibration above – from the LOBBY (the starting page), go to ROBOT EDUCATOR – BEYOND BASICS – and choose COLOUR SENSOR – CALIBRATE. You can’t calibrate on the TABLET software.
On the front screen (the Lobby) click on the right arrow. This takes you to the ROBOT EDUCATOR TUTORIALS and choose FOLLOW A LINE. There is a great Sample Program within it – so you can change the settings and deconstruct how the program works.