Back

Unihiker K10 Lesson 5

Introduction:

The UNIHIKER K10 includes a built-in camera module that lets you display live video, take pictures, and simulate AI detection features like face tracking. In this lesson, you will control the camera feed, capture images, and draw visual overlays to simulate face recognition. These features help you build creative projects like smart photo booths, interactive kiosks, or beginner-level computer vision systems.

What You’ll Learn:

  • How to show the live camera feed

  • How to capture images using MicroPython

  • How to simulate a face detection overlay

  • How to combine camera and UI for smart applications


đź“· Showing the Live Camera Feed

python
from pinpong.board import Board from pinpong.libs.unihiker import GUI Board().begin() screen = GUI() # Show live camera feed screen.show_camera()

With just a few lines, you can display the camera feed directly on the UNIHIKER K10’s screen. You don’t need any external library or setup—just run the code and see what the camera sees.


📸 Capturing a Photo

python
from pinpong.libs.unihiker import Camera import time camera = Camera() time.sleep(2) # Let the camera adjust before capturing camera.capture("snapshot.jpg") screen.draw_string(80, 200, "Image Captured!", color=(0, 255, 0))

This script captures an image and saves it as snapshot.jpg in your device storage. You can open the image later or send it over Wi-Fi in more advanced projects.


đź§  Simulating Face Detection

You can draw a bounding box where a face might appear:

python
screen.draw_rect(100, 60, 100, 100, color=(255, 0, 0)) screen.draw_string(110, 170, "Face Detected")

For now, this is a manual simulation. In future lessons or firmware updates, you might replace it with real AI face detection using TinyML or an edge-based model.


🔍 Expand Your Project

  • Create a selfie button using the physical input

  • Save pictures only when light exceeds a threshold

  • Combine it with temperature readings for a “visitor log”


Conclusion:
You now have control over the camera, can display its feed, take pictures, and simulate face detection visually. This unlocks creative use cases—from educational tools to interactive kiosks. With a bit of imagination and coding, your K10 becomes a full multimedia device. In the next lesson, we’ll explore how to send sensor data over Wi-Fi, completing the foundation for your own IoT ecosystem.

Leave A Reply