Home >Industry dynamics>Industry dynamics
Tutorial: Make your own OpenMV Image Recognition Module

Before discussing how to DIY an OpenMV, let’s first understand what OpenMV is.

What is OpenMV?

OpenMV is an open-source project developed abroad, designed as a small development board specifically for embedded machine vision applications. Its core advantages lie in its powerful image processing capabilities, programmability, and ease of use. It is especially suitable for fields like computer vision, image processing, artificial intelligence, and machine learning. OpenMV development boards support programming in Python, and with an easy-to-use IDE and extensive library support, they can handle tasks ranging from basic image recognition to complex machine vision applications.

In simple terms, OpenMV is a programmable camera that runs logic written in MicroPython (a subset of Python). It comes pre-loaded with some image processing algorithms, making it simple to use. Here's a brief introduction to what it looks like:

图片.png

What Can OpenMV Do?

  1. Embedded Machine Vision: With OpenMV, you can build innovative projects, learn computer vision, and explore algorithms like Fourier transforms, wavelet transforms, and filtering techniques in real-world applications.

  2. Cost-sensitive Embedded Industrial Solutions: OpenMV can be used for high-cost embedded industrial scenarios, such as sorting items on production lines.

What Skills Are Required to Learn OpenMV?

  1. Basic Python Programming Knowledge: Understand basic concepts like if-else statements, variable assignment, etc.

  2. Object-Oriented Programming (OOP) Concepts: Understand classes, objects, methods, and related concepts.

  3. Basic Microcontroller Knowledge: Understand concepts like I/O ports, voltage, serial communication, etc.

Why DIY OpenMV Instead of Buying One

  • DIY OpenMV:

    • Disadvantages: You need to purchase or design hardware components such as the camera module, microcontroller board (typically based on STM32 or similar microcontrollers), storage modules, etc. You’ll need to solder, wire, and assemble everything yourself, which could be challenging for beginners and requires hardware knowledge. The stability of a DIY OpenMV may not be as high as the official product.

    • Advantages: You can customize the hardware to suit your needs (e.g., additional sensor interfaces, specific processing capabilities, etc.), and it’s much cheaper than buying a pre-assembled version. Additionally, building it yourself will enhance your soldering, PCB layout, and Python programming skills. The OpenMV firmware is open-source and free to download from the official OpenMV website or GitHub.

  • Buying OpenMV:

    • Advantages: The OpenMV board is fully designed and assembled. You can simply purchase and use it, which saves time and avoids hardware-related concerns. Official OpenMV boards typically undergo strict quality control to ensure hardware stability and compatibility. Pre-made OpenMV boards come with integrated camera modules, interfaces, processors, and most of the components required for image processing applications.

    • Disadvantages: The cost of buying an OpenMV is relatively high. For instance, an OpenMV4 H7 R2 Cam module costs over 400 RMB, while a DIY version may cost around 100 RMB. Also, pre-assembled boards have fixed hardware configurations that are difficult to modify.

How to DIY OpenMV?

Step 1: Draw the Circuit SchematicHere’s a reference for the OpenMV hardware schematic:OpenMV Open Hardware Design


图片.png

Step 2: Gather the Hardware Components

  • STM32H7 Microcontroller: STM32H743IIK6.

  • Camera Module: OV5640 or a similar CMOS camera sensor.

  • Storage and Memory: SD card for storing image data and code.

  • Power Supply Module: You’ll need a DC-DC converter or LDO voltage regulator to provide stable 5V or 3.3V input to the STM32H7 and other peripherals.

  • JTAG/SWD Programmer: To debug and flash the STM32H7 microcontroller firmware.

  • Additional Sensors (optional):

    • Ultrasonic sensor for distance measurement.

    • Accelerometer for motion detection.

    • Gyroscope for orientation tracking.

    • Infrared sensor for simple object detection.

  • Other Components:

    • Buttons for reset or board restart.

    • LED indicators for power or status display.

    • Jumper wires and connectors for external sensor and power connections.

    • Enclosure (optional): For protection, you can design a 3D printed case or use an off-the-shelf case.

    • Heat sinks (optional): If the system works under heavy load, a heat sink may be necessary to cool down the processor.

Step 3: PCB Design and ManufacturingTo create a custom PCB, use PCB design tools such as KiCad, Altium Designer, or PCB creation platforms like JLCPCB. You can modify the OpenMV schematic for your specific needs.

For instance, JLCPCB offers two free PCB fabrication services per month, significantly reducing the cost of the PCB. After receiving your PCB, you can solder the components and flash the firmware using a programmer.

Step 4: Firmware and ProgrammingOnce the PCB is soldered, flash the OpenMV firmware onto the STM32H7. You can either use the OpenMV IDE or any other Python editor (like Thonny) in combination with the STM32 development environment (e.g., STM32CubeIDE) for debugging.

Once the firmware is installed, you can start programming using Python through the official OpenMV IDE.

Example Material Costs:

  • STM32H743IIK6: ~40 RMB each.

  • OV5640 Camera Module: ~35 RMB each.

  • SD Card: ~20 RMB each.

  • Power Module: ~20 RMB.

  • Various Resistors and Capacitors: ~10 RMB.

  • PCB Fabrication (free using JLCPCB): 0 RMB.

Total Cost: Approximately 150 RMB.

Development Environment and Toolchain:

  • OpenMV IDE: Official IDE for programming, debugging, and running Python code. If you choose not to use the OpenMV IDE, you can work with other Python editors like Thonny, combined with STM32CubeIDE.

Learning Resources:

If you're a beginner in programming, I recommend the following resources:

DIY Resources:

  • OpenMV4 H7 Plus PCB project on Bilibili


DIY-ing an OpenMV can be an educational and cost-effective way to learn about embedded machine vision systems. While it requires some initial effort in hardware assembly and programming, the process provides invaluable hands-on experience in circuit design, soldering, and embedded programming.


Recommend