MBC SharpShot Vision × EV3 Classroom

Read SharpShot Vision with EV3 Classroom in three steps

On the EV3, the SharpShot Vision shows up as a LEGO Infrared Sensor, so you do not import a library or add an extension: you read it with the Infrared Sensor blocks. Proximity gives the camera mode number, the heading and proximity of the 4 beacon channels are the 8 main values, and the 4 remote channels are 4 more values. What each value means depends on the mode chosen in the camera menu. Work down the steps on the left and the blocks on the right grow with you; these block pictures were built in EV3 Classroom 1.5.3 and exported straight from the software (English interface).

Verified on EV3 hardwareRun on real EV3 bricks on 2026-11-03 with shipping firmware v1.0-261101: the stock EV3 firmware (EV3-G infrared blocks, all 13 camera modes read slot by slot) and Pybricks v4 examples 1~4; ev3dev / EV3 MicroPython v2 checked against the mode table only (same as the LEGO infrared sensor). The EV3 edition cannot take commands from the hub; switch camera modes in the camera MENU.

1

Start: program start + repeat forever, pick the camera mode

You read the sensor again and again, every 0.1 seconds.

  1. Open EV3 Classroom and press "New Project".
  2. Drag "forever" from "Control" and attach it under the yellow "when program starts".
  3. Drag a "wait 1 seconds" block into forever and change the number to 0.1.
  4. Plug the camera into port 1 with an EV3 cable (the hub powers it). Choose the camera mode and sub-option in the camera's MODE menu and click the same mode number below (mode number = camera mode × 10 + sub-option). The table in step 2 changes to what each value means in that mode.
2

Meet the reading blocks (Infrared Sensor)

Use the Infrared Sensor blocks in "Sensors"; the number at the front of each block is the port: choose 1. The table shows, for the mode you picked in step 1, which block reads each value, what you get and how to read it:

Every value is a whole number from −127 to 100. Keep one program on Beacon (or on Remote) only: every infrared mode change makes the EV3 pause for about 1.1 seconds. To split tens and ones, use the math blocks: divide by 10 and round down, and the remainder after dividing by 10.

See the table for all 13 modes

Mode number 11 = Colour tracking ① Max colours

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1Colour 1 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 1Colour 2 X×10+Y (8×6 grid)0, 11–86②
heading to beacon 2Colour 3 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 2Colour 4 X×10+Y (8×6 grid)0, 11–86②
heading to beacon 3Colour 5 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 3Colour 6 X×10+Y (8×6 grid)0, 11–86②
heading to beacon 4Colour 7 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 4Colour 8 X×10+Y (8×6 grid)0, 11–86②
beacon 1 buttons pressedColour 9 X×10+Y (8×6 grid)0, 11–86②
beacon 2 buttons pressedColour 10 X×10+Y (8×6 grid)0, 11–86②
beacon 3 buttons pressedColour 11 X×10+Y (8×6 grid)0, 11–86②
beacon 4 buttons pressedColour 12 X×10+Y (8×6 grid)0, 11–86②
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② tens = X cell (1–8, left→right), ones = Y cell (1–6, bottom = 1); 0 = not seen. In pixels: X ≈ tens×20−10, Y ≈ 129−ones×20

Mode number 12 = Colour tracking ② Multi-colour

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1Colour 1 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 1Colour 2 X×10+Y (8×6 grid)0, 11–86②
heading to beacon 2Colour 3 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 2Colour 4 X×10+Y (8×6 grid)0, 11–86②
heading to beacon 3Colour 5 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 3Colour 6 X×10+Y (8×6 grid)0, 11–86②
heading to beacon 4Colour 7 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 4Colour 8 X×10+Y (8×6 grid)0, 11–86②
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② tens = X cell (1–8, left→right), ones = Y cell (1–6, bottom = 1); 0 = not seen. In pixels: X ≈ tens×20−10, Y ≈ 129−ones×20

The other 4 values are not used in this mode (always 0) and are left out.

Mode number 13 = Colour tracking ③ Standard

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1Colour 1 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 1Colour 1 area (% of the picture)0, 1–100 %③
heading to beacon 2Colour 2 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 2Colour 2 area (% of the picture)0, 1–100 %③
heading to beacon 3Colour 3 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 3Colour 3 area (% of the picture)0, 1–100 %③
heading to beacon 4Colour 4 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 4Colour 4 area (% of the picture)0, 1–100 %③
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② tens = X cell (1–8, left→right), ones = Y cell (1–6, bottom = 1); 0 = not seen. In pixels: X ≈ tens×20−10, Y ≈ 129−ones×20
  • ③ % of the whole picture; 0 = not seen

The other 4 values are not used in this mode (always 0) and are left out.

Mode number 14 = Colour tracking ④ Fine

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1Colour 1 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 1Colour 1 W×10+H (8×6 grid)0, 11–86③
heading to beacon 2Colour 1 count0–15④
proximity to beacon 2Colour 1 area (% of the picture)0, 1–100 %⑤
heading to beacon 3Colour 2 X×10+Y (8×6 grid)0, 11–86②
proximity to beacon 3Colour 2 W×10+H (8×6 grid)0, 11–86③
heading to beacon 4Colour 2 count0–15④
proximity to beacon 4Colour 2 area (% of the picture)0, 1–100 %⑤
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② tens = X cell (1–8, left→right), ones = Y cell (1–6, bottom = 1); 0 = not seen. In pixels: X ≈ tens×20−10, Y ≈ 129−ones×20
  • ③ tens = width in cells, ones = height in cells (1 cell = 20 px: width ≈ (tens−1)×20+10 px); 0 = not seen
  • ④ how many blobs of this colour (0–15)
  • ⑤ % of the whole picture; 0 = not seen

The other 4 values are not used in this mode (always 0) and are left out.

Mode number 21 = Colour at points ① Hue

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1S1 hue (EV3: positive = hue, negative = black/white)−15–100②
proximity to beacon 1S2 hue (EV3: positive = hue, negative = black/white)−15–100②
heading to beacon 2S3 hue (EV3: positive = hue, negative = black/white)−15–100②
proximity to beacon 2S4 hue (EV3: positive = hue, negative = black/white)−15–100②
heading to beacon 3S5 hue (EV3: positive = hue, negative = black/white)−15–100②
proximity to beacon 3S6 hue (EV3: positive = hue, negative = black/white)−15–100②
heading to beacon 4S7 hue (EV3: positive = hue, negative = black/white)−15–100②
proximity to beacon 4S8 hue (EV3: positive = hue, negative = black/white)−15–100②
beacon 1 buttons pressedS9 hue (EV3: positive = hue, negative = black/white)−15–100②
beacon 2 buttons pressedS10 hue (EV3: positive = hue, negative = black/white)−15–100②
beacon 3 buttons pressedS11 hue (EV3: positive = hue, negative = black/white)−15–100②
beacon 4 buttons pressedS12 hue (EV3: positive = hue, negative = black/white)−15–100②
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② positive = hue code×100÷240 (red 0, yellow ≈17, green ≈33, cyan 50, blue ≈67, purple ≈83; back to the hue code = reading×240÷100, ±2); negative = black/white/grey: −1 to −8 white→grey, −9 to −15 black

Mode number 22 = Colour at points ② Hue + saturation

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1S1 hue (EV3: positive = hue, negative = black/white)−15–100②
proximity to beacon 1S1 saturation÷10 ×10 + value÷100–99③
heading to beacon 2S2 hue (EV3: positive = hue, negative = black/white)−15–100②
proximity to beacon 2S2 saturation÷10 ×10 + value÷100–99③
heading to beacon 3S3 hue (EV3: positive = hue, negative = black/white)−15–100②
proximity to beacon 3S3 saturation÷10 ×10 + value÷100–99③
heading to beacon 4S4 hue (EV3: positive = hue, negative = black/white)−15–100②
proximity to beacon 4S4 saturation÷10 ×10 + value÷100–99③
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② positive = hue code×100÷240 (red 0, yellow ≈17, green ≈33, cyan 50, blue ≈67, purple ≈83; back to the hue code = reading×240÷100, ±2); negative = black/white/grey: −1 to −8 white→grey, −9 to −15 black
  • ③ tens = saturation÷10, ones = value÷10 (e.g. 74 = saturation in the 70s, value in the 40s)

The other 4 values are not used in this mode (always 0) and are left out.

Mode number 23 = Colour at points ③ Hue + sat + value

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1S1 hue code ÷100 (hundreds)0–2②
proximity to beacon 1S1 hue code remainder after ÷1000–99③
heading to beacon 2S1 saturation0–100④
proximity to beacon 2S1 value (brightness)0–100⑤
heading to beacon 3S2 hue code ÷100 (hundreds)0–2②
proximity to beacon 3S2 hue code remainder after ÷1000–99③
heading to beacon 4S2 saturation0–100④
proximity to beacon 4S2 value (brightness)0–100⑤
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② hundreds of the hue code (0–2): hue code = this×100 + the next value
  • ③ hue code remainder after ÷100 (0–99)
  • ④ saturation 0–100: bigger = more vivid
  • ⑤ value 0–100: 0 = black

The other 4 values are not used in this mode (always 0) and are left out.

Mode number 30 = Colour order

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1Hue of block 1 from the left (EV3: positive = hue, negative = black/white)−15–100②
proximity to beacon 1Hue of block 2 from the left (EV3: positive = hue, negative = black/white)−15–100②
heading to beacon 2Hue of block 3 from the left (EV3: positive = hue, negative = black/white)−15–100②
proximity to beacon 2Hue of block 4 from the left (EV3: positive = hue, negative = black/white)−15–100②
heading to beacon 3Hue of block 5 from the left (EV3: positive = hue, negative = black/white)−15–100②
proximity to beacon 3Hue of block 6 from the left (EV3: positive = hue, negative = black/white)−15–100②
heading to beacon 4Hue of block 7 from the left (EV3: positive = hue, negative = black/white)−15–100②
proximity to beacon 4Hue of block 8 from the left (EV3: positive = hue, negative = black/white)−15–100②
beacon 1 buttons pressedHue of block 9 from the left (EV3: positive = hue, negative = black/white)−15–100②
beacon 2 buttons pressedHue of block 10 from the left (EV3: positive = hue, negative = black/white)−15–100②
beacon 3 buttons pressedHue of block 11 from the left (EV3: positive = hue, negative = black/white)−15–100②
beacon 4 buttons pressedTotal number of blocks0–18③
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② positive = hue code×100÷240 (red 0, yellow ≈17, green ≈33, cyan 50, blue ≈67, purple ≈83; back to the hue code = reading×240÷100, ±2); negative = black/white/grey: −1 to −8 white→grey, −9 to −15 black
  • ③ blocks in the picture. Red's hue is 0, so read this first to know how many values are real

Mode number 41 = Line following ① Black line

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1Near offset−100–100②
proximity to beacon 1Middle offset−100–100②
heading to beacon 2Far offset−100–100②
proximity to beacon 2Line angle−90–90③
heading to beacon 3Near line width %0–100④
proximity to beacon 3Junction type×10 + line flags0–57⑤
heading to beacon 4Junction distance %0–100⑥
proximity to beacon 4Colour of the marker line just crossed0, 1–16⑦
beacon 1 buttons pressedNear line left edge−100–100⑧
beacon 2 buttons pressedNear line right edge−100–100⑧
beacon 3 buttons pressedFar line width %0–100④
beacon 4 buttons pressedMarker lines crossed so far0–99⑨
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② −100 to 100: line on the left = negative, right = positive (looking forward from behind the robot), 0 = centre
  • ③ line leaning to the upper right = positive, upper left = negative (degrees)
  • ④ line width as % of the picture width
  • ⑤ tens = junction (0 none, 1 cross, 2 T, 3 left, 4 right, 5 dead end), ones = line flags (near 1 + mid 2 + far 4: 7 = all three, 0 = no line)
  • ⑥ how far the junction is: 0 = bottom of the picture, 100 = top
  • ⑦ target colour of the marker line just crossed; 0 = none yet
  • ⑧ left / right edge of the near line (−100 to 100, like the offset)
  • ⑨ lines crossed so far (0–99)

Mode number 42 = Line following ② White line

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1Near offset−100–100②
proximity to beacon 1Middle offset−100–100②
heading to beacon 2Far offset−100–100②
proximity to beacon 2Line angle−90–90③
heading to beacon 3Near line width %0–100④
proximity to beacon 3Junction type×10 + line flags0–57⑤
heading to beacon 4Junction distance %0–100⑥
proximity to beacon 4Colour of the marker line just crossed0, 1–16⑦
beacon 1 buttons pressedNear line left edge−100–100⑧
beacon 2 buttons pressedNear line right edge−100–100⑧
beacon 3 buttons pressedFar line width %0–100④
beacon 4 buttons pressedMarker lines crossed so far0–99⑨
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② −100 to 100: line on the left = negative, right = positive (looking forward from behind the robot), 0 = centre
  • ③ line leaning to the upper right = positive, upper left = negative (degrees)
  • ④ line width as % of the picture width
  • ⑤ tens = junction (0 none, 1 cross, 2 T, 3 left, 4 right, 5 dead end), ones = line flags (near 1 + mid 2 + far 4: 7 = all three, 0 = no line)
  • ⑥ how far the junction is: 0 = bottom of the picture, 100 = top
  • ⑦ target colour of the marker line just crossed; 0 = none yet
  • ⑧ left / right edge of the near line (−100 to 100, like the offset)
  • ⑨ lines crossed so far (0–99)

Mode number 43 = Line following ③ Coloured line

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1Near offset−100–100②
proximity to beacon 1Middle offset−100–100②
heading to beacon 2Far offset−100–100②
proximity to beacon 2Line angle−90–90③
heading to beacon 3Near line width %0–100④
proximity to beacon 3Junction type×10 + line flags0–57⑤
heading to beacon 4Junction distance %0–100⑥
proximity to beacon 4Colour of the marker line just crossed0, 1–16⑦
beacon 1 buttons pressedNear line left edge−100–100⑧
beacon 2 buttons pressedNear line right edge−100–100⑧
beacon 3 buttons pressedFar line width %0–100④
beacon 4 buttons pressedMarker lines crossed so far0–99⑨
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② −100 to 100: line on the left = negative, right = positive (looking forward from behind the robot), 0 = centre
  • ③ line leaning to the upper right = positive, upper left = negative (degrees)
  • ④ line width as % of the picture width
  • ⑤ tens = junction (0 none, 1 cross, 2 T, 3 left, 4 right, 5 dead end), ones = line flags (near 1 + mid 2 + far 4: 7 = all three, 0 = no line)
  • ⑥ how far the junction is: 0 = bottom of the picture, 100 = top
  • ⑦ target colour of the marker line just crossed; 0 = none yet
  • ⑧ left / right edge of the near line (−100 to 100, like the offset)
  • ⑨ lines crossed so far (0–99)

Mode number 51 = Object detection ① Object list

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1Object 1 code (colour×10 + shape)0, 10–89②
proximity to beacon 1Object 1 X×10+Y (8×6 grid)0, 11–86③
heading to beacon 2Object 2 code (colour×10 + shape)0, 10–89②
proximity to beacon 2Object 2 X×10+Y (8×6 grid)0, 11–86③
heading to beacon 3Object 3 code (colour×10 + shape)0, 10–89②
proximity to beacon 3Object 3 X×10+Y (8×6 grid)0, 11–86③
heading to beacon 4Object 4 code (colour×10 + shape)0, 10–89②
proximity to beacon 4Object 4 X×10+Y (8×6 grid)0, 11–86③
beacon 1 buttons pressedObject 5 code (colour×10 + shape)0, 10–89②
beacon 2 buttons pressedObject 5 X×10+Y (8×6 grid)0, 11–86③
beacon 4 buttons pressedNumber of objects0–8④
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② tens = colour (target colour 1–8), ones = shape (0 other, 1 circle, 2 ellipse, 3 triangle, 4 square, 5 rectangle, 6 pentagon, 7 hexagon, 8 star, 9 trapezoid); 0 = none
  • ③ tens = X cell (1–8, left→right), ones = Y cell (1–6, bottom = 1); 0 = not seen. In pixels: X ≈ tens×20−10, Y ≈ 129−ones×20
  • ④ objects in the picture (0–8)

The other 1 values are not used in this mode (always 0) and are left out.

Mode number 52 = Object detection ② Object details

BlockWhat you getRangeRead
proximityCamera mode number (e.g. 13 = colour tracking ③ standard, 51 = object detection ① list)11–52①
heading to beacon 1Object 1 code (colour×10 + shape)0, 10–89②
proximity to beacon 1Object 1 X×10+Y (8×6 grid)0, 11–86③
heading to beacon 2Object 1 area (% of the picture)0, 1–100 %④
proximity to beacon 2Object 1 angle ((angle+1)÷2)0–90⑤
heading to beacon 3Object 2 code (colour×10 + shape)0, 10–89②
proximity to beacon 3Object 2 X×10+Y (8×6 grid)0, 11–86③
heading to beacon 4Object 2 area (% of the picture)0, 1–100 %④
proximity to beacon 4Object 2 angle ((angle+1)÷2)0–90⑤
  • ① tens = camera mode, ones = sub-option (e.g. 13 = colour tracking ③ standard)
  • ② tens = colour (target colour 1–8), ones = shape (0 other, 1 circle, 2 ellipse, 3 triangle, 4 square, 5 rectangle, 6 pentagon, 7 hexagon, 8 star, 9 trapezoid); 0 = none
  • ③ tens = X cell (1–8, left→right), ones = Y cell (1–6, bottom = 1); 0 = not seen. In pixels: X ≈ tens×20−10, Y ≈ 129−ones×20
  • ④ % of the whole picture; 0 = not seen
  • ⑤ ×2 gives the angle 0–179° (the camera sends (angle+1)÷2, within 1°)

The other 4 values are not used in this mode (always 0) and are left out.

3

Show it on the EV3 screen

Put the reading block into "write … at line …" from "Display", use "join" from "Operators" to put a name in front (for example C1), and start with "clear display". Functions are grouped by camera mode; dashed ones belong to another mode (clicking one switches the mode for you). Click a function and the blocks and result change to its example.

Simulated camera view: drag things in the picture and watch the output change

The view is a sketch: values come straight from where things are on screen (X 0–159 left→right, Y 0–119 top→bottom, area % = width × height ÷ whole picture); a hue code is the color the paper or block really has (red 0, yellow 40, green 80, blue 160, purple 200, white table 244, black tape 252). It is not the camera's own algorithm, and real numbers vary with the light. Color tracking assumes 4 colors were taught on the camera: color 1 red, 2 green, 3 blue, 4 yellow. In object detection you pick each shape yourself (the camera does not judge it here); objects 1, 2… are sorted by area, largest first; X, Y is the shape's centroid (white dot), the dashed box is its bounding box, and the angle is the rotation you set.

An example for every function

Every function has a small program you can copy (camera in port 1); the badge shows which modes it works in. "Try it" jumps to step 3 (and switches the mode if needed).

Full examples

Complete programs you can build and run (camera in port 1, motors in B and C). More examples (Python) are on the EV3 examples page.

Turn toward a blob (mode 13, left wheel B, right wheel C)

        

!Beacon channel 1 heading = colour 1 X×10+Y: 0 = not seen → spin to search; below 41 (X cells 1–3) → turn left; above 56 (X cells 6–8) → turn right; middle (cells 4, 5) → go straight. Teach "target 1" on the camera first and set the camera menu to mode 13.

Line following (mode 41 black line, left wheel B, right wheel C)

        

!Beacon channel 1 heading = near offset (line on the left = negative): left wheel 30 + offset×0.3, right wheel 30 − offset×0.3, so it turns toward the line. Not turning enough? Make 0.3 bigger.

Good to know

  1. Plug the camera into port 1. For another port, change the port number on the block. Switch the EV3 on first, then plug in the camera; if the numbers never change, unplug it and plug it in again.
  2. The mode number must match the camera menu. An EV3 program cannot switch the camera mode, and one value means different things in different modes; read the mode number with Proximity and check it at the start.
  3. Use Beacon only or Remote only in one program. Each infrared mode change makes the EV3 pause for about 1.1 seconds, and a racing robot can lose control.
  4. When the camera is unplugged: the EV3 cannot read it, the number becomes "not a number" and the screen shows ----; each reading waits about 1.2 seconds. The program does not stop and recovers when you plug it back in. Tick "Unplug the sensor" to see it.
  5. Colours are taught on the camera. "Target 1" is colour 1; sample spots are also set on the camera. The EV3 only reads the numbers.
  6. More: EV3 reading guide, Value reference: EV3. EV3 Classroom has only English and Simplified Chinese interfaces.