AMB82 MINI Read QR Code and Datamatrix while record a video

I need to record video and at the same time also detect if a QR Code is in front of camera, if yes, i send the string throught serial to another microcontroller that make other operations.

In the video i record that the user put the QR Code in front of the camera and all the events that occours before and after the QR Code, this is for security reason.

Is this clear?

The next step is to control the start and stop record throught serial, the video recorded can be long like 5 minutes

It’s written in the first post… I can’t use two AMB82-Mini for my application

Hi @Ivan,

How much time do you have left for your prototype?
We will try to see if there are any ways to get this feature out.

It might be highly possible, after reviewing the code. Recording at 720P is alright right?

Thank you.

I have time till the and of may

Hi @Ivan,

I have just successfully integrated this. However, there is still optimization that can be done to the following example. For now, you can be reassured that this feature is doable. Once the optimization of the code is done, we will commit to our official repository.

#undef DEFAULT

#include “VideoStream.h”
#include “QRCodeScanner.h”
#include “StreamIO.h”
#include “MP4Recording.h”

#define CHANNEL 0
#define RECORDINGCHANNEL 1

// Default preset configurations for each video channel:
// Channel 0 : 1920 x 1080 30FPS H264
// Channel 1 : 1280 x 720 30FPS H264

VideoSetting config(CHANNEL);
VideoSetting configv1(RECORDINGCHANNEL);
QRCodeScanner Scanner;
MP4Recording mp4;
StreamIO videoStreamer(1, 1);

void setup() {
// Initialize serial communication
Serial.begin(115200);
// Configure camera video channel with video format information
Camera.configVideoChannel(CHANNEL, config);
Camera.configVideoChannel(RECORDINGCHANNEL, configv1);
Camera.videoInit();

mp4.configVideo(configv1);
mp4.setRecordingDuration(30);
mp4.setRecordingFileCount(1);
mp4.setRecordingFileName(“TestRecordingVideoOnly”);
mp4.setRecordingDataType(STORAGE_VIDEO); // Set MP4 to record video only

// Configure StreamIO object to stream data from video channel to MP4 recording
videoStreamer.registerInput(Camera.getStream(RECORDINGCHANNEL));
videoStreamer.registerOutput(mp4);
if (videoStreamer.begin() != 0) {
Serial.println(“StreamIO link start failed”);
}

// Start data stream from video channel
// Camera.channelBegin(CHANNEL);
Camera.channelBegin(RECORDINGCHANNEL);
// Start recording MP4 data to SD card
Serial.println(“Mp4 begin”);
mp4.begin();

Scanner.StartScanning();
}

void loop() {
// User can use the result string and length from here.
// You can modify the delay to the rate of retrieving the result string and result length.
// Currently, third successful scan will allow you to get the result string and length reliably.
// Note that this loop may not be optimised, you are to do your own conditional checks to get your application working.
// This is to illustrate how to retrieve the qr code scanning results.

delay(1000);
Scanner.GetResultString();
Scanner.GetResultLength();
if (Scanner.ResultString != nullptr) {
Serial.print(“Result String is:”);
Serial.println(Scanner.ResultString);
}
if (Scanner.ResultLength != 0) {
Serial.print(“Result Length is:”);
Serial.println(Scanner.ResultLength);
}
}

Hi @Ivan,

You may set the recording time mp4.setRecordingDuration(300); to record 5 mins.

Thank you.

Thank you for your analysis! One question left: where can I find the QRCodeScanner lib? It is not listed in my File-Examples-directory?

I know, but i need to start record for an unspecified time by serial command and also stop it by serial command

You can find the library and the example at this link ambpro2_arduino/Arduino_package/hardware/libraries at dev · Kyderio/ambpro2_arduino · GitHub

1 Like

Hi @Ivan,

Unfortunately you will have to configure a duration to record the video when starting a recording. For instance, you may set a duration of 5 mins. And at the 3 minute mark, if you want to stop the recording, you may call the API mp4.end().

Thank you.

Hi @HDP,

You may refer to the libraries here. ambpro2_arduino/Arduino_package/hardware/libraries/QRCodeScanner/src at dev · ambiot/ambpro2_arduino · GitHub

Thank you.

Hi @Ivan,

Are you still facing any technical difficulties? Let me know as soon as possible so that I can help you early, before End of May arrive.

Thank you.

Sorry, I missed this message… I tested it now and it work fine. When i start the program i see a lot of debug string in the serial monitor

== Rtl8735b IoT Platform ==

[Normal mode]
BootFromNORFlash
[Start Boot ROM...]
=== Load PARTBL ===
=== Load Done ===
=== Load ISP_IQ ===
[fcs chk pass]
ISP_IQ @ 0x8461080, 0x1af80, 0x0
mfcs_data version 0x00010001
fcs_data version 0x00010101
=== Process ISP_IQ ===
=== Load Done ===
=== Load BL ===
[Image Start Table @ 0x18200]
=== Load Done ===

== Boot Loader ==
Dec 20 2023:16:58:59
=== Load FCS Para ===
=== Load Done ===

also when the loop is running

[VOE]release s0 isp buffer 0 

[VOE][WARN]useless release s0 slot0 status 0x00000000 

[VOE]release s0 isp buffer 1 

[VOE][WARN]useless release s0 slot1 status 0x00000000

how can i disable all this debug strings?

I searched in the arduino ide options but i can’t find an option to do that, i need to remove this in all of the libraries manually?

Thanks a lot for your help

Hi @Ivan,

Unfortunately, these debug messages cannot be removed at the moment, because the file that generates this is not open source. May I know if it is a must to remove the log? If yes, I will try to ask if I am able to provide you with the binary file with the printing log disabled.

Thank you.

Maybe i can use another serial to comunicate with my other microcontroller, but if i’m able to manage this log strings i prefer and i think it’s helpful also for the comunity if you provide a flag to enable/disable it in arduino ide

Hi @Ivan,

Thanks for your feedback, we will see if it is possible to provide a way for users to manage the log.

Let us know if you require any assistance for your smart locker project because there are still around 2 more weeks till end of May. Would like to help with any technical issues as soon as possible.