Skip to content

Development ‐ getting setup

Mitra Ardron edited this page Nov 1, 2025 · 1 revision

I have been asked what people need to participate in development, either of their own nodes, or of the library.

What you need will depend on what you plan on doing - which I fit into about three categories i.e. do you want to.

  • Assemble an existing project, such as a Temperature sensor, or program a Sonoff.
  • Develop a new node, for example you want to build a node with temperature, humidity soil and pressure.
  • Work on the library and core itself.
section Assemble Develop a node Library and core
Tools See the how-to guides Most of the tools below Ditto
Dev boards & sensors See the how-to-guides Just the dev board and sensor you are working on A good range as suggested below
Software platform (IDE) Arduino IDE or Platform IO Platform IO PlatformIO
Software configuration See how-to-guides See below See below

Tools and related consumables

If I wanted to be able to work on a fairly wide range of hardware, here is what I would personally recommend having. I’ve provided sources and prices where I know them - I tend to buy on AliExpress, but none of the brands and tools are brand specific so you can buy wherever convenient (especially if the prices below are no longer current).

Item  Cost Notes  
Soldering Iron ~€10 Any one with fine bits (I would not recommend the one I purchased as bits were not available).
Soldering magnifier and clips €7.00 You really need an extra pair of hands
Solder Mat €2.04 Solder splashes damage desks
Sharp knife €1.39 I find a small really sharp knife, like that shown is important for clearing solder mistakes etc
Diagonal Pliers €2.97 Pretty much anything will do, mostly for cutting and stripping wires, sine most wire strippers don't do small wires well.
Drill and bit If you want to add external aerials to boxes
Multimeter €3.80 Doesnt have to be fancy, I prefer the non-auto-ranging type.
USBC power measurement €5.65 if you want to test power requirements or work on power, I have the KWS-2302C
Philips screwdriver
Heat shrunk + shrinker €7.84 heat shrunk is used to insulate solder joints, you can use a hair dryer if necessary but it tends to heat, and risk damaging, everything around it.
Solder sucker €2.35 Because we all make mistakes
Cable/zip ties €1.16 to hold things together, and relieve strain - get the smallest ones.
Velcro cable ties US7.65 You can certainly get cheaper, but I keep coming back to these ones.
FTDI programmer €1.28 For programming sonoffs
USB power supply
USB cables Make sure they will do data as well as power - USB-C and USB-A to whatever your laptop has
USBA-USBC adapter €0.92 My laptop is USBC (Mac) so these are helpful
I2C cables €2.34 You want SH1.0 4P for the lolin or Lilygo boards
Total ~€54.60

Parts for sensors

Development boards:

See supported hardware where you will find a list of boards currently tested. There is a note at the bottom for recommended ones, and I would recommend getting a couple of each since there is nothing more annoying than frying a board, and not having a $5 replacement! Get three of the Lilygo T3S3 if you want to test LoRa mesh networking. I hope to source cheaper LoRa boards, and have a few brands on order, but nothing yet arrived and tested.

Sensors

This will depend what you want to measure. I generally develop and test on the SHT30. I work on the cheap ones but for deployment prefer the Deeley or equivalent with about a 1 meter cable. ENS160AHT21 is also good for broader air quality

You will want at least one sensor that returns analog. I test on the soil meter.

I am currently working to get a load sensor (200kg) working for cheap networked scales.

See supported hardware for links

Actuators

I would recommend getting a few of the Sonoffs. The R2's work well, but are a small ESP8266 compatible chip, which has too small a memory so cannot be updated Over-The-Air, I have just bought some R4's which are ESP32 and will test. R3's are apparently hard to program.

See supported hardware for links

Enclosures

I have had good results with the range of ABS boxes from Vance. They come in different sizes, e.g. 61x36x22 for €0.30 plus shipping which is a good width for most development boards. Because shipping costs more than the product on boxes, it might be worth looking locally, or buying a larger quantity.

Power

Building a power solution is an evolving task (solar, battery, etc), please ping me if you are interested, otherwise everything above will work off USB power.

Software etc.

While the system works on Arduino IDE, for anything more than just flashing an existing application to a node, I recommend going directly to either PlatformIO or PIOArduino (but not both) which are (free), almost identical, plugins for Visual Studio (at the moment Frugal-IoT works with both).

There are tutorials online for installing Visual Studio, and adding PIOArduino, such as this.

How you configure your code will depend on whether you want to develop a node, or work on the library itself.
Working on the library is slightly more complicated and the differences are flagged below.

This is my setup - and if you find a better, or just alternative, way of doing it then please feel free to add it here.

For either working on your node, or on the library

Open Visual Studio, click the Home icon (bottom left); New Project; call it whatever you want, we'll assume below it is called YourProjectName

If you want to test with Arduino IDE as well, then put it in Documents/Arduino/ as it tends to be fussy about project location.

Once the project opens, add files to data/wifi with the wifi routers you use frequently, you can flash this to each of your devices, and they survive flashing new code.

Just for developing on the library

In your terminal cd into lib and clone https://github.com/mitra42/frugal-iot.

You can do this in PlatformIO directly: Source control ... `Clone` `https://github.com/mitra42/frugal-iot` Pick the `YourProjectName`/`lib`.

Or from the command line on Macs or Linux.

cd YourProjectName/lib
git clone https://github.com/mitra42/frugal-iot

This downloaded library will override the library automatically installed during builds.

For either working on your node, or on the library

Copy an example e.g. YourProjectName/lib/examples/sht30/sht30.ino to YourProjectName/src/main.cpp, you can edit this for your current application

AND copy YourProjectName/lib/examples/sht30/platformio.ini to YourProjectName and edit it. about line 21: src_dir = . should be commented out as ; src_dir = .

Once done it should look somewhat like this ...

YourProjectName

  • data Top of tree of configuration flashed to file system on device - overwritten during operations
    • wifi Pre defined wifi access points - note these can be added to from captive portal
      • _HOME_ File containing password of a router with SSID=HOME
  • lib Local copy of the library if you are developing the library.
    • Frugal-IoT Cloned as noted above
      • docs Obsolete and being merged into the wiki - ignore this directory
      • examples Examples that ship with the library
        • sht30 Example for SHT30 sensors
          • platformio.ini Specific configuration file with build instructions for the SHT30 example
          • sht30.ino The main C++ file for the SHT30 example
      • src The library source files - documented elsewhere (TODO find where!)
      • library.json Update this if push a new version - used by PlatformIO
      • library.properties Update this if push a new version - used by Arduino IDE
  • src
    • main.cpp The app you are currently working on.
  • platformio.ini Configuration for the app you are working on, modified as noted above.

Sorry it is this complex, I haven't found a better way of working on github libraries within platformIO.

Some problems we've seen in getting setup.

These are necessarily brief answers, feel free to reach out if they are not clear.

Error Explanation Solution
'esp_pm_config_t' or
'WL_STOPPED' was not declared in this scope
Platform or Libraries are out of date, they changed this and a few other fields platform=espressif32 is not sufficient look at the platformio.ini in any of the examples.

How to fix the cases above

Developing on the server, logger and client

While it is a lot less likely that you'll do development work on the server, it is necessary to have a server running if you want to develop on the client.

The documentation before is based on Visual Studio (and only tested on Macs), however personally I use JetBrain's WebStorm so feel free to reach out if that is what you want to use.

Clone the repos and open it ....

You can do this in Visual Studio directly:

Visual Studio -> File/New Window -> Source Control ... Clone https://github.com/mitra42/frugal-iot-client

Pick a directory for this.

Then follow the same process, in a new window, to clone frugal-iot-logger and frugal-iot-client into directories next to it.

Your tree should look like ....

📁 YourDirectory
  📁 frugal-iot-client
  📁 frugal-iot-logger
  📁 frugal-iot-server

The server needs to know to use a local copy of the logger and client.

So go back to the server window and in frugal-iot-server.js, around line 85 you should see

// If you are developing comment out the Production line, and uncomment the Development line
// Production
import { MqttLogger } from "frugal-iot-logger";  // https://github.com/mitra42/frugal-iot-logger
// Development of Logger
// import { MqttLogger } from "../frugal-iot-logger/index.js";  // https://github.com/mitra42/frugal-iot-logger

Follow the instructions so it looks like this ....

// If you are developing comment out the Production line, and uncomment the Development line
// Production
import { MqttLogger } from "frugal-iot-logger";  // https://github.com/mitra42/frugal-iot-logger
// Development of Logger
// import { MqttLogger } from "../frugal-iot-logger/index.js";  // https://github.com/mitra42/frugal-iot-logger

Now - to tell the server to use your edited client, rather than the distributed library, similarly, edit config.d/server.yaml so it has lines looking like:

#Production mode
# nodemodulesdir: ./node_modules
# htmldir: ./node_modules/frugal-iot-client

# Development mode
htmldir: ../frugal-iot-client
nodemodulesdir: ../frugal-iot-client/node_modules

Starting the local server

Visual Studio -> Run -> Start Debugging -> Node.js

This should start a local server, talking to the MQTT broker at frugaliot.naturalinnovation.org, the window should show it connect and start receiving the topics that the logger needs access to.

Developing on the client

Navigate to the Visual Studio window you opened in frugal-iot-client

Mostly you will probably be editing the file webcomponents.js

If you open a browser window - and I recommend using Chrome, you can navigate to localhost:8080. I suggest also going to Chrome->View->Developer->Developer Tools where you'll see MQTT messages (and errors) in the Console

This should prompt you to login or register.

Currently (and this will change) you can just Register and then Login with this new Username and Password (later there will be an approval step added). It is important to note, this is registering on your local box, not on the frugaliot.naturalinnovation.org server, which you need to do separately.

If you make any changes to webcomponents.js and reload the browser window, these should show up immediately as the new file will be served by your local server.

Contributing your work back

TODO document contributing your work back -- please ask if this note hasn't been removed yet and you want to contribute

Clone this wiki locally