VISCORE
← All works

Robotics & EmbeddedJul – Aug 2025Completed

Simple Aiming Device

2025 electronics design contest, Problem E: detect a rectangular target on a K230 and send the centre coordinates to the gimbal controller in real time.

Vision algorithm and core controlTeam entry

Second Prize, Sichuan Division · 2025

  • K230 CanMV
  • MicroPython
  • cv_lite
  • ulab
  • UART
  • Touchscreen
On-device shape detection with touch tuning

Background

The device has to find the target centre reliably under changing light and perspective distortion, then drive the gimbal. Capture, detection, display, communication and on-site tuning all run on one K230, and parameters must be quick to change at the contest venue.

What the system does

K230 camera capture→rectangle detection→centre calculation→serial output→gimbal controller
  • Detects the rectangular target in real time and computes its centre
  • Sends coordinates and status to the main controller over serial
  • Tuning on the touchscreen, with parameters kept across power cycles

My work

  • Rectangle detection: Canny edge detection from cv_lite plus polygon approximation to find the rectangle. The K230 handles capture, display and communication at the same time, so detection uses lightweight image operators.
  • Centre calculation: the centre is the intersection of the two diagonals, not the contour centroid. Under perspective distortion the centroid drifts; the diagonal intersection stays accurate.
  • Serial protocol: designed a frame with a header and a trailer carrying the coordinates and a detection flag, and completed integration with the main controller.
  • On-site tuning: built tuning buttons on the touchscreen; parameters are written to a file on the board and restored after a restart. When the lighting changes, thresholds can be adjusted on the spot without touching the code.

Problems and fixes

Hard to tell which layer is at fault. Capture, display and communication share one board, so unstable detection could come from image quality, detection logic or serial reception. Debugging verified the three layers separately: the image first, then the detection result, then the data the controller actually received.

Results

  • Second Prize, Sichuan Division, 2025 National Undergraduate Electronics Design Contest.
  • On-site tuning and controller integration were the two skills this contest built up most.

Retrospective

  • The first serial receiver was not stable enough with partial and concatenated packets. The steel-ball project a year later switched to a byte-by-byte state machine specifically to fix this.

Project images

Touch menu on the board with 12 entries
Technical notes
  • Capture: sensor configured at 90 fps (a setting in the code, not a measured frame rate).
  • Serial: UART2 at 115200; frame format 0x55 + "x,y,flag" + 0x66.
  • Tuning: 800×480 touchscreen with 10 tuning buttons; parameters are stored on the board in /data/positions.json.