Legacy edition, no longer supported: SharpShot Vision units shipped before 2026-10 (School and WRO editions) are no longer supported; their guides and examples stay here for reference. To upgrade to the current SharpShot Vision, contact the distributor you bought it from and send it back: the firmware update is free, and the buyer pays shipping both ways. Looking for the current SharpShot Vision? →
MBC SharpShot Vision WRO edition (HUE12) × Arduino

Read the SharpShot WRO edition with Arduino in three steps

An Arduino program goes in this order. First wire it up and paste the helper. Then, in setup(), start talking and wait until the SharpShot is ready. Last, in loop(), read all 12 colour spots at once with mbcReadMany(). Follow the steps on the left, and the program on the right grows with you. Click the boxes in the simulated camera picture to change colours and see what the Serial Monitor shows.

1

Wire it up and paste the helper

Arduino talks to the sensor over I2C (4 wires). You do not need to install a library. Write 2 lines at the very top and paste a "helper" at the very bottom. Then you can read values with mbcRead() and send commands with mbcWrite().

Which board do you use? (Only the SDA / SCL pins change. The program is the same.)

  1. Unplug the USB cable before wiring. Use the Universal I2C edition (the SPIKE and EV3 editions have different firmware and cannot connect to Arduino).
  2. Sensor VCC → 5V, GND → GND
  3. Sensor SDA → A4, SCL → A5
  4. On the SharpShot connector, IO3 = SDA and IO1 = SCL. The SharpShot must have the WRO edition (HUE12) I2C firmware: the EV3 and SPIKE editions use the same pins for serial, so it is one or the other.
  5. Set up the colour spots on the SharpShot first: with the screen and buttons on the back, turn on the spots S1–S12 you need and aim them at the mat. The settings are stored on the device. The Arduino only reads the results; a program cannot change them.
  6. Open the Arduino IDE: File → New, and delete what is already there.
  7. Write lines 1 and 2 at the very top. Paste the "helper" at the very bottom (marked ① in the program on the right; "Copy program" copies it too).
2

Start talking and wait until the sensor is ready

setup() runs only once, when the board starts. It opens the serial port, starts I2C and waits until the sensor says "I am ready". ADDR is the sensor's "house number" (its I2C address). You write it every time you read a value.

The sensor's I2C address:

If the sensor is not found:

3

Use a function

To read a value, write "mbcRead(ADDR, id)". To send a command, write "mbcWrite(ADDR, command)". Click a function, and the program and the Serial Monitor change to its example.

Simulated camera picture (12 spots in a row): click a box to change its colour and watch the Serial Monitor on the right
Colour to paint (pick a colour, then click a box above):

The picture is only an illustration: each colour uses one sample number. Real colour codes and vividness change with the light and the object. You set the positions of the 12 spots on the SharpShot; here they sit in a row so they are easy to see (spot 1, S1, is on the far left). The red frame = spot 1, which the examples read. Under each box: the spot number, then the colour code (0x10–0x1B), then the vividness (0x20–0x2B). When the sensor is unplugged, every value the Arduino reads is -32768.

An example for every function

13 functions (colour codes and vividness of the 12 spots, and the shared ids every MBC sensor has). Each one has a short example. Press "Try it" to jump to step 3. The program and the Serial Monitor on the right change to that example.

Full examples

Press "Copy" to get the whole program (the helper is already at the bottom). Paste it into the Arduino IDE and upload.

All 12 colour spots at once

        

!Every 0.5 s it prints the 12 spots as 12 lines: colour codes 0x10–0x1B in one call of 12, vividness 0x20–0x2B in one call of 12. Each line shows the colour name, the colour code and the vividness. The colour limits are in printCodeName at the bottom; adjust them for the light where you are.

Turn by the colour of spot 1 (L298N motor driver)

        

!When spot 1 (S1) sees red, the robot spins right; green, it spins left; any other colour, it stops. It also stops when it cannot read the SharpShot. Only change the "things you can change" at the top. Green does nothing? First use "All 12 colour spots at once" to see your green code, then change GREEN_MIN and GREEN_MAX. A wheel turns the wrong way: set its REVERSE to true. Connect the L298N GND to the Arduino GND.

Say hello (School or WRO edition?)

        

!Run this first every time you connect a new SharpShot: it prints the factory address, the edition (high byte of 0xF0: 1 = School, 2 = WRO), the protocol version, the firmware version and the uptime. Both editions use address 0x4C, so this is how you tell them apart.

Good to know

  1. Unplugging does not stop the program. When the SharpShot cannot be read, mbcRead() gives -32768 (MBC_NONE) and mbcReadMany() gives false. Plug it back in and it works again. Ids the WRO edition does not have (for example the School edition ids 0x01–0x0A) also read -32768. Tick "Unplug the sensor" on the right to see this.
  2. Do not delete delay(2) in the helper. The SharpShot is an ESP32-based slave. It cannot hold the I2C clock while it gets the data ready (no clock stretching), so after writing the id you must wait 2 ms. Without it you read the previous data. The SharpShot needs a few seconds to boot (camera and screen), so mbcWaitReady() waits up to 8 s. Set the Serial Monitor to 115200 baud.
  3. Reading the colour code (0x10–0x1B): 0–239 = a colour: hue 0–255 scaled to 0–239; multiply by 360 and divide by 240 to get the angle on the hue ring (red is at both ends: 0–9 and 220–239, yellow about 40, green about 80, cyan about 120, blue about 160, purple about 180–219). 240–245 = white (saturation below 30; the less colourful, the bigger the number). 246–250 = black (brightness below 30; the darker, the bigger the number). 255 = this spot is turned off. 255 only means "off": a spot that is on but not aimed at anything still gives the colour it sees there.
  4. Vividness (0x20–0x2B) is the saturation at that spot, 0–255: bigger = more vivid. Black is always 1; a spot that is off gives 0. White has a very low vividness (below 30), so you can use it to tell "white" from "a very pale colour".
  5. Read all 12 at once. The colour code of spot N is 0x10 + (N − 1) and its vividness is 0x20 + (N − 1). Each group has 12 ids in a row, so mbcReadMany(ADDR, 0x10, 12, code) reads all 12 from the same moment (the SharpShot updates every 10 ms). One call can read at most 16 values, so read the colour codes and the vividness in two calls.