Software apps and online services
This report is a technical report of an example of Internet of things detector for domestic water meter:
(1) The development process of the example of the Internet of things detector of the water meter in our home includes the mechanical design of the camera positioning frame, the calculation and display module fixed frame;
(2) In this example, we develop M5GO Lite with VSCode by Micropython to display image processing results and transmit the results to Aliyun through WiFi;
(3) In this case, maxipy is used to develop Widora AIRV r2 to process the Water meter data image and transmit the image processing result to M5GO Lite;
(4) This example uses flask Python to develop data receiving script in Aliyun.
In this example, a water meter detector as shown in the figure is purchased. By measuring the corresponding parameters of the domestic water meter, the mechanical structure of the corresponding domestic water meter detector is designed. Through SolidWorks to draw three-dimensional drawings and 3D printer printing, according to the final scheme design drawings to make the final example.
For the base part of the tester, purchase the corresponding standard domestic water meter, and plan to install the fixed part according to the external dimension of the water meter. After many times of practice, the solution of fixing the detector on the water meter cover is adopted. The specific implementation process of the scheme is as follows: a pair of surface cover connecting members are directly connected with the surface cover, and two surface cover connecting structural members are fixed at the middle beam frame at the same time;
For the fixation of M5GO Lite and Airv R2 modules, according to the appearance parameters provided by the official, this example designs the corresponding fixings. The final effect of the design drawing and the actual drawing is shown in Figure 3. The fixings of the two modules are connected with the intermediate connectors at the same time. For the calibration calculation of ov2640 camera, refer to the relevant camera calibration process.
2. Hardware algorithm design
The overall hardware algorithm flowchart is shown in Figure.
The image processing algorithm of this example includes recognition calculation for pointer and Recognition calculation for number. When the detection of the whole representation number is completed, the result is sent to the M5 go module through the serial port.
2.1.1 K210 pointer identification
Based on the openmv library development and design, including the detection of the pointer in four circle areas. Detect the pixel information between the inner circle of the pointer and the outer circle of the small dial that meets the specific range of pixel values. According to the statistical pixel information, the final pointer angle will be obtained through the corresponding weighting calculation. The detection effect is shown in Figure.
2.1.2 K210 digital identification
Based on k210 neural network digital detection, using KPU of J210 chip, loading kmodel network model, to achieve the detection and recognition of printed numbers. Five digital rectangles are extracted and preprocessed for five rectangles: preprocessing includes graying, median filtering binarization and so on. After preprocessing, the pixel data in the rectangular area after preprocessing is input into the network for category prediction.
The preliminary work of the kmodel model generation includes the following processes:
The script of printed letter neural network is written based on tensorflow;
Production of printed letter data sets by data augmentation;
Training network and saving PB model;
Pb is transformed into tflite model;
Through NCC tool, tflite is transformed into kmodel model which can be loaded by k210;
2.1.3 Serial communication
After the module completes the detection algorithm in 2.1.1 and 2.1.2, the module needs to transmit the detection results to m5go module in the form of serial port. For the serial communication of K210, serial port 2 is selected as an example. With the initialization and setting of serial port 2, the related serial port setting information is: bit rate 115200; data bit 8; check bit none; stop bit 1.
2.2.1 M5 go serial communication
M5 go module uses the same configuration as 2.1.3 to complete communication.
2.2.2 M5GO interface design
The numbers from left to right represent × 10000, × 1000, × 100, × 10, × 1 respectively. The small dials from right to left represent × 0.1, × 0.01, × 0.001, × 0.0001 respectively.
2.2.3 data upload
The data received in 2.2.1 is transmitted to the server through the HTTPS request.
Register Aliyun server, purchase domain name and conduct real name authentication. Configure the server as Ubuntu system and install the corresponding development environment. The server receiving script is based on the flask library.