Low power consumption camera pre-recording system and method thereof
Patent Information
- Application Number
- CN202510402468.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2026-10-16
AI Technical Summary
[0085] Therefore, the advantages of this solution are as follows: By introducing a pre-recording module and a low-power battery camera, in the absence of humans or animals, the PIR is not triggered. At this time, the battery camera is turned off or put into sleep mode to save power. The pre-recording module is a low-power module that is cyclically recording small-resolution images. When the PIR is triggered, the main control is woken up and the pre-recording module transmits the recorded image data to the main control for processing and encoding into the images acquired by the main control to fill the critical image data during the system startup period. This improves the user experience while having minimal impact on the overall standby time of the battery camera.
Smart Images

Figure CN122934055A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of low-power products, and specifically relates to a low-power camera pre-recording system and method. Background Technology
[0002] In the existing technology, traditional low-power battery cameras have the following characteristics: they rely on PIR to wake up the main controller to realize image capture or video recording. This process includes main controller hardware reset, image sensor reset, system startup, image sensor configuration and image capture. Thus, from triggering PIR to the image sensor capturing the image and the main controller processing the image, a certain amount of time is required. During this time period, some key data of the image may be lost.
[0003] For low-power products, it takes a certain amount of time from PIR wake-up to image capture, and a lot of critical information cannot be obtained in a timely manner.
[0004] Traditional battery-powered cameras wake up the main controller and image sensor after PIR triggering. After the embedded system starts up, it begins to process the image captured by the image sensor and compresses and encodes it into a video stream by the encoding module. This process usually takes more than 300ms. However, this may result in incomplete video or loss of critical data.
[0005] Therefore, the existing technical solutions have the following drawbacks:
[0006] Traditional cameras wake up and start the system after a PIR trigger. However, there is no video footage during the time it takes for the system to start recording. People or objects moving quickly or very close to the lens cannot be captured. In other words, traditional low-power battery cameras use PIR triggers to wake up the main control system, a process that takes time. If people or animals are moving quickly or very close to the camera lens during this time, the camera may fail to capture crucial image data, impacting the user experience.
[0007] In addition, the technical terms in this field include:
[0008] PIR stands for Passive Infrared, also known as Pyroelectric Infrared, which is a sensor that detects infrared radiation emitted by the human body and outputs an electrical signal.
[0009] MCU: Microcontroller Unit, also known as a single-chip microcomputer or single-chip microcomputer. It is a computer chip that integrates a central processing unit (CPU), memory, input / output (I / O) interfaces, timers, counters, and other necessary components onto a single chip.
[0010] Video encoding is the process of converting raw video data into a compressed format for easier storage and transmission. This process involves multiple steps and technologies, primarily including: Compression techniques: Video encoding uses various compression techniques to reduce the size of video files while maintaining video quality as much as possible. For example, entropy coding is a lossless compression technique used to further compress video data that has already undergone transformation and quantization; Standards and formats: Video encoding follows a series of international standards (such as H.264, H.265, etc.), which are developed by international organizations (such as ITU-T and ISO / IEC) to ensure consistency and interoperability of encoding; Encoders: Video encoders are hardware or software devices that perform these encoding operations. They are responsible for converting the raw video signal into a compressed format for transmission or storage over networks or on storage media; Necessity: Because uncompressed video data is typically large in size and difficult to transmit and store, video encoding enables high-definition video content to be transmitted and stored smoothly under limited bandwidth and network conditions.
[0011] ISP (Image Signal Processor) is a unit specifically designed to process the output signal of the front-end image sensor. Its main purpose is to match image sensors from different manufacturers. This module plays a crucial role in the camera, processing image signals at high speed through a pipelined image processing engine. The ISP module also incorporates dedicated circuitry for functions such as Auto Exposure, Auto Focus, and Auto White Balance.
[0012] gpio: A general term for chip input and output.
[0013] U-Boot: Short for Universal Boot Loader, it's an open-source bootloader primarily used in embedded systems. Its function is to initialize the hardware, load the operating system kernel into memory, and execute it. Suspend: This puts the system into a slumber state (Suspend-to-RAM). In this state, the controller saves the current running state and data to RAM, then shuts down the system to save power. When the controller is woken up, it restores the previous running state and data from RAM. Summary of the Invention
[0014] To address the aforementioned issues, the purpose of this application is to introduce a MCU-based pre-recording module. This module continuously records video in a loop, with the number of frames recorded and saved dynamically configurable. When the PIR is triggered, the main control starts, and the pre-recording module transmits the recorded image data to the main control. The main control processes the data and encodes it before sending it to the real-time stream. This application's technical solution introduces an MCU to achieve real-time pre-recording. After the PIR is activated, the pre-recorded image data from the MCU can be retrieved and packaged into a video packet, thus preserving key image information.
[0015] Specifically, the present invention provides a low-power camera pre-recording system, the system comprising: a main controller, which is a system-on-a-chip with a high-performance processing core, capable of handling complex tasks and large amounts of data, and integrating numerous functions including image processing, audio processing, and complex algorithm acceleration modules;
[0016] The pre-recording module, based on an MCU, can continuously record video in a loop, and the number of frames recorded and saved can be dynamically configured. The pre-recording module consists of a low-power MCU, with power consumption ranging from a few milliwatts to tens of milliwatts, a low-performance main frequency of only tens to hundreds of MHz, a small-resolution low-power image sensor including only 360P (640*360) or even lower resolution, and a storage unit. It is used to record images in a loop and store the recorded image files or send them to the main controller through a standard interface.
[0017] The camera power-on module is used for initial power-on and initialization of various modules, including the MCU and image sensor. Here, the MCU refers to the MCU of the pre-recording module.
[0018] Status transmission is used by the MCU to pass the initial power-on status to uboot, and uboot determines whether it is the first power-on based on the flags provided by the MCU.
[0019] The initialization unit of the pre-recording module is used to initialize the pre-recording module and start the Linux operating system upon first power-on, and configure the image sensor to output high-resolution images;
[0020] The image processing module is used by the main controller to process image data acquired by the image sensor;
[0021] The hibernation detection module is used by the main controller to receive hibernation commands and determine whether there is a pre-recording enabled flag.
[0022] The pre-recording configuration unit of the pre-recording module is used to configure the number of image frames to be recorded and saved in a loop by the pre-recording module when pre-recording is enabled, and to start the pre-recording module to start recording low-resolution images in a loop.
[0023] The power control module is used by the MCU to control the image sensor and main controller to power down or go into sleep mode;
[0024] If the main controller supports suspend mode, the current running state and data are saved to memory during hibernation and the system is quickly restored upon wake-up.
[0025] The PIR detection module is used to detect when the PIR sensor is triggered by infrared to bring the main controller into working state; that is, it includes a PIR sensor for detecting the presence of people in the environment. When it detects the movement or presence of a person, it outputs a high-level signal to trigger the MCU to control the main controller to power on or wake up.
[0026] The wake-up module is used to control the main controller to power on or wake up when the PIR is triggered, and to pass the non-first power-on flag to uboot;
[0027] The pre-recording stop unit of the pre-recording module is used by U-Boot to obtain a flag indicating whether pre-recording is enabled. If enabled, it sends a command to the pre-recording module to stop pre-recording.
[0028] The main control initialization unit is used to initialize the main control and configure the image sensor to output high-resolution images; the image frame confirmation module is used by the main control to send instructions to the pre-recording module to confirm the number of image frames cached by the pre-recording module and to retrieve the frames.
[0029] The data transmission module is used by the pre-recording module to transmit the images that are saved in a loop to the main controller DDR via SPI, where the main controller processes and encodes them into a video stream.
[0030] The image stitching module is used by the main controller to process the high-resolution images acquired in real time by the image sensor, and stitch the real-time acquired image data to the image data acquired by the pre-recording module to form a complete video stream and save it.
[0031] The power management module is used to power on or wake up the main controller and image sensor;
[0032] The battery voltage detection module is used by the MCU to determine whether the camera's battery voltage supports continued operation. If it does, the MCU returns the power control module; otherwise, all modules are powered off and the camera is turned off.
[0033] The End module is used to terminate the process.
[0034] The pre-recording module and the main controller use the same image sensor, but with different resolutions. The pre-recording module uses low-resolution images, including 360P (640*360) or even lower resolutions, while the main controller uses high-resolution images, including 1080P (1920*1080) or higher, such as 1296P, 1440P, 1620P, and 2160P. The resolution is determined by the configuration of the image sensor, and here the resolution refers to the width and height of the image data.
[0035] The main controller processes the RAW data transmitted by the image sensor through the ISP module, performs image correction, color management, and noise reduction operations, and encodes the processed data into H264, H265, or JPEG format for storage.
[0036] The MCU continuously monitors the battery voltage. When the detected battery voltage is lower than the set threshold, it controls each module to power down and the camera to shut down.
[0037] This application also relates to a low-power camera pre-recording method, which is applicable to any of the systems described above, and the method includes:
[0038] Step 1: Power on the camera and initialize all modules, including the MCU and image sensor; this further includes S1-S3:
[0039] S1: Camera powered on;
[0040] S2: Power on all modules. Upon initial power-on, all modules of the camera will be powered on.
[0041] S3: Initialize the MCU to prepare for the subsequent pre-recording module and power control of each module;
[0042] Step 2: The MCU transmits the initial power-on status to uboot, and uboot determines whether it is the first power-on based on the flags provided by the MCU.
[0043] Step 3, if it is the first power-on, initialize the pre-recording module and start the Linux operating system, and configure the image sensor to output high-resolution images; step 3 further includes S6 and S7:
[0044] S6: Initialize the pre-recording module. The pre-recording module consists of a low-power MCU, a small-resolution low-power image sensor, and a storage unit. Its function is to record images in a loop and store the recorded image files or send them to the main controller through the SPI or SDIO standard interfaces.
[0045] S7: Initialize the image sensor and start the Linux operating system. Initializing the image sensor configures its status and outputs image data to the main controller for processing. The image sensor here is the same as the one in the pre-recording module. The biggest difference is the resolution. A high-resolution image sensor is used here, including but not limited to 1080P, 1296P, 1440P, 1620P, and 2160P, while the pre-recording module uses a lower resolution, including 540P, 360P, or even lower resolutions. These different resolutions can be achieved according to different software configurations.
[0046] Step 4: The main controller processes the image data acquired by the image sensor and encodes and saves it as a video stream. Specifically, the main controller's ISP (Image Signal Processing) module receives the RAW data transmitted from the image sensor and performs image correction, color management, noise reduction, dynamic control, sharpness and clarity processing, and digital shaking to optimize image quality. Then, the data is converted to YUV or RGB formats and sent to the encoding module for processing. The video encoding module encodes the ISP-processed image data into H264, H265, or JPEG formats using user-configured encoding parameters. The main controller then writes this formatted file to an SD card, eMMC, or other storage device for storage.
[0047] Step 5: The main controller receives the hibernation command and determines whether there is a pre-recording enabled flag.
[0048] Step 6: If pre-recording is enabled, configure the pre-recording module to record and save the number of image frames in a loop and start the pre-recording module to begin recording low-resolution images in a loop.
[0049] Step 7: The MCU controls the image sensor and main controller to power off or go into sleep mode;
[0050] Step 8: The PIR enters the working state and checks whether it has been triggered;
[0051] Step 9: If PIR is triggered, the MCU controls the main controller to power on or wake up, and sends the non-first-time power-on flag to uboot. That is, if the power to the main controller and image sensor was cut off in Step 7, the main controller and image sensor are powered on here; otherwise, the main controller is woken up. Here, the MCU sends the non-first-time power-on flag to uboot by outputting a high level from GPIO.
[0052] Step 10: U-Boot obtains a flag indicating whether pre-recording is enabled. If enabled, it sends a command to the pre-recording module to stop pre-recording; this further includes steps S18 and S19.
[0053] S18: U-Boot obtains the flag indicating whether pre-recording is enabled. If yes, proceed to step S19; otherwise, proceed to step Step 14.
[0054] S19: U-Boot sends a stop recording command to the pre-recording module, causing the pre-recording module to stop recording.
[0055] Step 11: Initialize the main controller and configure the image sensor to output high-resolution images; that is, initialize the main controller, start the main controller's Linux kernel and root file system, and at the same time, the main controller will configure the image sensor to switch from low-resolution images to high-resolution images.
[0056] Step 12: The main controller sends a command to the pre-recording module to confirm the number of image frames cached by the pre-recording module and retrieves the frames; further including S21 and S22;
[0057] S21: The main controller sends a command to the pre-recording module to confirm the number of image frames cached by the pre-recording module;
[0058] S22: The master controller sends a frame capture command to the pre-recording module. The pre-recording module prepares to transmit the cached image data to the master controller via SPI, or other communication protocols including SDIO and I2C. Step 13: The pre-recording module transmits the looped images to the master controller's DDR via SPI. The master controller processes and encodes them into a video stream. That is, the pre-recording module transmits the looped images to the master controller's DDR via SPI. The master controller's ISP module retrieves the image data from the DDR, processes it, and transmits it to the encoder. At the same time, it releases the DDR memory space. The encoder encodes the image data into H264 or H265 video data.
[0059] Step 14: The main controller begins processing the high-resolution images acquired by the image sensor and stitches the real-time acquired image data to the image data acquired by the pre-recording module to form a complete video stream and save it; that is, the main controller begins processing the images acquired by the image sensor, the main controller ISP processes the real-time high-resolution image data and sends it to the encoder, the encoder stitches the real-time acquired image data to the encoded image data acquired by the pre-recording module in step S22 to form a complete video stream and save it to the SD card or EMMC;
[0060] Step 15: Initialize the main controller and image sensor by powering on or waking them up. The main controller processes the images acquired by the image sensor and encodes and saves them.
[0061] Step 16: The MCU determines whether the camera battery voltage supports continued operation. If it does, it returns to Step 7; otherwise, all modules are powered off and the camera is turned off.
[0062] Step 17, End the process.
[0063] Step 2 further includes S4 and S5:
[0064] S4: The MCU transmits the initial power-on status to uboot. Upon initial power-on, the MCU transmits the initial power-on flag to uboot via the GPIO status. Here, upon initial power-on, the GPIO is in a low-level state. The MCU mentioned is a microcontroller with relatively low processing power and memory capacity. It can handle simple tasks and small amounts of data, and its low-power design makes it suitable for long-term operation.
[0065] S5: U-Boot determines whether it is the first power-on based on the high and low level flags provided by the MCU. Here, a high level flag is defined as yes and a low level flag as no. If yes, proceed to step S6; if no, proceed to step S17. Here, U-Boot determines the first power-on by obtaining the GPIO status directly connected to the MCU. If the GPIO is low, it is determined to be the first power-on; if the GPIO is high, it is determined to be a non-first power-on.
[0066] The uboot mentioned above is the bootloader program that loads this program. It initializes hardware devices when the embedded system starts up, including initializing the CPU, RAM, clock, serial port, storage devices, and booting the operating system, i.e., loading the Linux system kernel from storage devices including Flash, SD card, and network to memory; and passing boot parameters and root file system, including device tree (dtb) and command line parameters (cmdline) to the kernel.
[0067] The term GPIO refers to the chip's input and output. Its state or function can be freely controlled by the program. Therefore, the MCU configures GPIO as an output state, which can output high / low levels; while the main controller configures GPIO as an input state, which can obtain the current level state of GPIO.
[0068] Step 5 further includes S9 and S10:
[0069] S9: The main controller receives a sleep command. This is because the human detection algorithm or the environmental perception sensor including PIR has not been triggered, or the user issues a sleep command. It is determined that the main controller and image sensor do not need to continue working at present.
[0070] S10: The main controller determines whether there is a pre-recording enabled flag. If yes, proceed to step S12; otherwise, proceed to step S11. Here, the main controller obtains the pre-recording flag by reading a certain field from a configuration partition, including allocating a tag partition and setting 'preroll_state=". When preroll_state=1, it is determined to be yes, that is, pre-recording mode has been enabled. If preroll_state=0 or is NULL, it is determined to be no.
[0071] Step 6 further includes S11 and S12:
[0072] S11: The user configures whether to enable pre-recording. If yes, proceed to S12 and write the pre-recording flag to the tag partition mentioned in S10. If no, proceed to S13 and use the 'preroll_state=" field to indicate whether pre-recording is configured. If the user has configured pre-recording, then preroll_state=1. If the user has not configured pre-recording, then preroll_state=0.
[0073] S12: Configure the pre-recording module to cyclically record and save image frames and start the pre-recording module to begin cyclically recording low-resolution images. Because the pre-recording module has a small built-in memory and weak processing power, the image data it can save is limited. Therefore, it needs to cyclically overwrite the image data saved in the memory. The number of frames to save is configured by the master controller issuing a command to save the number of frames. This configuration can be sent through SPI, I2C, or SDIO protocol communication. Here, the pre-recording module and the master controller use the same image sensor, but the corresponding image resolutions are different. Therefore, when configuring the pre-recording module to record images, the master controller needs to issue a configuration to switch the image sensor from high resolution to low resolution. At this time, the image sensor will be exclusively occupied by the pre-recording module.
[0074] Step 7 further includes S13 and S14:
[0075] S13: The MCU controls the image sensor to power down or go into sleep mode. If the image sensor supports standby mode, which is a low-power state, it can retain the current configuration and can be directly woken up when used again, reducing the time for reconfiguration and achieving the effect of fast image output. In this case, the image sensor can be controlled to go into sleep mode. If standby mode is not supported, the image sensor will be powered down.
[0076] S14: The MCU controls the main controller to power down or go to sleep. Here, the module is powered down. If the main controller supports suspend mode, it can be controlled to enter sleep mode, in which case the main controller enters an ultra-low power mode. The suspend mode puts the main controller into a suspend-to-RAM state. In this state, the main controller saves the current running state and data to the RAM and then turns off the system power, thereby saving power. When the main controller is woken up, it restores the previous running state and data from the RAM.
[0077] Step 8 further includes S15 and S16:
[0078] S15: The PIR enters working mode. This PIR is connected to the MCU and its main function is to sense the presence of people in the environment. A digital PIR is used here; whenever someone enters the sensing range, the PIR will be triggered, generating a high-level signal. The PIR sensor is a pyroelectric infrared sensor, which can detect infrared radiation emitted from objects within its field of view. When the infrared radiation in the environment changes, the PIR compares this changed thermal radiation with the background thermal radiation to detect human movement or presence, outputting a high-level signal. When no person is detected, it continuously outputs a low-level signal.
[0079] S16: Is PIR triggered? When the MCU detects that PIR outputs a high level, it determines that PIR is triggered. Otherwise, PIR is not triggered. If yes, proceed to step S16. If no, return to step S14.
[0080] Step 15 further includes S25 and S26:
[0081] S25: Initialize the main controller and power on or wake up the image sensor. This mainly involves starting the main controller's Linux kernel and root file system, while powering on or waking up the image sensor. The main controller will configure the image sensor to output high-resolution images.
[0082] S26: After the main controller starts processing the images acquired by the image sensor, it sends the processed images to the encoder. The encoder encodes the real-time acquired image data into a video stream and saves it to an SD card or EMMC.
[0083] Step 16 further includes S27 and S28:
[0084] S27: The MCU determines whether the camera battery voltage supports the camera to continue working. The MCU continuously detects the battery voltage. When the detected battery voltage is lower than the set threshold, it is judged as no; otherwise, it is judged as yes. If yes, return to step S14; if no, proceed to step S27.
[0085] Therefore, the advantages of this solution are as follows: By introducing a pre-recording module and a low-power battery camera, in the absence of humans or animals, the PIR is not triggered. At this time, the battery camera is turned off or put into sleep mode to save power. The pre-recording module is a low-power module that is cyclically recording small-resolution images. When the PIR is triggered, the main control is woken up and the pre-recording module transmits the recorded image data to the main control for processing and encoding into the images acquired by the main control to fill the critical image data during the system startup period. This improves the user experience while having minimal impact on the overall standby time of the battery camera. Attached Figure Description
[0086] The accompanying drawings, which are provided to further illustrate the invention and form part of this application, are not intended to limit the scope of the invention.
[0087] Figure 1 This is a block diagram of the system in this application.
[0088] Figure 2 This is a flowchart illustrating the method used in this application.
[0089] Figure 3 This is a detailed flowchart illustrating the method of a specific embodiment of this application.
[0090] Figure 4 This is a schematic diagram of the code implementation of the initial power-on judgment logic in this application.
[0091] Figure 5 This is a schematic diagram of the code implementation in this application that writes the enable pre-recording flag into the cmdline.
[0092] Figure 6 This is a schematic diagram of the code implementation for obtaining the pre-recording enable flag in this application.
[0093] Figure 7 This is a schematic diagram illustrating the code implementation for the first power-on, configuration and initialization of the pre-recording module, and configuration of the number of image frames recorded by the pre-recording module in this application.
[0094] Figure 8 This is a schematic diagram illustrating the code implementation in this application where the main controller sends a request to the pre-recording module to receive raw data, and receives and processes the images recorded by the pre-recording module. Detailed Implementation
[0095] To better understand the technical content and advantages of the present invention, the present invention will now be described in further detail with reference to the accompanying drawings.
[0096] To address the aforementioned problems, this invention provides a system and method for pre-recording in low-power products, wherein the system for pre-recording in a low-power camera, such as... Figure 1 As shown, it includes:
[0097] The main controller, or system-on-a-chip, possesses a high-performance processing core capable of handling complex tasks and large amounts of data. It integrates multiple functions, including image processing, audio processing, and complex algorithm acceleration modules. While boasting powerful performance, it also consumes significant power. The powerful performance is due to the main controller's clock speed reaching GHz levels, enabling high-performance computing, whereas MCUs typically operate at only tens to hundreds of MHz, suitable only for simple logic control and supporting operating systems (such as Linux), but consuming more power. Power consumption here refers to the electrical power consumed by the electronic device or system during operation; that is, more electrical energy consumed in the same amount of time. The power consumption of a main controller is typically hundreds of milliwatts or even several watts, while that of an MCU is typically several milliwatts to tens of milliwatts.
[0098] The pre-recording module, based on an MCU, continuously records video in a loop, and the number of frames recorded and saved can be dynamically configured. The pre-recording module consists of a low-power MCU, a small-resolution low-power image sensor, and a storage unit. It is used to record images in a loop and store the recorded image files or send them to the main controller through a standard interface.
[0099] The camera power-on module is used for initial power-on and initialization of various modules, including the MCU and image sensor (corresponding to...). Figure 3 (S1-S3 in the middle).
[0100] The status transmission module is used by the MCU to transmit the initial power-on status to uboot. uboot then determines whether it is the first power-on based on the flags provided by the MCU (corresponding to...). Figure 3 (S4-S5 in the text).
[0101] The pre-recording module initialization unit is used to initialize the pre-recording module and start the Linux operating system upon first power-on, and configure the image sensor to output high-resolution images (corresponding to...). Figure 3 (S6-S7).
[0102] The image processing module is used by the main controller to process image data acquired by the image sensor and encode and save it as a video stream (corresponding to...). Figure 3 (S8 in the middle).
[0103] The hibernation detection module is used by the main controller to receive hibernation commands and determine whether there is a pre-recording enabled flag (corresponding to...). Figure 3 (S9-S10 in the text).
[0104] The pre-recording configuration unit of the pre-recording module is used to configure the number of image frames to be recorded and saved in a loop when pre-recording is enabled, and to start the pre-recording module to begin recording small-resolution images in a loop (corresponding to...). Figure 3 (S11-S12 in the middle).
[0105] The power control module is used by the MCU to control the image sensor and main controller to power down or enter sleep mode (corresponding to...). Figure 3 (S13-S14 in the text).
[0106] The PIR detection module is used to detect whether the PIR has been triggered when it enters the working state (corresponding to...). Figure 3 (S15-S16 in the text).
[0107] The wake-up module is used to control the main controller to power on or wake up when the PIR is triggered, and to pass a non-first-time power-on flag to uboot (corresponding to...). Figure 3 (S17 in the text).
[0108] The pre-recording stop unit of the pre-recording module is used by U-Boot to obtain a flag indicating whether pre-recording has stopped recording images. If enabled, it sends a command to the pre-recording module to stop pre-recording (corresponding to...). Figure 3 (S18-S19 in the text).
[0109] The main control initialization unit is used to initialize the main control and configure the image sensor to output high-resolution images (corresponding to...). Figure 3 (S20 in the middle).
[0110] The image frame confirmation module is used by the main controller to send instructions to the pre-recording module to confirm the number of image frames cached by the pre-recording module and to retrieve the corresponding frames. Figure 3 (S21-S22 in the text).
[0111] The data transmission module is used by the pre-recording module to transmit the looped images to the main controller's DDR via SPI. The main controller processes and encodes them into a video stream (corresponding to...). Figure 3 (S23 in the text).
[0112] The image stitching module is used by the main controller to process high-resolution images acquired in real time by the image sensor, and stitches the real-time image data to the image data acquired by the pre-recording module to form a complete video stream and save it (corresponding to...). Figure 3 (S24 in the text).
[0113] The power management module is used to power on or wake up the main controller and image sensor. The main controller processes the images acquired by the image sensor and encodes and saves them (corresponding to...). Figure 3 (S25-S26 in the text).
[0114] The battery voltage detection module is used by the MCU to determine whether the camera's battery voltage supports continued operation. If it does, the system returns the information to the power control module; otherwise, all modules are powered off, and the camera shuts down. Figure 3 (S27-S28 in the text).
[0115] The end module is used to terminate the process (corresponding to...). Figure 3 (S29 in the text).
[0116] The main controller processes the RAW data transmitted from the image sensor through the ISP module, performing operations such as image correction, color management, and noise reduction, and then encodes the processed data into H264, H265, or JPEG format for storage.
[0117] The PIR detection module is used to detect when a PIR sensor is triggered by infrared light, thus activating the main controller. Specifically, it includes a PIR sensor for detecting the presence of people in the environment. When it detects the movement or presence of a person, it outputs a high-level signal, triggering the MCU to power on or wake up the main controller.
[0118] The MCU continuously monitors the battery voltage. When the detected battery voltage is lower than the set threshold, it controls each module to power down and the camera to shut down.
[0119] The main controller supports suspend mode, which is used to save the current running state and data to memory during hibernation and quickly restore the system when it wakes up.
[0120] The image sensor supports standby mode, which is used to retain the current configuration in a low-power state and quickly generate images when the sensor is woken up.
[0121] The pre-recording module consists of a low-power MCU, a small-resolution low-power image sensor, and a storage unit. It is used to record images in a loop and store the recorded image files or send them to the main controller through a standard interface.
[0122] The main controller processes the RAW data transmitted from the image sensor through the ISP module, performing operations such as image correction, color management, and noise reduction, and then encodes the processed data into H264, H265, or JPEG format for storage.
[0123] The PIR sensor is used to detect the presence of people in the environment. When it detects the movement or presence of a person, it outputs a high-level signal to trigger the MCU to power on or wake up the main controller.
[0124] The pre-recording module and the main controller use the same image sensor, but with different resolutions. The pre-recording module uses low-resolution images (e.g., 360P (640*360) or even lower resolution), while the main controller uses high-resolution images (e.g., 1080P (1920*1080) or higher (1296P, 1440P, 1620P, 2160P)). The resolution is determined by the configuration of the image sensor, and here the resolution refers to the width and height of the image data.
[0125] The MCU continuously monitors the battery voltage. When the detected battery voltage is lower than the set threshold, it controls each module to power down and the camera to shut down.
[0126] This invention also includes a method for pre-recording low-power products, applicable to any of the above-mentioned systems, comprising the following steps (e.g. Figure 2 ):
[0127] Step 1: Power on the camera and initialize all modules, including the MCU and image sensor (corresponding to...). Figure 3 (S1-S3 in the middle).
[0128] Step 2: The MCU transmits the initial power-on status to uboot. uboot determines whether it is the first power-on based on the flags provided by the MCU (corresponding to...). Figure 3 (S4-S5 in the text).
[0129] Step 3: If this is the first power-on, initialize the pre-recording module and start the Linux operating system, then configure the image sensor to output high-resolution images (corresponding to...). Figure 3 (S6-S7 in the text).
[0130] Step 4: The main controller processes the image data acquired by the image sensor and encodes and saves it as a video stream (corresponding to...). Figure 3 (S8 in the middle).
[0131] Step 5, the main controller receives the hibernation command and checks if there is a pre-recording enabled flag (corresponding to...). Figure 3 (S9-S10 in the text).
[0132] Step 6: If pre-recording is enabled, configure the pre-recording module to record and save image frames in a loop and start the pre-recording module to begin recording low-resolution images in a loop (corresponding to...). Figure 3 (S11-S12 in the middle).
[0133] Step 7: The MCU controls the image sensor and main controller to power off or enter sleep mode (corresponding to...). Figure 3 (S13-S14 in the original text). Step 8: The PIR enters the working state and checks whether it has been triggered (corresponding to...). Figure 3 (S15-S16 in the original text). Step 9: If PIR is triggered, the MCU controls the main controller to power on or wake up, and passes the non-first power-on flag to uboot (corresponding to...). Figure 3 (S17 in the text).
[0134] Step 10: U-Boot obtains a flag indicating whether pre-recording is enabled. If enabled, it sends a command to the pre-recording module to stop pre-recording (corresponding to...). Figure 3 (S18-S19 in the text).
[0135] Step 11, initialize the main controller and configure the image sensor to output high-resolution images (corresponding to...). Figure 3 (S20 in the middle).
[0136] Step 12, the main controller sends a command to the pre-recording module to confirm the number of image frames cached by the pre-recording module and retrieves the corresponding frames. Figure 3 (S21-S22 in the text).
[0137] Step 13: The pre-recording module transmits the looped images to the main controller's DDR via SPI. The main controller processes and encodes them into a video stream (corresponding to...). Figure 3 (S23 in the text).
[0138] Step 14: The main controller begins processing the high-resolution images acquired by the image sensor, and stitches the real-time acquired image data to the image data acquired by the pre-recording module to form a complete video stream and save it (corresponding to...). Figure 3(S24 in the text).
[0139] Step 15: Initialize the main controller and image sensor by powering on or waking them up. The main controller processes the images acquired by the image sensor and encodes and saves them (corresponding to...). Figure 3 (S25-S26 in the text).
[0140] Step 16: The MCU determines whether the camera's battery voltage supports continued operation. If it does, it returns to step S14; otherwise, all modules power down and the camera shuts down. Figure 3 (S27-S28 in the text).
[0141] Step 17, End the process (corresponding to...) Figure 3 (S29 in the text).
[0142] More specifically, such as Figure 3 As shown, embodiments of this method can also be described as follows:
[0143] S1: Camera powered on;
[0144] S2: Power on all modules. Upon initial power-on, all modules of the camera will be powered on.
[0145] S3: Initialize the MCU. Its main function is to prepare for the power control of the subsequent pre-recorded module and each module.
[0146] S4: The MCU transmits the initial power-on status to uboot. Upon initial power-on, the MCU transmits the initial power-on flag to uboot via the GPIO status. Here, upon initial power-on, the GPIO is in a low-level state. The MCU mentioned is a microcontroller, characterized by low processing power and memory capacity. It can handle simple tasks and small amounts of data, and its low-power design makes it suitable for long-term operation.
[0147] S5: U-Boot determines whether it is the first power-on based on the high and low level flags provided by the MCU. Here, a high level flag is defined as yes, and a low level flag as no. If yes, proceed to step S6; otherwise, proceed to step S17. Here, U-Boot determines this by obtaining the GPIO status directly connected to the MCU. If the GPIO is low, it is determined to be the first power-on; if the GPIO is high, it is determined to be a non-first power-on. The U-Boot is the bootloader, whose main function is to initialize hardware devices (initialize CPU, memory (RAM), clock, serial port, storage devices, etc.) and boot the operating system (from storage devices such as Flare) when the embedded system starts. The system loads the Linux kernel into memory via sh, SD card, or network. It passes boot parameters (such as device tree (dtb) and command-line arguments (cmdline) to the kernel and root file system. GPIO refers to the chip's input / output; its state or function can be freely controlled by the program. Therefore, the MCU configures GPIO as an output, allowing it to output high / low levels. The main controller configures GPIO as an input, allowing it to obtain the current GPIO level. The main controller is a system-on-a-chip (SoC) characterized by a high-performance processing core, capable of handling complex tasks and large datasets as multi-functional modules, such as image processors, audio processors, and complex algorithm acceleration modules. It boasts powerful performance but also relatively high power consumption.
[0148] S6: Initialize the pre-recording module. The pre-recording module mainly consists of a low-power MCU, a small-resolution low-power image sensor, and a storage unit. Its main function is to record images in a loop and store the recorded image files or send them to the main controller through standard interfaces such as SPI and SDIO.
[0149] S7: Initialize the image sensor and start the Linux operating system. Initializing the image sensor mainly involves configuring the image sensor's status and outputting image data to the main controller for processing. The image sensor here is the same as the one in the pre-recording module. The biggest difference is the resolution. Here, a high-resolution image sensor is used, such as 1080P, 1296P, 1440P, 1620P, 2160P, etc., while the pre-recording module uses a lower resolution, such as 540P, 360P, etc. These different resolution images can be implemented according to different image sensor software configurations.
[0150] S8: The main controller processes the image data acquired by the image sensor and encodes and saves it as a video stream. This involves relatively complex processing. First, the main controller's ISP (Image Signal Processing Module) receives the RAW data transmitted from the image sensor and performs image correction, color management, noise reduction, dynamic control, sharpness and clarity processing, digital shaking, and other operations to optimize the image quality. Then, the data is converted to YUV or RGB formats and sent to the encoding module for processing. The video encoding module encodes the image data processed by the ISP into H264, H265, or JPEG formats according to the encoding parameters configured by the user. The main controller writes the file in this format to an SD card, eMMC, or other storage device for storage. S9: The main controller receives a sleep command. This occurs when the human detection algorithm or the environmental perception sensor, including the PIR sensor, is not triggered, or when the user issues a sleep command. The main controller and the image sensor are determined to be no longer needed to work.
[0151] S10: The main controller determines whether there is a pre-recording enabled flag. If yes, proceed to S12; otherwise, proceed to S11. Here, the main controller obtains the pre-recording flag by reading a field from a configuration partition. For example, a tag partition is allocated, and 'preroll_state=" is set. When preroll_state=1, it is determined to be yes, that is, pre-recording mode has been enabled. If preroll_state=0 or NULL, it is determined to be no. S11: The user configures whether to enable pre-recording. If yes, proceed to S12 and write the pre-recording flag to the tag partition mentioned in S10. If no, proceed to S13, using the 'preroll_state=" field to indicate whether pre-recording is configured. If the user has configured pre-recording, preroll_state=1; if the user has not configured pre-recording, preroll_state=0.
[0152] S12: Configure the pre-recording module to cyclically record and save image frames and start the pre-recording module to begin cyclically recording low-resolution images. Because the pre-recording module has a small built-in memory and weak processing power, the image data it can save is limited. Therefore, it needs to cyclically overwrite the image data saved in the memory. The number of frames to save is configured by the master controller issuing a command to save the number of frames. This configuration can be sent through protocols such as SPI, I2C, and SDIO. Here, the pre-recording module and the master controller use the same image sensor, but the corresponding image resolutions are different. Therefore, when configuring the pre-recording module to record images, the master controller needs to issue a configuration to switch the image sensor from high resolution to low resolution. At this time, the image sensor will be occupied exclusively by the pre-recording module.
[0153] S13: The MCU controls the image sensor to power down or go into sleep mode. If the image sensor supports standby (a low-power state that retains the current configuration and can be woken up directly when used again, reducing the time to reconfigure and achieving fast image output), the MCU can control the image sensor to go into sleep mode. If it does not support standby mode, the MCU controls the image sensor to power down.
[0154] S14: The MCU controls the main controller to power down or go to sleep. This usually involves powering down the module. If the main controller supports suspend mode (allowing the main controller to enter a sleep state (Suspend-to-RAM), in which the main controller saves its current running state and data to memory (RAM) and then shuts down the system power, thus saving power. When the main controller is woken up, it restores the previous running state and data from RAM), the MCU can control the main controller to enter a sleep state. At this time, the main controller enters an ultra-low power mode. Compared with the main controller power-down method, its advantage is that it can quickly restore the system and save the time of re-powering and initializing the main controller.
[0155] S15: The PIR enters working mode. This PIR is connected to the MCU and its main function is to sense the presence of people in the environment. A digital PIR is used here; whenever someone enters the sensing range, the PIR will be triggered, generating a high-level signal. The PIR sensor is a pyroelectric infrared sensor, which can detect infrared radiation emitted from objects within its field of view. When the infrared radiation in the environment changes, the PIR compares this changed thermal radiation with the background thermal radiation to detect human movement or presence, outputting a high-level signal. When no person is detected, it continuously outputs a low-level signal.
[0156] S16: Is the PIR triggered? When the MCU detects that the PIR output is high, it determines that the PIR is triggered. Otherwise, the PIR is not triggered. If it is, proceed to step S16. If not, return to step S14. S17: The MCU controls the main controller to power on or wake up and passes the non-first power-on flag to uboot. If step S13 is to cut off the power to the main controller and the image sensor, then the main controller and the image sensor are powered on. Otherwise, the main controller is woken up. Here, the MCU passes the non-first power-on flag to uboot by outputting a high level from GPIO.
[0157] S18: U-Boot obtains the flag indicating whether pre-recording is enabled. If it is, proceed to S19; otherwise, proceed to S24. S19: U-Boot sends a command to the pre-recording module to stop pre-recording, causing the pre-recording module to stop recording.
[0158] S20: Initialize the main controller, that is, start the main controller's Linux kernel and root file system. At the same time, the main controller will switch the image sensor's small-resolution image to a large-resolution image.
[0159] S21: The main controller sends a command to the pre-recording module to confirm the number of image frames cached by the pre-recording module;
[0160] S22: The master controller sends a frame capture command to the pre-recording module. The pre-recording module prepares to transmit the cached image data to the master controller via SPI, or other communication protocols such as SDIO, I2C, etc.; S23: The pre-recording module transmits the cyclically saved images to the master controller's DDR via SPI. The master controller's ISP module retrieves the image data from the DDR, processes it, and transmits it to the encoder. At the same time, it releases the DDR memory space. The encoder encodes the image data into H264 or H265 video data.
[0161] S24: The main controller starts processing the images acquired by the image sensor. The main controller ISP processes the high-resolution image data acquired in real time and sends it to the encoder. The encoder stitches the image data acquired in real time to the encoded image data acquired by the pre-recording module in S22 to form a complete video stream and saves it to the SD card or EMMC.
[0162] S25: Initialize the main controller and power on or wake up the image sensor. This mainly involves starting the main controller's Linux kernel and root file system, while simultaneously powering on or waking up the image sensor. The main controller will then configure the image sensor to output high-resolution images.
[0163] S26: After the main controller starts processing the images acquired by the image sensor, it sends the processed images to the encoder. The encoder encodes the real-time acquired image data into a video stream and saves it to the SD card or EMMC.
[0164] S27: The MCU determines whether the camera battery voltage supports the camera to continue working. The MCU continuously detects the battery voltage. When the detected battery voltage is lower than the set threshold, it is judged as no; otherwise, it is judged as yes. If yes, return to step S14; if no, proceed to step S27.
[0165] S28: All modules lose power, camera shuts down;
[0166] S29: End.
[0167] The configuration and startup of the pre-recording module includes setting the recording resolution and looping the saving of image data.
[0168] After receiving the hibernation command, the main controller decides whether to enter hibernation mode based on the pre-recorded enable flag.
[0169] After receiving the stop recording command, the pre-recording module transmits the cyclically saved image data to the main control DDR.
[0170] After initialization, the main controller sends a command to the pre-recording module to confirm the data of the cached image.
[0171] After receiving the image from the image sensor, the main controller processes the image through the encoder and sends the data to the acquisition unit.
[0172] When the process ends, all modules are powered off and the camera is turned off.
[0173] The following are examples of the code implementation of this application, including:
[0174] 1. Initial power-on judgment logic, such as Figure 4 As shown, the process description is as follows:
[0175] 1) First, obtain the value of the GPIO_PA(17) pin (first power-on flag) through the gpio_get_value function, and store the result in the variable ret.
[0176] 2) Determine the value of ret:
[0177] -If ret equals 0 (first power-on):
[0178] a. Call load_sensor_small_image(0) to initialize the small image mode of the image sensor for pre-recording module input.
[0179] b. Enter the while loop and continuously call wait_mcu_done(1) to wait for the pre-recording module to complete initialization:
[0180] - If the returned ret is 0 (initialization complete), then call load_sensor_big_image(0) to switch to large image mode for main control input.
[0181] - If ret is not equal to 0 (not the first power-on), directly call load_sensor_big_image(0) to initialize the large image mode for main control input.
[0182] 2. Write the flag to enable pre-recording into the command line, such as... Figure 5 As shown, the code implementation is as follows:
[0183] Process description:
[0184] 1) **Kernel boot parameter configuration** (CMDLINE):
[0185] - Set the console to UART interface, baud rate 115200, data bits 8.
[0186] -Memory allocation:
[0187] -64MB memory starts at address 0x0.
[0188] -54MB reserved memory starting at address 0x4000000.
[0189] -10MB of other memory starting at address 0x7600000.
[0190] - The root file system is mounted as / dev / ram0, and can be read and written (rw).
[0191] - The initial process is / li (which may be / linuxrc or a similar initialization script).
[0192] -Other partition allocations:
[0193] -3M (rootfs): Root file system.
[0194] -3M (recovery): Recover the partition.
[0195] -3M (system): System partition.
[0196] -512K(config): Configuration partition.
[0197] -16M@0(all): General storage area.
[0198] - Set LPJ (Loops Per Jiffy) to 5984256.
[0199] - Optional silent mode ($(QUIET)).
[0200] 2). **Boot Information Configuration** (BOOTINFO):
[0201] - Specify the partition layout for SFC0 (which may be a storage device):
[0202] - Kernel partition: 3MB, starting address 0x80000.
[0203] - rootfs partition: 3MB, starting address 0x380000.
[0204] 3) **Environment Variable Configuration** (ENVINFO):
[0205] - Sensor environment tag (senv:[HM]).
[0206] - Initialize resolution: width 1920 (init_w), height 1080 (init_vh).
[0207] -Other parameters:
[0208] -nrvbs=2: This specifies the number of video buffers.
[0209] -node=0: Node identifier.
[0210] -ldc_node=0: LDC (Lens Distortion Correction) node identifier.
[0211] -user_wdr_node=0: User WDR (Wide Dynamic Range) node identifier.
[0212] -preroll_state=!: Pre-recording state flag (not enabled or abnormal).
[0213] - End marker (senv;).
[0214] 3. Obtain the pre-recording enable flag, such as Figure 6 As shown, the code implementation is as follows:
[0215] Process description:
[0216] 1) **Find the pre-recording status flags**:
[0217] - Use the `strstr` function to search for the substring `"preroll_status="` in the string `cmdline_buf`, and store the result in the pointer `p`.
[0218] 2) **Determine if the marker has been found:**
[0219] - If `p` is `NULL` (not found flag):
[0220] - Calling `perror` outputs the error message: "not match preroll_status parameter incmdline\n".
[0221] - If `p` is not `NULL` (found flag):
[0222] - Move the `p` pointer forward by the length of `strlen("preroll_status=")`, skipping the flag prefix, and pointing to the starting position of the status value.
[0223] Use the `atoi` function to convert the status value string to an integer and assign it to the variable `preroll_status`.
[0224] - Call `printf` to output the converted status value, in the format: "====>preroll_status0x%x\n", displayed in hexadecimal.
[0225] 4. Upon initial power-on, configure and initialize the pre-recording module, and configure the number of image frames the pre-recording module can record, such as... Figure 7 As shown, the code implementation is as follows:
[0226] Process description:
[0227] 1) **Pre-recording module initialization**:
[0228] - The pre-recorded module is initialized by calling the `aop_init()` function, and the return value is stored in `ret`.
[0229] - If `ret` is not equal to 0 (initialization failed), output the error message `"[ERROR]aop_init()fail:%d\n"` and return 0.
[0230] 2) **Initial Power-On Configuration**:
[0231] - Check if the global variable `g_aop_cfg.bootmode` is `BOOTMODE_POWER` (first power-on mode):
[0232] - If it is the first power-on, call the `aop_init()` function again to initialize the pre-recorded module (Note: This may be a redundant operation or an incomplete code snippet).
[0233] - Call the `libaovs_set_isp8()` function to configure the AEC / AGC day table of the ISP module, with parameters `ISP_MODULE_AECAGC_TBL_DAY`, offset `0x0`, and data length `0x40` (test small image configuration).
[0234] - Call the `libaovs_set_resolution()` function to set the resolution of the pre-recording module. The parameters are device index `0`, width `AO_WIDTH`, height `AO_HEIGHT`, and clock frequency `AO_CLK`.
[0235] - Call the `libaovs_set_framerate()` function to set the frame rate of the pre-recording module to `AO_FPS`. 5. The main controller sends a raw data reception request to the pre-recording module, receives and processes the images recorded by the pre-recording module, such as... Figure 8 As shown, the code implementation is as follows:
[0236] Process description:
[0237] 1) **Initialize variables and structures:**
[0238] Define an integer variable `ret` and initialize it to 0.
[0239] - Define two structure variables `attr` (of type `IMPISPRawRwAttr` and `...`)
[0240] `IMPISPRawAttr`).
[0241] - Use `memset` to clear the contents of the `attr` structure.
[0242] 2) **Configure RAW data attributes**:
[0243] - Setting `attr.node` to `IMPISP_OPS_MODE_ENABLE` enables ISP operation mode.
[0244] - Use `strcpy` to copy the RAW file path ` / nnt / raw / fitel.raw` to `attr.taftr.path`.
[0245] - Set the data type `attr.dtype` to `TISP_RAM_DTYPE_RAWS`, which represents raw RAW data.
[0246] - Setting the module type `attr.ntype` to `TISP_RAM_MODULE_START` indicates that the module is starting.
[0247] - Set the buffer size `attr.nrvbs` to 4.
[0248] 3) **Request pre-recording module data**:
[0249] - Call the `get_preroll_raw_input` function to send a request to the pre-recording module to receive RAW data, and store the return value in `ret`.
[0250] - If `ret` equals -1 (request failed), output an error message.
[0251] The code `"get_preroll_raw_failed!!!\n"` returns -1.
[0252] 4) **Processing image data**:
[0253] - Assign the callback function `raw_frame_done` to `attr.frame_done` to receive image data recorded by the pre-recording module.
[0254] - Call the `IMP_ISP_RAM_RwControl` function to pass the configured `attr` structure to the ISP module (parameter 0 may represent the device index) to complete the input and processing of image data.
[0255] In summary, this invention at least achieves the following: the pre-recording module can be used with any camera. It reduces the overall power consumption of the camera while compensating for critical image data that may be lost during camera startup.
[0256] This technical solution can be applied to all series of Ingenic chips and similar security chips.
[0257] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, various modifications and variations can be made to the embodiments of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A low-power camera pre-recording system, characterized in that, The system includes: The main controller is a system-on-a-chip with a high-performance processing core, capable of handling complex tasks and large amounts of data, and integrating numerous functions including image processing, audio processing, and complex algorithm acceleration modules. The pre-recording module, based on an MCU, can continuously record video in a loop, and the number of frames recorded and saved can be dynamically configured. The pre-recording module consists of a low-power MCU, with power consumption ranging from a few milliwatts to tens of milliwatts, a low-performance main frequency of only tens to hundreds of MHz, a small-resolution low-power image sensor including only 360P (640*360) or even lower resolution, and a storage unit. It is used to record images in a loop and store the recorded image files or send them to the main controller through a standard interface. The camera power-on module is used for initial power-on and initialization of various modules, including the MCU and image sensor. Here, the MCU refers to the MCU of the pre-recording module. Status transmission is used by the MCU to pass the initial power-on status to uboot, and uboot determines whether it is the first power-on based on the flags provided by the MCU. The initialization unit of the pre-recording module is used to initialize the pre-recording module and start the Linux operating system upon first power-on, and configure the image sensor to output high-resolution images; The image processing module is used by the main controller to process image data acquired by the image sensor; The hibernation detection module is used by the main controller to receive hibernation commands and determine whether there is a pre-recording enabled flag. The pre-recording configuration unit of the pre-recording module is used to configure the number of image frames to be recorded and saved in a loop by the pre-recording module when pre-recording is enabled, and to start the pre-recording module to start recording low-resolution images in a loop. The power control module is used by the MCU to control the image sensor and main controller to power down or go into sleep mode; If the main controller supports suspend mode, the current running state and data are saved to memory during hibernation and the system is quickly restored upon wake-up. The PIR detection module is used to detect when the PIR sensor is triggered by infrared to bring the main controller into working state; that is, it includes a PIR sensor for detecting the presence of people in the environment. When it detects the movement or presence of a person, it outputs a high-level signal to trigger the MCU to control the main controller to power on or wake up. The wake-up module is used to control the main controller to power on or wake up when the PIR is triggered, and to pass the non-first power-on flag to uboot; The pre-recording stop unit of the pre-recording module is used by U-Boot to obtain a flag indicating whether pre-recording is enabled. If enabled, it sends a command to the pre-recording module to stop pre-recording. The main control initialization unit is used to initialize the main control and configure the image sensor to output high-resolution images; the image frame confirmation module is used by the main control to send instructions to the pre-recording module to confirm the number of image frames cached by the pre-recording module and to retrieve the frames. The data transmission module is used by the pre-recording module to transmit the images that are saved in a loop to the main controller DDR via SPI, where the main controller processes and encodes them into a video stream. The image stitching module is used by the main controller to process the high-resolution images acquired in real time by the image sensor, and stitch the real-time acquired image data to the image data acquired by the pre-recording module to form a complete video stream and save it. The power management module is used to power on or wake up the main controller and image sensor; The battery voltage detection module is used by the MCU to determine whether the camera's battery voltage supports continued operation. If it does, the MCU returns the power control module; otherwise, all modules are powered off and the camera is turned off. The End module is used to terminate the process.
2. The low-power camera pre-recording system according to claim 1, characterized in that, The pre-recording module and the main controller use the same image sensor, but with different resolutions. The pre-recording module uses low-resolution images, including 360P (640*360) or even lower resolutions, while the main controller uses high-resolution images, including 1080P (1920*1080) or higher (1296P, 1440P, 1620P, 2160P). The resolution is determined by the image sensor configuration, and here the resolution refers to the width and height of the image data.
3. The low-power camera pre-recording system according to claim 1, characterized in that, The main controller processes the RAW data transmitted by the image sensor through the ISP module, performs image correction, color management, and noise reduction operations, and encodes the processed data into H264, H265, or JPEG format for storage.
4. The low-power camera pre-recording system according to claim 1, characterized in that, The MCU continuously monitors the battery voltage. When the detected battery voltage is lower than the set threshold, it controls each module to power down and the camera to shut down.
5. A low-power camera pre-recording method, characterized in that, The method is applicable to any of the systems described in claims 1-4 above, and the method includes: Step 1: Power on the camera and initialize all modules, including the MCU and image sensor; this further includes S1-S3: S1: Camera powered on; S2: Power on all modules. Upon initial power-on, all modules of the camera will be powered on. S3: Initialize the MCU to prepare for the subsequent pre-recording module and power control of each module; Step 2: The MCU transmits the initial power-on status to uboot, and uboot determines whether it is the first power-on based on the flags provided by the MCU. Step 3, if it is the first power-on, initialize the pre-recording module and start the Linux operating system, and configure the image sensor to output high-resolution images; step 3 further includes S6 and S7: S6: Initialize the pre-recording module. The pre-recording module consists of a low-power MCU, a small-resolution low-power image sensor, and a storage unit. Its function is to record images in a loop and store the recorded image files or send them to the main controller through the SPI or SDIO standard interfaces. S7: Initialize the image sensor and start the Linux operating system. Initializing the image sensor configures its status and outputs image data to the main controller for processing. The image sensor here is the same as the one in the pre-recording module. The biggest difference is the resolution. A high-resolution image sensor is used here, including but not limited to 1080P, 1296P, 1440P, 1620P, and 2160P, while the pre-recording module uses a lower resolution, including 540P, 360P, or even lower resolutions. These different resolutions can be achieved according to different software configurations. Step 4: The main controller processes the image data acquired by the image sensor and encodes and saves it as a video stream. Specifically, the main controller's ISP (Image Signal Processing) module receives the RAW data transmitted from the image sensor and performs image correction, color management, noise reduction, dynamic control, sharpness and clarity processing, and digital shaking to optimize image quality. Then, the data is converted to YUV or RGB format and sent to the encoding module for processing. The video encoding module encodes the ISP-processed image data into H264, H265, or JPEG format using user-configured encoding parameters. The main controller then writes this formatted file to an SD card, eMMC, or other storage device for storage. Step 5: The main controller receives the hibernation command and determines whether there is a pre-recording enabled flag. Step 6: If pre-recording is enabled, configure the pre-recording module to record and save the number of image frames in a loop and start the pre-recording module to begin recording low-resolution images in a loop. Step 7: The MCU controls the image sensor and main controller to power off or go into sleep mode; Step 8: The PIR enters the working state and checks whether it has been triggered; Step 9: If PIR is triggered, the MCU controls the main controller to power on or wake up, and sends the non-first-time power-on flag to uboot. That is, if the power to the main controller and image sensor was cut off in Step 7, the main controller and image sensor are powered on here; otherwise, the main controller is woken up. Here, the MCU sends the non-first-time power-on flag to uboot by outputting a high level from GPIO. Step 10: U-Boot obtains a flag indicating whether pre-recording is enabled. If enabled, it sends a command to the pre-recording module to stop pre-recording; this further includes steps S18 and S19. S18: U-Boot obtains the flag indicating whether pre-recording is enabled. If yes, proceed to step S19; otherwise, proceed to step Step 14. S19: U-Boot sends a stop recording command to the pre-recording module, causing the pre-recording module to stop recording. Step 11: Initialize the main controller and configure the image sensor to output high-resolution images; that is, initialize the main controller, start the main controller's Linux kernel and root file system, and at the same time, the main controller will configure the image sensor to switch from low-resolution images to high-resolution images. Step 12: The main controller sends a command to the pre-recording module to confirm the number of image frames cached by the pre-recording module and retrieves the frames; this further includes S21 and S22. S21: The main controller sends a command to the pre-recording module to confirm the number of image frames cached by the pre-recording module; S22: The master controller sends a frame capture command to the pre-recording module. The pre-recording module prepares to transmit the cached image data to the master controller via SPI, or other communication protocols including SDIO and I2C. Step 13: The pre-recording module transmits the looped images to the master controller's DDR via SPI. The master controller processes and encodes them into a video stream. That is, the pre-recording module transmits the looped images to the master controller's DDR via SPI. The master controller's ISP module retrieves the image data from the DDR, processes it, and transmits it to the encoder. At the same time, it releases the DDR memory space. The encoder encodes the image data into H264 or H265 video data. Step 14: The main controller begins processing the high-resolution images acquired by the image sensor and stitches the real-time acquired image data to the image data acquired by the pre-recording module to form a complete video stream and save it; that is, the main controller begins processing the images acquired by the image sensor, the main controller ISP processes the real-time high-resolution image data and sends it to the encoder, the encoder stitches the real-time acquired image data to the encoded image data acquired by the pre-recording module in step S22 to form a complete video stream and save it to the SD card or EMMC; Step 15: Initialize the main controller and image sensor by powering on or waking them up. The main controller processes the images acquired by the image sensor and encodes and saves them. Step 16: The MCU determines whether the camera battery voltage supports continued operation. If it does, it returns to Step 7; otherwise, all modules are powered off and the camera is turned off. Step 17, End the process.
6. A low-power camera pre-recording method according to claim 5, characterized in that, Step 2 further includes S4 and S5: S4: The MCU transmits the initial power-on status to uboot. Upon initial power-on, the MCU transmits the initial power-on flag to uboot via the GPIO status. Here, upon initial power-on, the GPIO is in a low-level state. The MCU mentioned is a microcontroller with low processing power and memory capacity. It can handle simple tasks and small amounts of data. It has a low-power design and is suitable for long-term operation. S5: U-Boot determines whether it is the first power-on based on the high and low level flags provided by the MCU. Here, a high level flag is defined as yes and a low level flag as no. If yes, proceed to step S6; if no, proceed to step S17. Here, U-Boot determines the first power-on by obtaining the GPIO status directly connected to the MCU. If the GPIO is low, it is determined to be the first power-on; if the GPIO is high, it is determined to be a non-first power-on. The uboot mentioned above is the bootloader program that loads this program. It initializes hardware devices when the embedded system starts up, including initializing the CPU, RAM, clock, serial port, storage devices, and booting the operating system, i.e., loading the Linux system kernel from storage devices including Flash, SD card, and network to memory; and passing boot parameters and root file system, including device tree (dtb) and command line parameters (cmdline) to the kernel. The term GPIO refers to the chip's input and output. Its state or function can be freely controlled by the program. Therefore, the MCU configures GPIO as an output state, which can output high / low levels; while the main controller configures GPIO as an input state, which can obtain the current level state of GPIO.
7. A low-power camera pre-recording method according to claim 6, characterized in that, Step 5 further includes S9 and S10: S9: The main controller receives a sleep command. This is because the human detection algorithm or the environmental perception sensor including PIR has not been triggered, or the user issues a sleep command. It is determined that the main controller and image sensor do not need to continue working at present. S10: The main controller determines whether there is a pre-recording enabled flag. If yes, proceed to step S12; otherwise, proceed to step S11. Here, the main controller obtains the pre-recording flag by reading a certain field from a configuration partition, including allocating a tag partition and setting 'preroll_state=". When preroll_state=1, it is determined to be yes, that is, pre-recording mode has been enabled. If preroll_state=0 or is NULL, it is determined to be no. Step 6 further includes S11 and S12: S11: The user configures whether to enable pre-recording. If yes, proceed to S12 and write the pre-recording flag to the tag partition mentioned in S10. If no, proceed to S13 and use the 'preroll_state=" field to indicate whether pre-recording is configured. If the user has configured pre-recording, then preroll_state=1. If the user has not configured pre-recording, then preroll_state=0. S12: Configure the pre-recording module to cyclically record and save image frames and start the pre-recording module to begin cyclically recording low-resolution images. Because the pre-recording module has a small built-in memory and weak processing power, the image data it can save is limited. It needs to cyclically overwrite the image data saved in the memory. The number of frames to save is configured by the master controller issuing a command to save the number of frames. The corresponding configuration can be issued through SPI, I2C, or SDIO protocol communication. Here, the pre-recording module and the master controller use the same image sensor, but the corresponding image resolutions are different. Therefore, when configuring the pre-recording module to record images, the master controller needs to issue a configuration to switch the image sensor from high resolution to low resolution. At this time, the image sensor will be occupied by the pre-recording module alone.
8. A low-power camera pre-recording method according to claim 7, characterized in that, Step 7 further includes S13 and S14: S13: The MCU controls the image sensor to power down or go into sleep mode. If the image sensor supports standby mode (a low-power state), it can retain the current configuration and be woken up directly when used again, reducing the time for reconfiguration and achieving fast image output. In this case, the image sensor can be controlled to go into sleep mode. If standby mode is not supported, the image sensor will be powered down. S14: The MCU controls the main controller to power down or go to sleep. Here, the module is powered down. If the main controller supports suspend mode, it can be controlled to enter sleep mode, in which case the main controller enters an ultra-low power mode. The suspend mode puts the main controller into a suspend-to-RAM state. In this state, the main controller saves the current running state and data to the RAM and then turns off the system power, thereby saving power. When the main controller is woken up, it restores the previous running state and data from the RAM. Step 8 further includes S15 and S16: S15: The PIR enters the working state. The PIR here is connected to the MCU and its main function is to sense the presence of people in the environment. A digital PIR is used here. As long as someone enters the sensing range, the PIR will be triggered and generate a high level. The PIR sensor is a pyroelectric infrared sensor, which can detect infrared radiation emitted by objects in its field of view. When the infrared radiation in the environment changes, the PIR will compare the changed thermal radiation with the background thermal radiation to detect human movement or presence and output a high level signal. When no person is detected, it will continuously output a low level signal. S16: Is PIR triggered? When the MCU detects that PIR outputs a high level, it determines that PIR is triggered. Otherwise, PIR is not triggered. If yes, proceed to step S16. If no, return to step S14.
9. A low-power camera pre-recording method according to claim 8, characterized in that, Step 15 further includes S25 and S26: S25: Initialize the main controller and power on or wake up the image sensor. This mainly involves starting the main controller's Linux kernel and root file system, while powering on or waking up the image sensor. The main controller will configure the image sensor to output high-resolution images. S26: After the main controller starts processing the images acquired by the image sensor, it sends the processed images to the encoder. The encoder encodes the real-time acquired image data into a video stream and saves it to an SD card or EMMC.
10. A low-power camera pre-recording method according to claim 9, characterized in that, Step 16 further includes S27 and S28: S27: The MCU determines whether the camera battery voltage supports the camera to continue working. The MCU continuously detects the battery voltage. When the detected battery voltage is lower than the set threshold, it is judged as no; otherwise, it is judged as yes. If yes, return to step S14; if no, proceed to step S27.