Skip to content
anderswodenker edited this page Aug 8, 2020 · 4 revisions

Featurelist

  • online configuration
  • own update process
  • calibration and setting Userinterface (WebApp)
  • self test interface
  • offline mode to save datasets
  • debug mode

Measure data from:

  • DS18B20 (Temperature)
  • DHT22 (Temperature & Humditity)
  • I2S MEMS SPH0645 (Microphone)
  • H30A Load cell (Weight)

Configuration over DWH:

0 = false
1 = true

  • name: DEV (Name of the Configuration)
  • timezone: Europe/Berlin (Timezone needed for Datasets)
  • auto_update: 1 (Automatic Update)
  • auto_shutdown: 0 (Automatic shutdown after a measurecycle)
  • ignore_error: 0 (Error shown in the DWH)
  • debug: 1 (Debug messages shown in the DWH)
  • is_dht22: 1 (Measure DHT22 data)
  • is_scale: 1 (Measure Loadcell data)
  • is_microphone: 1 (Measure Microhone data)
  • is_ds18b20: 1 (Measure DS18B20 data)
  • app_median: 3 (Number of measurements for the sensors to calculate the median)
  • app_attempts_before_restart: 2 (Number of errors before restarting)
  • app_wait_seconds: 60 (Seconds that the system waits before starting new cycle)
  • dht22_pin: 23 (GPIO Pin for DHT22)
  • audio_duration: 10 (Seconds that the system collects audio data)
  • audio_fs: 8000 (Samplerate for the Microphone)

Error messages:

Failed to initialize [SENSOR] : Sensor is broken or the wiring is not correct
Cannot get Scale data: [ERROR MESSAGE] : Something is wrong with the wiring of the scale or the load cell is broken
Failed to insert log files: [ERROR MESSAGE] : Writing the log file failed
Failed to read log files: [ERROR MESSAGE] : Reading the log file failed
Failed to post log files: [ERROR MESSAGE] : Exception while posting the Log file. Broken pipe or something like that
[SENSOR] failed : Sensor is broken or sends no valid data (Similar to "Failed to initialize [SENSOR]"
Too many errors: reboot system! : Failed attempts of the System is >= "attempts_before_restart" in the config. This happen, if a Sensor failed. The system remembers the sensor and excludes it at the next restart

Process (in words):

  1. if debug is on: send following debug information:
  • Config version
  • Config Name
  • Signal strength
  • Voltage (vOut and vIn from wittyPi if installed)
  1. check if system has valid access token
  2. write online status (true or false)
  3. if online: synchronise configuration with online config if exists
  4. check if ignore_error
  5. append sensors from config list
  6. start get sensor data
  7. if sensor data valid, try to send this data
  8. if status code 200: (data accepeted) then the system jump to step 9)
  9. if status code 400: delete the dataset
  10. if status code not 200 or 400, the system save the dataset (refer to save feature) and switch to offline mode
  11. if sensor data is courrupt, send error message to DWH ([SENSOR] failed!) and delete the dataset
  12. try to post log files to DWH
  13. if response 200: delete the dataset
  14. if response 400: delete dataset (redundant to point 7.)
  15. if not repsonse: return false
  16. if repsonse from logfiles are false: add one failed attempt
  17. if failed attempts > app_attempts_before_restart (in config): send error message to DWH (Too many errors: reboot system!)
  18. check for update and if auto_update true:
  19. pull the new update.py
  20. write update file to recnognize the new update after restart
  21. restart
  22. the system will recocnize the new update and execute the new update.py
  23. restart
  24. if auto_shutdown: shutdown the system
  25. wait app_wait_seconds before begin the new cycle
Clone this wiki locally