INTRO AND LEARNING GOALSWe love the EV3 Colour Sensor here at Raising Robots – it does so much more than it says on the label! What a multi-talented sensor this is! Here, we will look at how you can attach the sensor easily (for the different things it can sense) and get it up and running quickly…
- Understand how to attach the Colour Sensor to the robot – depending on its use
- Explore how to use LEGO® MINDSTORMS® Education software
- Create a program using the Colour Sensor block to start the robot when it is fed yellow ‘sweetcorn’
- Create a program using the Colour Sensor block to start the robot when it senses an increase in ambient light
- Create a program using the Colour Sensor block to stop the robot when it senses a decrease in reflected light – stopping at a black line
HOW IT WORKS – THE BASICSThe 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.
SOME TEACHING THOUGHTS… from John
- Always check that the Colour Sensor is set to the right mode – Colour, Ambient or Reflected. You can check this in the Port View in the bottom right hand corner when you are connected to the robot.
- Having the robot connected when programming is useful, as you get live readings that you can then use as the basis for your statements. These statements will trigger your sensor.
- You can calibrate your sensor for reflected light. This can be useful when doing such tasks as follow a line. I have highlighted the calibration task in the ‘GREAT SUPPORT FROM LEGO EDUCATION’ below.
ROBOT WORKOUT (WHERE NEXT?)
- Experiment with stopping at different colours (using coloured electrical tape on the floor is ideal). Are some colours better than others?
- Get the robot to follow 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.