jomjol / AI-on-the-edge-device

Easy to use device for connecting "old" measuring units (water, power, gas, ...) to the digital world
https://jomjol.github.io/AI-on-the-edge-device-docs/
5.67k stars 612 forks source link

Corrected value shows only decimals. #247

Closed domborovicova closed 3 years ago

domborovicova commented 3 years ago

Version: master - v7.1.1 - 2020-05-30

HTML version: 6.8.0

Issue: I've installed and configured water meter yesterday and everything worked ok. Today I've found out that it shows wrong corrected value or it rather shows only decimals unlike raw value which has right value.

issue_wattermeter

Here is my configuration:

;LogImageLocation = /log/source
;LogfileRetentionInDays = 15
WaitBeforeTakingPicture = 5
ImageQuality = 5
ImageSize = VGA
;Brightness = -2
FixedExposure = false

[Alignment]
InitialRotate = 123
FlipImageSize = false
/config/ref0.jpg 189 294
/config/ref1.jpg 389 131
SearchFieldX = 20
SearchFieldY = 20
InitialMirror = false
AlignmentAlgo = Default

[Digits]
Model = /config/dig0870s3q.tflite
;LogImageLocation = /log/digit
;LogfileRetentionInDays = 3
ModelInputSize = 20 32
digit1 197 129 37 67
digit2 237 129 37 67
digit3 275 129 37 67
digit4 315 129 37 67
digit5 353 129 37 67

[Analog]
Model = /config/ana0700s1lq.tflite
;LogImageLocation = /log/analog
;LogfileRetentionInDays = 3
ModelInputSize = 32 32
analog1 400 199 75 75
ROI1 372 293 75 75
ExtendedResolution = false

[PostProcessing]
DecimalShift = 0
PreValueUse = true
PreValueAgeStartup = 720
AllowNegativeRates = true
;MaxRateValue = 0.1
ErrorMessage = true
CheckDigitIncreaseConsistency = true

[MQTT]
Uri = mqtt://<mqtt_broker>:1883
Topic = wasserzaehler/zaehlerstand
TopicError = wasserzaehler/error
TopicRate = wasserzaehler/rate
TopicTimeStamp = wasserzaehler/timestamp
ClientID = wasser
user = <user>
password = <password>

[AutoTimer]
AutoStart = true
Intervall = 30

[Debug]
;Logfile = true
LogfileRetentionInDays = 1

[System]
TimeZone = CET-1CEST
TimeServer = <ntp_server>
;Hostname = watermeter
;SetupMode = false

[Ende]

Here is LOG Output ( I turned on debug logging after value 0.66 ):

2021-06-17T06:37:53: Time zone set to CET-1CEST,M3.5.0,M10.5.0/3
2021-06-17T06:37:53: =============================================================================================
2021-06-17T06:37:53: =================================== Main Started ============================================
2021-06-17T06:37:53: =============================================================================================
2021-06-17T06:37:57: Time zone set to CET-1CEST
2021-06-17T06:37:14: task_autodoFlow - next round - Round #1
2021-06-17T06:37:14:    FlowControll.doFlow - ClassFlowMakeImage
2021-06-17T06:37:22:    FlowControll.doFlow - ClassFlowAlignment
2021-06-17T06:37:44:    FlowControll.doFlow - ClassFlowDigit
2021-06-17T06:37:47:    FlowControll.doFlow - ClassFlowAnalog
2021-06-17T06:37:50:    FlowControll.doFlow - ClassFlowPostProcessing
2021-06-17T06:37:50:    FlowControll.doFlow - ClassFlowMQTT
2021-06-17T06:37:50: sent publish successful in MQTTPublish, msg_id=35362, wasserzaehler/zaehlerstand, 0.68
2021-06-17T06:37:50: sent publish successful in MQTTPublish, msg_id=10594, wasserzaehler/error, no error
2021-06-17T06:37:50: sent publish successful in MQTTPublish, msg_id=64922, wasserzaehler/rate, -0.000000
2021-06-17T06:37:50: sent publish successful in MQTTPublish, msg_id=53210, wasserzaehler/timestamp, 2021-06-17T06:37:22
2021-06-17T06:37:50: task_autodoFlow - round done
2021-06-17T06:37:50: CPU Temperature: 50.0
2021-06-17T06:38:42: download_get_handler
2021-06-17T06:38:45: download_get_handler
2021-06-17T07:07:14: task_autodoFlow - next round - Round #2
2021-06-17T07:07:14:    FlowControll.doFlow - ClassFlowMakeImage
2021-06-17T07:07:22:    FlowControll.doFlow - ClassFlowAlignment
2021-06-17T07:07:44:    FlowControll.doFlow - ClassFlowDigit
2021-06-17T07:07:47:    FlowControll.doFlow - ClassFlowAnalog
2021-06-17T07:07:50:    FlowControll.doFlow - ClassFlowPostProcessing
2021-06-17T07:07:50:    FlowControll.doFlow - ClassFlowMQTT
2021-06-17T07:07:50: sent publish successful in MQTTPublish, msg_id=17242, wasserzaehler/zaehlerstand, 0.69
2021-06-17T07:07:50: sent publish successful in MQTTPublish, msg_id=4992, wasserzaehler/error, no error
2021-06-17T07:07:50: sent publish successful in MQTTPublish, msg_id=15442, wasserzaehler/rate, 0.000334
2021-06-17T07:07:50: sent publish successful in MQTTPublish, msg_id=4586, wasserzaehler/timestamp, 2021-06-17T07:07:22
2021-06-17T07:07:50: task_autodoFlow - round done
2021-06-17T07:07:50: CPU Temperature: 49.4
2021-06-17T07:37:14: task_autodoFlow - next round - Round #3
2021-06-17T07:37:14:    FlowControll.doFlow - ClassFlowMakeImage
2021-06-17T07:37:22:    FlowControll.doFlow - ClassFlowAlignment
2021-06-17T07:37:44:    FlowControll.doFlow - ClassFlowDigit
2021-06-17T07:37:47:    FlowControll.doFlow - ClassFlowAnalog
2021-06-17T07:37:50:    FlowControll.doFlow - ClassFlowPostProcessing
2021-06-17T07:37:50:    FlowControll.doFlow - ClassFlowMQTT
2021-06-17T07:37:50: sent publish successful in MQTTPublish, msg_id=8163, wasserzaehler/zaehlerstand, 0.75
2021-06-17T07:37:50: sent publish successful in MQTTPublish, msg_id=25627, wasserzaehler/error, no error
2021-06-17T07:37:50: sent publish successful in MQTTPublish, msg_id=12450, wasserzaehler/rate, 0.002000
2021-06-17T07:37:50: sent publish successful in MQTTPublish, msg_id=17842, wasserzaehler/timestamp, 2021-06-17T07:37:22
2021-06-17T07:37:50: task_autodoFlow - round done
2021-06-17T07:37:50: CPU Temperature: 49.4
2021-06-17T08:07:14: task_autodoFlow - next round - Round #4
2021-06-17T08:07:14:    FlowControll.doFlow - ClassFlowMakeImage
2021-06-17T08:07:22:    FlowControll.doFlow - ClassFlowAlignment
2021-06-17T08:07:44:    FlowControll.doFlow - ClassFlowDigit
2021-06-17T08:07:47:    FlowControll.doFlow - ClassFlowAnalog
2021-06-17T08:07:50:    FlowControll.doFlow - ClassFlowPostProcessing
2021-06-17T08:07:50:    FlowControll.doFlow - ClassFlowMQTT
2021-06-17T08:07:50: sent publish successful in MQTTPublish, msg_id=59200, wasserzaehler/zaehlerstand, 0.75
2021-06-17T08:07:50: sent publish successful in MQTTPublish, msg_id=59664, wasserzaehler/error, no error
2021-06-17T08:07:50: sent publish successful in MQTTPublish, msg_id=54896, wasserzaehler/rate, 0.000000
2021-06-17T08:07:50: sent publish successful in MQTTPublish, msg_id=14428, wasserzaehler/timestamp, 2021-06-17T08:07:22
2021-06-17T08:07:50: task_autodoFlow - round done
2021-06-17T08:07:50: CPU Temperature: 49.4
2021-06-17T08:35:09: download_get_handler
2021-06-17T08:35:09: download_get_handler
2021-06-17T08:35:12: download_get_handler
2021-06-17T08:35:14: download_get_handler
domborovicova commented 3 years ago

Here are readings: all_readings

jomjol commented 3 years ago

Did you set the prevalue?

domborovicova commented 3 years ago

Did you set the prevalue?

Yea at the beginning I set it to 732.2 I believe.

jomjol commented 3 years ago

Maybe there was a wrong detection on the digits. I would suggest to set the following parameters

AllowNegativeRates = false
MaxRateValue = 0.5

Disabling AllowNegativeRate will ensure, that the counter is not running backwards, so if a "0" is detected, this will be detected as false reading. MaxRateValue limits the maximum change to the upper, so if the detected number is much to big, this will be ignored also. The right number depends on your maximum water consumption and reading intervall. That should make your reading much more stable.