Exploring SPIKE™ Prime Sensors
Sensors provide robots with information about their environment. With the sensors that come with the SPIKE™ Prime core set, you can make a robot respond to being touched, react when someone or something comes too close, follow a line, determine its orientation, and much more.
Force sensor (touch, force)
The force sensor gives your robot a sense of touch. It can detect if it is being pressed and the amount of force being applied. It measures the amount of pressure being applied to it in newtons or as a percentage (with 100% corresponding to 10 newtons).
Key features
- Sensor sample rate: 100Hz
- Touch sensing activation zone: 0 to 2 mm
- Force sensing activation zone: 2 to 8 mm
- Activation on force: 2.5 to 10 newtons
- Resolution 0.1 newtons
- Accuracy +/1 0.65 newtons
Challenge suggestions
- Create a "cookie clicker" game that displays the number of times the force sensor has been pressed.
- Build a venus fly trap that closes when something touches it.
- With one or two force sensors, create a simple remote control for a robot car. Set the motor speed proportional to the amount of force.
- Make a robot begin its programmed action when the force sensor is pressed. This is particularly useful if, for example, the buttons on the hub are difficult to reach.
Color sensor (color, light)
The color sensor has three main modes: color, reflected light, and ambient light. It can also be used as a light source.
- Color - In this mode, the colour sensor can differentiate eight different LEGO colors. Each LEGO color is also represented by a value (see "Color and light data table" below). The sensor can also output the raw red, green, and blue (RGB) values separately.
- Reflected light intensity - In this mode, the color sensor emits a light and measures the amount reflected back into itself from the surface you are testing. The intensity of the light is measured as a percentage from 0 to 100, with 0 being very dark, and 100 being very bright.
- Ambient light intensity (Python only) - In this mode, the colour sensor measures the amount of light in its environment, without producing its own light source. Ambient light intensity is measured as a percentage from 0 to 100, with 0 being very dark, and 100 being very bright.
Key features
- Sensor sample rate: 100Hz
- Optimal reading distance: 16 mm (depending on object size, color, and surface)
- Three individually controlled LEDs (Python only)
Color and light data table
Mode | Output range |
---|---|
Color | -1 = No object 0 = Black (LEGO:26; R:0, G:0, B:0) 1 = Magenta (LEGO:124; R:144, G:31, B:118) 3 = Blue (LEGO:23; R:30, G:90, B:168) 4 = Turquoise (LEGO:322; R:104, G:195, B226) 5 = Green (LEGO:28; R:0, G:133, B:43) 7 = Yellow (LEGO:24; R:250, G:200, B:10) 9 = Red (LEGO:21; R:180, G:0, B:0) 10 = White (LEGO:01; R:244, G:244, B:244) |
Reflected light | 0% = no reflection, 100% = very reflective |
Ambient light (Python only) | 0% = dark, 100% = bright |
Challenge suggestions
- Sort LEGO bricks based on their colour.
- Drive across different coloured pieces of paper, responding to each color with a different action.
- Make a music player that plays different notes depending on the color detected
- Create a barcode reader.
- Program a robot to stop when it reaches the edge of a table (ie. it detects no reflected light).
- Create a line-following robot.
Distance Sensor
The Distance Sensor measures distance to an object or surface using ultrasound. The sensor works by sending out high frequency sound waves that bounce off any object in range, and measuring how long it takes the sound to return to the sensor. The Distance Sensor can also be used as a light source, with four LED segments around the "eyes" that can be controlled individually.
Additionally, the back of the sensor can be removed and the cable detached, effectively becoming a LEGO Power Functions 2.0 (LPF2) breakout cable. This may provide some opportunities for 3rd-party developers and advanced users. For example, see Mindsensor's Breadboard Connector Kit.
Key features
- Distance Sensing from 50 to 2000 mm
- Fast distance sensing from 50 to 300 mm
- White light output around the sensor “eyes” divided into four segments – two upper
- and two lower segments (Python only).
Challenge suggestions
- Program a robot to move around a room, avoiding objects in its path.
- Drive towards an object or a wall, slowing down as it gets closer.
- Create a kinetic sculpture (a sculpture that has moving parts) that moves when someone comes close to it.
Gyroscope/accelerometer (rotation, orientation)
In addition to the external sensors described above, the SPIKE Prime hub has a number of built-in sensors. These include a three-axis accelerometer and a three-axis gyroscope.
This combination of accelerometer and gyroscopes allows it to determine its orientation (i.e. front, back, top, bottom, right side, left side) as well as gestures (i.e. tap, free fall, and shake).
The hub can determine its rotation around any of its three axes using the gyroscope sensor. The measurements are known as pitch, roll, and yaw. For each axis, the gyroscope sensor measures the rate of rotation in degrees per second and keeps track of the total angle of rotation in degrees.
Challenge suggestions
- Program your robot to turn a specified angle.
- Program your robot to detect if it has fallen over.
- Display how far your robot has turned.
- Create a self-balancing robot.
Large and medium motors (rotation)
Because they are equipped with internal rotation sensors, both the medium and large SPIKE Prime motors can measure the motor’s speed and its position. Either motor can be used as an input device, reporting its position as it is rotated by hand.
The motors can measure their position in degrees either as an absolute position in reference to the zero point marked on the motor, or relative to another zero point of your choosing.
Key features
- Resolution: 360 counts per revolution
- Accuracy: ≤+/- 3 degrees
- Update rate: 100 Hz
Challenge suggestions
- Create a combination lock.
- Create a trundle wheel by attaching a wheel to the motor and using it to display the distance travelled.
- Invent a musical instrument that uses one more motors to control the pitch, duration, and/or volume of the notes.
Sensors included in the core and expansion sets
Here's a summary of the sensors included in the SPIKE Prime core and expansion sets:
Sensor | Core Set (45678) | Expansion Set (45680) |
---|---|---|
Force sensor (force, touch) | 1 | 0 |
Color sensor (color, light) | 1 | 1 |
Distance sensor | 1 | 0 |
Medium motor (rotation) | 2 | 0 |
Large Motor (rotation) | 1 | 1 |
SPIKE Prime Hub (gyro, accelerometer) | 1 | 0 |
For more information about the SPIKE Prime sensors, download the SPIKE PRIME Technical Specifications product sheets from the LEGO Education site.
Leave a Comment
Why is the infrared sensor not back?
Hi im currently working on a project which requires me to detect the depth of water. i have tried using legos ultrasonic sensor but it dosent work and dosent detect the depth of water. Any ideas on how i should overcome this problem
Do you have a favorite sensor-based activity to give your students? Did we miss something that everyone should know about a particular sensor? If so, please leave a comment.