AI Image Sensor Calibration
Table of Contents:
- 1. Overview
- 2. Calibrate Digits Readings
- 3. Get Sensor Data.
- 4. Configure AIS Sensor using AT commands
1. Overview
AIS is a video photo recognition sensor, the sensor can be used in electricity meters, gas meters, water meters, pressure gauges and other types of meters. Accurately identify the number of the current dial or upload the picture of the current dial for comparison, which can replace people to go to the door to read the meter, and is more accurate and energy-saving than the meter. The first thing to do is to fix the AIS sensor, the end direction needs to be aligned with the object that needs to be identified, you can check whether the object all appears in the lens range through the upper computer, and then calibrate, Chapter 2 will explain the calibration method of different tables.
2. Calibrate Digits Readings
2.1 Calibrate a Water Meter
2.1.1 Introduce
This water meter is designed in accordance with the Chinese standard for drinking cold water meters and hot water meters, GB/T 778.1-2007. It features five dial numbers for measurement accuracy.
2.1.2 Fix Sensor to a Water Meter
The assembly necessitates the use of two screws, two spacers, and this specific device.
Additionally, there are AIS Sensors available along with AUC USB TTL adapters for AIS Sensors.
The fixture below is just a demo, user might adjust it with their water meter. Here is the STEP file for the fixture as below: Water Meter Fixture Demo.
The procedure is as follows:
1. Secure back of the AIS sensor onto the small board and adjust its position according to your requirements. You may use two additional screws for fixation or utilize 3M double-sided adhesive for attachment.
2. Proceed by fastening the device using the previously prepared screws and gaskets.
3. Finally, nestle the device onto your water meter, ensuring that it can be adjusted to meet your specific needs while guaranteeing that the camera is directed towards the digital wheel face.
.
The AI Sensors and AUC USB TTL Adapter for AIS Sensors are connected and then connected to the PC.
2.1.3 Calibration
Launch HMX_FT4222H_GUI.exe. Please ensure that the firmware upgrade software ota.exe is closed before opening HMX_FT4222H_GUI.exe.
Choose the largest number of serial port, for example, here shows 13 and 14, then choose 14.
Next, select a Baud rate of 921600 and click on "start". Then, click on "show full image" to display the camera screen.
Click "enable Raw" and save the BMP image in the "Save" folder. This step is necessary to obtain the coordinate points of the watch face.
This water meter has only five fields, and the coordinates of the digital roulette wheel are shown in the figure.
If your device's digital scroll wheel dial does not match these five fields, you can try the other field dial coordinate dot plots in 2.4.
The computer's drawing tool can be used to open the latest bmp image and get the coordinates of the digital wheel dial, as shown below. Based on the format of the digital wheel dial, we can obtain each coordinate point of the current use dial. The (x,y) coordinate on the image is located at the bottom left corner.
Click the "ROI setting" button in "HIMAX_AMR_PC_Tool" and three options will pop up
The "Long dial" option is the long hand dial.
The "Short dial" option is the short pointer and digital wheel dial.
The "Digit wheel" option is the digital wheel dial.
Now we are calibrating the digital wheel face of the water meter. Here we select "digit wheel".
1:Fill in the coordinates you just got; it's best to get a coordinate and fill in a coordinate.
2: Fill in the number of number wheel on their dial,fi;
3: Select the number of short Pointers (currently we don't use short Pointers, the "digit wheelu" option defaults to 0);
4: Preview whether the setting of their coordinates is accurate;
5: Click to write all configuration to AIS;
6: Click the exit configuration interface, at this time, there will be a readout. If the Reading of "reading" is consistent with the watch face, the calibration is successful. The AIS cannot move thereafter to avoid misreading.
The effect can be previewed by clicking the "Preview correction" button as shown below.
After the calibration process is completed, it can be observed that the obtained reading aligns consistently with the numerical value displayed on the digital wheel dial.
2.2 Calibration Power Meter
2.2.1 Introduce
This power meter is designed in accordance with the Chinese standard for Electricity metering equipment, GB/T 17215.321-2008. It features six dial numbers for measurement accuracy.
2.2.2 Fix Sensor to a Power Meter
You can utilize a couple of pea clips or other suitable fixtures to securely fasten the AIS sensor and ensure precise alignment of the camera with the digital watch wheel.
2.2.3 Calibration
Perform a power reset on the EVB board, making sure to close the ota.exe program before opening HMX_FT4222H_GUI.exe.
Choose the largest number of serial port, for example, here shows 13 and 14, then choose 14.
Next, select a Baud rate of 921600 and click on "start". Then, click on "show full image" to display the camera screen.
Click "enable Raw" and save the BMP image in the "Save" folder. This step is necessary to obtain the coordinate points of the watch face.
This power meter has only six fields, and the coordinates of the digital roulette wheel are shown in the figure.
If your device's digital scroll wheel dial does not match these six fields, you can try the other field dial coordinate dot plots in 2.4.
The computer's drawing tool can be used to open the latest bmp image and get the coordinates of the digital wheel dial, as shown below. Based on the format of the digital wheel dial, we can obtain each coordinate point of the current use dial. The (x,y) coordinate on the image is located at the bottom left corner.
Click the "ROI setting" button in "HIMAX_AMR_PC_Tool" and three options will pop up
The "Long dial" option is the long hand dial.
The "Short dial" option is the short pointer and digital wheel dial.
The "Digit wheel" option is the digital wheel dial.
Now we are calibrating the digital wheel face of the power meter. Here we select "digit wheel".
1: Fill in the coordinates you just got; it's best to get a coordinate and fill in a coordinate.
2: Fill in the number of number wheel on their dial,six;
3: Select the number of short Pointers (currently we don't use short Pointers, the "digit wheelu" option defaults to 0);
4: Preview whether the setting of their coordinates is accurate;
5: Click to write all configuration to AIS;
6: Click the exit configuration interface, at this time, there will be a readout. If the Reading of "reading" is consistent with the watch face, the calibration is successful. The AIS cannot move thereafter to avoid misreading.
The effect can be previewed by clicking the "Preview correction" button as shown below.
After the calibration process is completed, it can be observed that the obtained reading aligns consistently with the numerical value displayed on the digital wheel dial.
2.3 Calibration Gas Meter
2.3.1 Introduce
This gas meter uses G2.5 membrane gas meter. It features eight dial numbers for measurement accuracy.
2.3.2 Fix Sensor to a Gas Meter
You can utilize a couple of pea clips or other suitable fixtures to securely fasten the AIS sensor and ensure precise alignment of the camera with the digital watch wheel.
2.3.3 Calibration
Perform a power reset on the EVB board, making sure to close the ota.exe program before opening HMX_FT4222H_GUI.exe.
Choose the largest number of serial port, for example, here shows 13 and 14, then choose 14.
Next, select a Baud rate of 921600 and click on "start". Then, click on "show full image" to display the camera screen.
Click "enable Raw" and save the BMP image in the "Save" folder. This step is necessary to obtain the coordinate points of the watch face.
This gas meter has eight fields, and the coordinates of the digital roulette wheel are shown in the figure.
If your device's digital scroll wheel dial does not match these eight fields, you can try the other field dial coordinate dot plots in 2.4.
The computer's drawing tool can be used to open the latest bmp image and get the coordinates of the digital wheel dial, as shown below. Based on the format of the digital wheel dial, we can obtain each coordinate point of the current use dial. The (x,y) coordinate on the image is located at the bottom left corner.
Click the "ROI setting" button in "HIMAX_AMR_PC_Tool" and three options will pop up
The "Long dial" option is the long hand dial.
The "Short dial" option is the short pointer and digital wheel dial.
The "Digit wheel" option is the digital wheel dial.
Now we are calibrating the digital wheel face of the gas meter. Here we select "digit wheel".
1: Fill in the coordinates you just got; it's best to get a coordinate and fill in a coordinate.
2: Fill in the number of number wheel on their dial,eight;
3: Select the number of short Pointers (currently we don't use short Pointers, the "digit wheelu" option defaults to 0);
4: Preview whether the setting of their coordinates is accurate;
5: Click to write all configuration to AIS;
6: Click the exit configuration interface, at this time, there will be a readout. If the Reading of "reading" is consistent with the watch face, the calibration is successful. The AIS cannot move thereafter to avoid misreading.
The effect can be previewed by clicking the "Preview correction" button as shown below.
After the calibration process is completed, it can be observed that the obtained reading aligns consistently with the numerical value displayed on the digital wheel dial.
2.4 Digital wheel dial take point coordinate diagram
4 numbers:
5 numbers:
6 numbers:
7 numbers:
8 numbers:
3. Get Sensor Data.
3.1 Get Digital Reading After Calibration
This section shows an example for how to join the TheThingsNetwork LoRaWAN IoT server. Usages with other LoRaWAN IoT servers are of similar procedure.
Assume the DLOS8 is already set to connect to TTN V3 network . We need to add the AIS Sensor device in TTN V3 portal.
Step 1: Create a device in TTN V3 with the OTAA keys from AIS Sensor.
Each AIS Sensor is shipped with a sticker with the default DEV EUI as below:
Enter these keys in the LoRaWAN Server portal. Below is TTN V3 screen shot:
Add APP EUI in the application.
choose to create the device manually.
Add APP KEY and DEV EUI
Default mode OTAA
Step 2: Use ACT button to activate LHT52 and it will auto join to the TTN V3 network. After join success, it will start to upload sensor data to TTN V3 and user can see in the panel.
3.1.1 Uplink Payload (Fport=5)
The uplink payload includes totally 14 bytes. Uplink packets use FPORT=5 and every 20 minutes send one uplink by default.
Size(bytes) | 2 | 4 | 4 | 4 |
---|---|---|---|---|
Value | BAT | sysTimeCurrent | Integer | Decimal |
Payload Example(FPort=5):0D 32 66 29 AF E0 00 00 00 02 00 05 E3 B0
3.1.2 BAT- Battery information
These two bytes of BAT include the battery state and the actual voltage.
Ex:0x0B32 = 3378mV
3.1.3 sysTimeCurrent
These four bytes contain the year, month, day, hour, minute, and second of the time.
AI Sensor use Unix TimeStamp format based on
Users can get this time from the link: https://www.epochconverter.com/ :
Below is the converter example
Ex:6629AFE0=2024-04-25 01:20:32
So, we can use AT+TIMESTAMP=1714012723 or downlink 6629C233 to set the current time 2024 – April -- 25 Thursday 02:38:41
3.1.4 Integer
These four bytes display the integers in the digital wheel face
Read table integer:0x00000002=2
3.1.5 Decimal
These four bytes display decimals on the digital wheel.
Read table decimals:0x005E3B0/1000000= 0.385968
3.2 Get Image and show in PC
To get the AIS current image on the PC, you can issue commands through TTN or connect AIS to your PC with TTL to send commands through the serial port to obtain relevant data packets.
3.2.1 The image date are obtained by TTN
Make sure that node ACK is on: AT+PNACKMD=1 or 34 01
Then send the graph instruction 0B 01.
The next time the AIS Sensor device runs at the set time, it will start collecting image data.
The uplink payload includes totally 208 bytes. Uplink packets use FPORT=3
Size(bytes) | 4 | 2 | 1 | 1 | 200 |
---|---|---|---|---|---|
Value | sysTimeCurrent | BAT | total_packages | subcontracting_count | Image_date |
Example of the first payload(FPort=3):663095C00BBE1000FFD8FFE000104A46494600010101004800480000FFDB0043001B12141714111B1716171E1C1B2028422B28252528513A3D3042605565645F555D5B6A7899816A7190735B5D85B586909EA3ABADAB6780BCC9BAA6C799A8ABA4FFDB0043011C1E1E2823284E2B2B4EA46E5D6EA4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4FFC0000B0800F0014001012200FFC4001F00000105010101010101000000000000000001020304050607
3.2.1.1sysTimeCurrent
These four bytes contain the year, month, day, hour, minute, and second of the time.
AI Sensor use Unix TimeStamp format based on.
Users can get this time from the link: https://www.epochconverter.com/ :
Below is the converter example
EX: 663095C0=2024-04-30 06:54:57.
3.2.1.2 BAT- Battery information
These two bytes of BAT include the battery state and the actual voltage.
Ex:0X0BBE= 3006 mv
3.2.1.3 total_packages
This byte represents the total number of packets for the image fetched this time.
3.2.1.4 subcontracting_count
This byte represents the data number of the image packet retrieved
3.2.1.5 Image_date
Apart from the eight bytes mentioned above, the next 200 bytes are all image data.
Example the first packet:663095C00BBE1000FFD8FFE000104A46494600010101004800480000FFDB0043001B12141714111B1716171E1C1B2028422B28252528513A3D3042605565645F555D5B6A7899816A7190735B5D85B586909EA3ABADAB6780BCC9BAA6C799A8ABA4FFDB0043011C1E1E2823284E2B2B4EA46E5D6EA4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4FFC0000B0800F0014001012200FFC4001F00000105010101010101000000000000000001020304050607
Image_date=FFD8FFE000104A46494600010101004800480000FFDB0043001B12141714111B1716171E1C1B2028422B28252528513A3D3042605565645F555D5B6A7899816A7190735B5D85B586909EA3ABADAB6780BCC9BAA6C799A8ABA4FFDB0043011C1E1E2823284E2B2B4EA46E5D6EA4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4FFC0000B0800F0014001012200FFC4001F00000105010101010101000000000000000001020304050607
3.2.1.6 Combined image
Once all the data has been uploaded to the TTN platform, the subsequent step involves concatenating each packet in sequential order and saving it into a new TXT file. It is important to note that the first 8 bytes of each packet should be removed before concatenation.
When you combine all the packets, you need to convert the data inside to binary. Here the conversion is demonstrated using the WinHex software.
Open WinHex to open the combined image data file.
Click on the edit option to choose and convert.
Choose the Hex ASCII->Binary option and then click OK.
After the conversion is finished, click on "File" and choose "Save As".
Save as a.jpg file and click OK to generate a JPG file.
Open the saved JPG file to display the image transmitted by the AIS Sensor through the serial port.
3.2.2 The image date are obtained by serial port
Select the corresponding baud rate and serial port number through the serial port tool, select HEX display and HEX send, and continuously receive data from the AIS Sensor
In the serial port to send data C0 5A 00 00 00 00 04, and then send C0 5A 00 00 00 00 09, AIS Sensor will send a real-time image of the data packet, and then stop sending. Start with FFD8 and put it in TXT file
Then follow the instructions in 3.2.1.6 to get the image from AIS Sensor.
4. Configure AIS Sensor using AT commands
4.1 System Management Commands
4.1.1 Change Uplink Interval
Feature: Change LoRaWAN End Node Transmit Interval.
AT Command: AT+TDC
Command Example | Function | Response |
AT+TDC=? | Show current transmit Interval | 30000 OK the interval is 30000ms = 30s |
AT+TDC=60000 | Set Transmit Interval | OK Set transmit interval to 60000ms = 60 seconds |
Downlink Command: 0x01
Format: Command Code (0x01) followed by 3 bytes time value.
If the downlink payload=0100003C, it means set the END Node's Transmit Interval to 0x00003C=60(S), while type code is 01.
- Example 1: Downlink Payload: 0100001E // Set Transmit Interval (TDC) = 30 seconds
- Example 2: Downlink Payload: 0100003C // Set Transmit Interval (TDC) = 60 seconds
4.1.2 Request the server to send an ACK
AT Command: AT+PNACKMD
Command Example | Function | Response |
AT+PNACKMD=1 | If the node uploads the ACK as confirm, it will request the server to send an ACK. If the server ack is not received, the node will upload the packets that have not received the ACK the next time it receives the ACK | 1 OK |
AT+PNACKMD=0 | off request the server to send an ACK | 0 |
Downlink Command: 0x34
0X34 01 //Same As AT+PNACKMD=1
0x34 00 //Same As AT+PNACKMD=0
4.1.3 Set Interrupt Mode
Feature, Set Interrupt mode for GPIO_EXIT.
AT Command: AT+INTMOD1,AT+INTMOD2,AT+INTMOD3
Command Example | Function | Response |
---|---|---|
AT+INTMOD1=? | Show current interrupt mode | 0 |
AT+INTMOD1=2 | Set Transmit Interval | OK |
AT+INTMOD2=3 | Set Transmit Interval 0. (Disable Interrupt), 1. (Trigger by rising and falling edge) 2. (Trigger by falling edge) 3. (Trigger by rising edge) | OK |
Downlink Command: 0x06
Format: Command Code (0x06) followed by 3 bytes.
This means that the interrupt mode of the end node is set to 0x000003=3 (rising edge trigger), and the type code is 06.
- Example 1: Downlink Payload: 06000000 ---> AT+INTMOD1=0
- Example 2: Downlink Payload: 06000003 ---> AT+INTMOD1=3
- Example 3: Downlink Payload: 06000102 ---> AT+INTMOD2=2
4.1.4 Clock logging (Since firmware version v1.2.1)
Sometimes when we deploy lots of end nodes in field. We want all sensors sample data at the same time, and upload these data together for analyze. In such case, we can use clock loging feature.
We can use this command to set the start time of data recording and the time interval to meet the requirements of the specific collection time of data.
- AT Command: AT+CLOCKLOG=a,b,c,d
a: 0: Disable Clock logging. 1: Enable Clock Logging
b: Specify First sampling start second: range (0 ~ 3599, 65535) // Note: If parameter b is set to 65535, the log period starts after the node accesses the network and sends packets.
c: Specify the sampling interval: range (0 ~ 255 minutes)
d:How many entries should be uplink on every TDC (max 32)
Example:
AT+CLOCKLOG=1,65535,1,5
After the node sends the first packet, data is recorded to the memory at intervals of 1 minute. For each TDC uplink, the uplink load will include: battery information + the last 5 memory records (payload + timestamp).
Note: Users need to synchronize the server time before configuring this command. If the server time is not synchronized before this command is configured, the command takes effect only after the node is reset.