...stuff I do and things I like...

Thursday, February 11 2021

Introducing FluxN0de

Today I'm releasing FluxN0de a personal project I have been working on for about 1 year (nights and weekends). The project ended up being quite a bit different compared to when I started it.

What is FluxN0de?

FluxN0de is a platform (for me) to play with LoRa and LoRaWAN. Originally I bought a Adafruit Feather M0 with RFM95 LoRa Radio - 900MHz - RadioFruit in mid 2019 but had little joy with it and almost stopped caring. In late 2019/very early 2020 I gave it another try and bought a ESP32-based Huzzah32 board also from Adafruit and wired it up to a LoRa Feather. Using that combination I played with the various LoRa and LoRaWAN libraries that are available for the ESP32 platform.

When NYC was shutdown in March 2020 I suddenly had a lot of time on my hands.

Using the Huzzah+LoRa combination (see picture below) I basically tried to learn everything about ESP32 development, LoRa, and LoRaWAN. I ended up building a massive web application written in C that runs on the ESP32. This included things like JSON marshaling (where I ended up writing a code generator in go that emits C code). In recent years I hadn't had much exposure to low level development dealing with GPIOs, SPI, and so on, so that was a good refresher. Learning a little more about FreeRTOS and LWIP was also fun. I never really wrote any web apps so learning JavaScript and websockets was good.


After several month I was quite happy with my software but got frustrated with the Huzzah board. So my plan developed towards building my own board to fix all the issues I saw with the Huzzah board and by issues I mostly mean adding some features. Basically I had more time on my hands than I knew what to do with. For the next couple of month I tired to learn everything that would allow me to understand and finally build my own ESP32-based board that had a LoRa radio on the same PCB. It was quite a journey but I ended up with a working (and decent looking) Fluxboard.


So now that I have nice(r) hardware I looked more closely at my software. I grew a bit frustrated with the slow progress I made due to having to write everything in C and (of course) always had to flash and debug stupid mistakes I made. Having recently learned JavaScript (to write the web app for the early software stack) I thought it would be worth investigating various JavaScript engines and if I could integrate one of those into my software. Turns out Duktape works great on the ESP32. I ended up re-architecturing my entire project around running JavaScript applications.

So what is FluxN0de?

FluxN0de is a platform that executes applications written in JavaScript. The platform exposes APIs to control the hardware itself and to interact with the LoRa modem. The software stack hides a lot of complexity in regards to LoRa, Wifi, WebSockets, and BLE while still providing lots of control over (relevant) settings. The end result allows you to build applications and deploy them via a HTTP API without need to flash the board. I ended up writing a LoRaWAN library in JavaScript that provides lots of flexibility while still being easy to use.

The very original idea was to build a LoRa based messaging device that is connected to your smartphone via BLE. I had the idea when I saw some article about building a full-on LoRa pager with keyboard and display. I thought that was silly since your smartphone can do both of those functions a million times better. That is the main reason why my setup supports BLE and is designed to run on battery.



In summary: The whole project was a fantastic learning experience. Especially going thru multiple iterations of the software stack paired with different hardware configurations. I have planned to write a number of follow up posts about various parts of this project. This will likely include my experience of learning how to design Fluxboard. How I went about it and what tools I used. Spoiler I ended up using EasyEDA for the design and JLCPCB for the manufacturing. I also built a basic setup to measure the power/battery consumption of my boards. One of the most fun things is seeing how your software design impacts battery runtime, I will definitely write a blog post about that. I will probably start with a short post on how to develop apps for the FluxN0de environment.

Checkout the GitHub page for detailed documentation, examples, build instructions, and more.

GitHub: github.com/crmulliner/fluxnode