OneVariable Newsletter - 2021-11-24

First up for OneVariable Applied Research: a Forth.

This article was originally featured on the OneVariable Applied Research newsletter. If you'd like to get early access to these reports, you can sign up for the newsletter here. Newsletter emails are sent every Wednesday.

Articles are posted on my blog one week after appearing on the newsletter.

Abstract and Results

This week, I've been working on "Anachro Forth", a forth-inspired, bytecode-compiled scripting language for Anachro Powerbus platform.

The intended use case for Anachro Forth is to write and compile scripts on a Host PC, and to load and execute these scripts in a constrained, no_std environment, such as on embedded systems or WASM targets.

A picture of a red heart made of binary digits

This language will be used to build Expansion Cards for Powerbus, which come with their own built-in drivers, written and compiled to Anachro Forth.

I have also implemented a REPL/interactive interpreter for running in a PC environment, as well as a minimal embedded example project for the Nordic nRF52840, to validate the deserialization and runtime on a physical embedded platform.

Initial development has gone smoothly, and the project is already up and running on embedded devices for testing.

The Anachro Forth compiler/runtime is currently capable of:

  1. Compiling source code on a PC
  2. Serializing the program to bytes
  3. Deserializing the program on an embedded system, using no allocations
  4. Initializing the no_std runtime using the deserialized data
  5. Executing the program on the embedded system

The above example only required <= 4K of Flash, <= 1K of RAM, and the program itself was serialized to under 100 bytes.

Overall: A successful initial release!

Background Information

Anachro Forth is planned to be part of the Anachro Powerbus Platform. Powerbus is a totally built-from scratch hardware and software system, which I plan to use for home automation, art installations, sensor networks, human machine interfaces, and lighting.

Powerbus uses Ethernet cables to provide an RS-485 data bus, as well as up to 60W of power across the network. Power is provided using off the shelf USB-C PD supplies (like those used by laptops), and each individual device is capable of using up to 10W for automation or lighting purposes. Devices are daisy-chained to reduce cabling complexity.

Anachro Forth is planned to power a variety of extension cards, such as relays for controlling mains voltage, environmental sensors, data logging, and user interfaces. This will allow for hot-swapping of accessories, without requiring firmware updates.

If you're interested in more about Powerbus, I had a chat in September with a couple of folks where we talked about some of the implementation details of Powerbus, my plans, and the first revision of hardware. Click above to watch the chat on YouTube.

I have not yet made any stable releases of Powerbus as it is still in active development, but you can view the current status here on GitHub.

Suggestions For Future Research

Over the next week, I plan to wrap up Anachro Forth by writing a simple demonstration hardware driver. In a twitter poll, there was interest in building an SSD1306-based OLED driver, but I'll probably start with something simpler, like a basic time-based Relay driver. Interested in using Anachro Forth?

I've already had a couple people express interest in using Anachro Forth in their projects or products. If you need an ultra-light-weight scripting language, let me know! I am looking for end users to give it a test drive. Just send me an email so I know to keep you updated.

Interested in using Powerbus?

Are you looking to build a no-cloud smart device network? Perhaps looking to automate sensors or lighting in your own house or office?

I plan to build a limited (<= 50 devices) test batch of Beta-release Powerbus devices, and I am looking for people interested in buying, testing, or extending on top of the Powerbus platform. I currently hope to produce these before the end of the year, and shipping shortly afterwards. Just send me an email if you are interested!

Want to stay in touch between newsletters?

Click here to join the OneVariable Applied Research Matrix chat. I'll be posting day-to-day information, and sharing my thoughts as I go.

The Matrix chat is the best place to ask questions about my projects, give feedback, or inquire about using any of my research projects for your commercial (and non-commercial) applications!