USB Webcam and Rock-Paper-Scissors¶
At the end of this tutorial the IPRO7AI Reef EVK with an OV5640 camera shows up on your computer as a USB webcam (UVC, MJPEG) over its USB-C port, with no driver to install; you watch it at 1280×720 or 640×360 in any camera app. You then switch to the defconfig_reef_rps configuration: the board recognises hand signs on the NPU, plays rock-paper-scissors with you and draws the game into the video it sends. Both are Reef configurations of the apps/multimedia/ipro7_uvc_cam application.
Prerequisites¶
- An IPRO7AI Reef EVK, an OV5640 FLEX-24 camera module and a USB-C data cable to your computer (it powers the board and carries the video).
- An IPRO Debug Probe or a 3.3 V USB-UART cable on U6 (115200 8N1; wiring in IPRO7AI Reef EVK) for flashing and the console.
- First FreeRTOS Application done, and the IntelProCube 0.7.0.1 command-line flasher installed as in Set Up Your Host.
- An app that opens a USB camera: QuickTime Player on macOS, the Camera app on Windows, or any V4L2 program such as
ffplayon Linux. The host uses the operating system's built-in UVC driver; INTELPRO has verified this on macOS.
Steps¶
-
Connect the camera. Unplug USB-C first. Insert the OV5640 module's flex cable into FPC1, check that SW7 is on CAM (camera pins to the IPRO7AI, camera supplies on) and SW8 on PWR, connect U6, and plug USB-C into your computer last.
-
Build the webcam configuration. From the SDK root:
Output:
apps/multimedia/ipro7_uvc_cam/build_reef_ov5640/build_out/ipro7_uvc_cam_IPRO7.bin. A plainmakewithoutDEFCONFIG=builds for another board (the IPRO7 EVB) and does not run on the Reef. -
Flash. Hold SW1 (BOOT), tap SW2 (RESET) and release SW1 to enter download mode, then flash from the IntelProCube directory with the standard 2 MB table:
Check the output for
[All Success](the tool exits with 0 even on failure). These two configurations do not use themfgpartition. -
Open the console and reset. Open the U6 port at 115200 baud and tap SW2. The console prints:
-
Check that the computer sees the camera. The board appears as
IPRO7 UVC Camwith USB VID/PID0x3896/0x0701: -
Watch it on the computer.
- macOS: open QuickTime Player, choose File > New Movie Recording, and pick
IPRO7 UVC Camin the menu next to the record button. - Windows: open the Camera app and switch to
IPRO7 UVC Cam. -
Linux:
The video comes in two sizes and the app on the computer picks one: 1280×720 (about 15 fps for a busy scene, limited by USB Full-Speed bandwidth) and 640×360 (30 fps).
- macOS: open QuickTime Player, choose File > New Movie Recording, and pick
-
Tune the sensor (optional). The console's
camcommand reads and writes OV5640 registers directly (register address and data in hex) and can print statistics over a grid of the frame:300aand300bhold the OV5640 chip ID (0x56,0x40).cam wr <reg> <hexbytes>writes registers, andcam grid [cols rows]prints the mean Y, U and V of each cell betweenGRIDandGRIDEND. Written values return to their defaults after a reset. -
Switch to the rock-paper-scissors configuration. Build
defconfig_reef_rpsand flash it as in step 3 (withbuild_reef_rpsin the path):Output:
apps/multimedia/ipro7_uvc_cam/build_reef_rps/build_out/ipro7_uvc_cam_IPRO7.bin. The hand-sign model is linked into the firmware, so there is no model to flash separately. -
Play. After a reset, open
IPRO7 UVC Camat 640×360 on the computer. The score bar is at the top and the message bar at the bottom; the box in the middle is what the NPU looks at, labelled live with the sign it sees. Hold your hand still in the box: the video counts down 3, 2, 1, the board captures your sign, picks its own at random and shows both moves and the score. The next round starts after your hand leaves the box.Type
rpsat the console for the model and game state:model : ready, <bytes> B from <source>, loaded in <ms> ms, <free> KB heap left npu : <frames> frames, 0 errors, <inferences per second> fps, last <ms> ms now : <current sign> <confidence>% (r <%> p <%> s <%> n <%>) game : round <n>, you <wins> me <losses> draw <draws>, conf >= 60%, mirror onCommand Effect rps goStart a round now, without waiting for a hand in the box rps resetReset the score rps mirror on\|offMirror the video left to right (on by default, like a mirror); use offwhen the viewer mirrors its own preview (Photo Booth, FaceTime)rps print on\|offPrint every classifier result on the console rps conf <percent>Confidence needed to count a sign (60 by default) rps dumpPrint one 128×128 frame as the NPU sees it, base64 between CAPBEGINandCAPEND(about 8 s at 115200 baud)
Verify¶
- The console prints
[UVC] Streaming pipeline started, and the computer listsIPRO7 UVC Cam(3896:0701). - Webcam configuration: the camera app shows live video and switches between 1280×720 and 640×360.
- Rock-paper-scissors configuration: the video shows the score bar, the box and a live sign label; a hand in the box starts the countdown, and the frame count on the
npuline ofrpskeeps rising.
Troubleshooting¶
| Symptom | Cause | Fix |
|---|---|---|
No IPRO7 UVC Cam on the computer |
A charge-only USB-C cable, or a non-Reef build was flashed | Use a data cable; check that you flashed the file from build_reef_ov5640 or build_reef_rps |
The console stops at Bringing up …, or the video is black |
The camera is not seated, or SW7 is not on CAM | Unplug USB-C, reseat the camera cable, set SW7 to CAM and power up again |
| Low frame rate at 1280×720 | USB Full-Speed bandwidth: busier scenes make bigger MJPEG frames | Use 640×360 (30 fps) |
| Rock-paper-scissors is mirrored the wrong way | The viewer mirrors the video as well | Type rps mirror off |
| A hand in the box does not start the countdown | Confidence below the threshold, or the hand is off-centre | Watch the results with rps print on; improve light and distance; try rps conf 50 |
No [All Success] from the flasher |
Not in download mode, or --chip-variant IPRO7AI is missing |
Enter download mode again; check the command |
Next steps¶
- IPRO AI Teach: train a classifier on your own images and deploy it to the Reef (the image mode of
ipro_reef_teachuses the same camera pipeline). - Camera & Imaging: the image pipeline, ISP channels and supported sensors.
- AI & NPU: NPU inference and models.
- Wi-Fi and RTSP Camera Stream: send the camera video over Wi-Fi with RTSP instead.