Skip to content

File structure

Mitra Ardron edited this page Sep 23, 2025 · 2 revisions

FrugalIoT: File structure

The following conventions apply to node files in the FrugalIoT project, where exactly these directories appear will depend on whether you are developing an application or the frugal-iot library itself.

At the top level in Platform_IO you can put.a data directory, and use it to put configuration data to put on the device at flash time

  • data A way to
    • frugal-iot
      • device_name Name of the device e.g. SHT sensor this can be overridden in the UX
      • project Name of the project this device will be installed at - e.g. developers this can be overridden in the UX
    • wifi Holds one file per wifi that should be recognized
      • foobar Filename is the SSID of the wifi access point, file contains one line which is the password
    • sht One directory for each section, sensor, etc being configured
      • temperature
        • max Could set this to 100 for example to change the maximum temperature showed in the UX for this device

The library itself has the following parts

  • note these are in structural, rather than alphabetical order
  • examples
    • sht30 One directory per example
      • sht30.ino. The code that runs that example
      • platformio,ini Configuration, and how to compile on different boards

In the src directory there are 4 main groups of files, and a few individuals

  • src
    • _settings.h High level defines used across multiple modules - for example which languages to use. Also some board specific defines
    • misc Some utility functions used in many places (like StringF)
    • frugal_iot.h. Master .h file, most applications just include this, in order to get everything

The rest of the src files are in four groups.

  • src
    • actuator Outputs, turning things on or off etc in response to MQTT
    • sensors Inputs, reading from the environment and sending to MQTT
    • control Control, connect to inputs, and set outputs.
    • system Everything to do with the overall platform - including mqtt wifi captive etc

Groups

  • src (most files have a .cpp and .h part)
    • actuator Main class for actuators
    • actuator_digital Main class for digital actuators - relays etc
    • actuator_xxx Specific actuators, like ledbuiltin
    • sensor Main class for sensors
    • sensor_analog, float, ht, uint16. Classes that contain common functionality for groups of sensors, for example float is for those that return a float.
    • sensor_xxx Specific sensors e.g. sht30 or bh1750
    • control Main class for anything that handles controls

Clone this wiki locally