Recently I published a simplified version of the Always-On project hardware. Read this post for details. Today I publish a firmware example for the Always-On project.
This firmware is written for the PlatformIO environment using Visual Studio Code. It is using a special adaption of my HAL layer for PlatformIO using the Arduino layer for Adafruit Feather M0 boards.
I chose this approach, because it works on every operating system. Also, the Visual Studio Code development environment has code completion and all modern editor features one would expect. It works seamlessly with my HAL layer, to write rock solid and easy to understand code.
How to Setup the Project
- Install PlatformIO with Visual Studio Code as described here: https://platformio.org/platformio-ide
- Clone the
AlwaysOnWorkshop
repository with all submodules:git clone --recurse-submodules [email protected]:LuckyResistor/AlwaysOnWorkshop.git
- Open the project in Visual Studio Code from the PIO home page.
That is all you have to do. The required platform libraries for the project should be installed automatically after you open the project the first time.
About the Firmware Example
The firmware assumes the following hardware configuration:
- The workshop light is attached to the (
OUT
) output. - The switch in the workshop is configured as push button and attached at the (
BTN
) input. - Two motion sensors are attached at
S1
andS2
, rising the line from GND to V3.3 if motion is detected. - A simple four LED display is attached using a
TCA9534
IO-expander chip on theSDA
/SCA
pins. See the following schema:

Usage
If you enter the workshop, the light is automatically turned on. If you leave it, it will automatically turn off after one hour.
To shorten the duration to turn the light off, you simply press the light switch once when you leave the workshop. If no motion is detected in the next 30 seconds, the light will turn off.
Conclusion
The provided example code should give you an excellent start for your firmware. The Always-On project is meant to provide a reliable bridge between the mains power installation and any smart controlling system.
If you have any questions, missed any information, or simply want to provide feedback, feel free to comment below. 😄
More Posts

Logic Gates Puzzle 101
Read More

Candlelight Emulation – Complexity with Layering
Read More

Three Ways to Integrate LED Light Into the Modular Lantern
Read More

Rail Grid Alternatives and More Interesting Updates
Read More

Stronger 3D Printed Parts with Vertical Perimeter Linking
Read More

Update to the Storage Boxes System
Read More