Colour, Tilt and Touch — Reading the Robot's Other Senses
Calibrate Alvik's RGB colour sensor, read tilt and rotation from its inertial measurement unit, and combine both with the capacitive touch buttons into one responsive program.
What students learn
Students learn that a colour sensor reports three numbers rather than a name, that classifying those numbers requires calibration, and that an accelerometer measures tilt by sensing which way gravity points. They then fuse three sensor streams into a single event-driven program.
The science behind this experiment
- Alvik's colour sensor sits underneath the robot and measures reflected red, green and blue light from an illuminated surface.
- The sensor returns three numbers, not a colour name — turning those numbers into "red" or "blue" is a classification step that depends on calibration.
- Ambient light changes the reflected values, which is why the sensor has its own illuminator and why calibration must be repeated when lighting changes.
- The LSM6DSOX is a 6-axis inertial measurement unit: a 3-axis accelerometer that senses gravity, plus a 3-axis gyroscope that senses rotation rate.
- An accelerometer at rest measures the 9.8 m/s² of gravity; the direction of that vector relative to the chip is what gives roll and pitch.
- Gyroscopes measure how fast the robot is turning, so their output must be integrated over time to get an angle — which is why they drift.
Key relation: Tilt from gravity: pitch = arctan( a_x ÷ √(a_y² + a_z²) ). Colour distance between two readings: d = √((ΔR)² + (ΔG)² + (ΔB)²).
Equipment used
- Arduino® Alvik robot
- Coloured card set — red, green, blue, yellow, white, black
- Desk lamp for controlled lighting
- Protractor or an angle app on a phone
- Books or a ramp to set known tilt angles
- Notebook for the calibration table
Questions for students
- A recycling robot must sort objects that look similar to a simple RGB sensor. What extra measurements or sensors would make the decision reliable, and what would each cost?
- Your program stops the robot when pitch exceeds 25°. What could go wrong with this rule while the robot is driving fast over a bump, and how would you make it more robust?
What to expect
Each coloured card produces a distinct and repeatable set of RGB values under fixed lighting; changing the lighting shifts every value. Tilt readings track the real angle closely, and the combined program responds instantly to touch, colour and being picked up. Sensors report numbers, not meaning. A colour sensor gives three intensities that only become a colour name after calibration, and an inertial unit gives tilt by measuring gravity and rotation rate. Turning raw numbers into reliable decisions — and knowing when those decisions will fail — is the core skill of working with any sensor.
Run this experiment in your classroom
This experiment is part of ATP Volta — a self-contained mobile science lab that turns an ordinary classroom into a working STEM laboratory, with over 200 experiments in physics, chemistry, biology, robotics and engineering. Gali, the AI tutor built into ATP Connect, guides students through each step and answers their questions at the bench.
See the ATP Volta mobile science labTalk to our team