upyOS on microcontrollers: what it is, how it works, and how to power it without interruptions.

  • upyOS provides a services layer on top of MicroPython with tasks, networking, logs, and orderly startup.
  • For robustness, combine upyOS with a well-sized UPS or DC backup.
  • Choose between off-line, interactive or on-line UPS depending on the criticality and sensitivity of the load.

upyOS for microcontrollers

If you're wondering what the hell it is upyOS in the world of microcontrollersYou're not alone: ​​this query is often confused with UPS (uninterruptible power supply). Here you'll find a clear explanation of what upyOS is, how it fits into your embedded projects, and, since confusion is common, a practical guide on how to use it. uninterruptible power supply for boards such as ESP32, STM32 or Arduino, with real recommendations drawn from common experiences.

The idea is twofold: first, understand the "software" aspect that upyOS provides, and second, don't neglect the "electrical" aspect, because a good runtime is useless if your systems shut down during a power outage. Throughout the article, you'll see Features, architecture, uses, and deployment tips for upyOSIn addition, we include a complete blog on UPS systems, including types, advantages, and a recipe for setting up a backup with an 18650 battery and charging module to keep your devices safe.

What is upyOS for microcontrollers?

The term upyOS is often used to refer to a lightweight “operating system” layer on top of MicroPython (the Python port intended for microcontrollers), and is sometimes compared to alternatives such as Spurine, which follow different approaches; which organizes the execution of tasks, timers, drivers, and system resources in a convenient and consistent way. It's not a monolithic desktop-style operating system; think of upyOS as a Structured runtime that adds system services to the MicroPython environment to make your IoT and embedded applications more maintainable.

In practice, upyOS provides utilities for task planning (cooperative), event handling, timers, peripheral abstractions, and initialization utilities (starting services at boot, loading order, etc.). Above all, it seeks to ensure that the developer does not have to fight with low-level glue in each project and can reuse system components (network, storage, sensors) consistently across boards.

A relevant advantage for small teams is that upyOS avoids reinventing the wheel: establishes conventions (file locations, main/boot, service modules) and provides utilities for lifecycle management of the application in devices with limited resourcesThe layer makes it easier to maintain order in projects with limited memory and CPU.

It is also common to incorporate typical everyday integrations: WiFi/Ethernet connectivity, simple clients and servers (HTTP/MQTT), log record, and OTA update utilities when the board allows it. Thus, the basis of the project focuses on the business logic, and the “system” is set by upyOS.

upyOS and microcontrollers

upyOS Architecture and Components

At a high level, you can imagine upyOS split into system modules that start in order and expose simple APIs. Although the exact details vary by implementation, you'll typically find pieces like:

  • Planner/Task: a main loop with cooperative micro-tasks, timers and callbacks, taking advantage of MicroPython (and sometimes uasyncio) facilities to avoid deadlocks.
  • Device management: initialization of buses (I2C, SPI, UART), GPIO, PWM and sensor or actuator drivers common for reuse in multiple projects.
  • Red: helpers for WiFi/Ethernet, DNS, sockets and typical protocols (e.g., MQTT for IoT) with automatic reconnection and persistent credentials.
  • Storage: file system utilities (LittleFS/FAT), folder structure, logs and parameters, and configuration load at the start.
  • Services at the beginning: mechanism to decide which services go up in boot.py and how execution is chained to main.py, with minimum diagnosis (e.g. LED flashing if something fails).

This architecture is based on MicroPython, which means that it is portable between multiple families of microcontrollers with mature ports: ESP32, STM32, RP2040, among others. The upyOS layer differs from a classic RTOS (such as FreeRTOS) in that favors simplicity and programming in Python, sacrificing preemptive scheduling for cooperative scheduling in many cases to keep consumption and complexity low.

In typical IoT applications (telemetry, environmental monitoring, light automation), that approach is more than sufficient: the hard real time It is rarely necessary, and the development speed that Python brings more than makes up for it.

Another common pillar in upyOS is the observability: a logging system with levels (INFO, WARN, ERROR), simple timestamps, and file/serial destinations that allow you to analyze incidents without deploying heavy tools. Even more so if you add automatic network reconnection and in-memory message queues. tolerate cuts of temporary connectivity.

upyOS system for microcontrollers

Key Features and Benefits

The big attraction is that upyOS brings a common and reusable base for projects on different boards: you carry the same service structure, configuration, and boot to each device, with minimal hardware-specific changes.

Among the most requested practical functions are: orderly boot (boot services), network reconnection with back-off, stable timers for sampling/peripherals and shutdown hooks (to leave peripherals in a safe state if the system goes to sleep or reboots).

At the production level, the use of MicroPython and a upyOS layer drastically reduces the prototyping timeThe network, sensor, and persistence modules are already in place, so you spend most of your time on logic (e.g., data submission policy or the specific automation of your installation).

Another advantage is the ease of extension: if you incorporate a new sensor via I2C, you only need a small driver and register it in the device managerThe rest of the system (tasks, logs, network) doesn't even notice, and you continue working with a consistent API.

Last but not least, upyOS promotes good practices on resource-limited devices: avoid crashes, decouple tasks, use timers, write logs sparingly, and persist configuration in files instead of compiling rigid constants into the code.

upyOS features and benefits

Compatibility, installation and practical uses

Typical upyOS compatibility follows that of MicroPython: ESP32, STM32, RP2040 and other platforms with active port. In heterogeneous fleets, this portability means that the same app (or a very similar one) can run on multiple boards, such as the Seeed Studio XIAO without redoing the skeleton of the system.

Deployment is usually straightforward: flash MicroPython on your board, copy the file tree (boot.py, main.py, service folders and configuration) and reboot. If the project includes a network, upyOS usually first raises the credentials and, after obtaining the IP, starts dependent services (e.g., MQTT or HTTP), recording what happened in the log.

In real-life scenarios, these patterns fit perfectly into tasks such as LoRa/WiFi telemetry, light automation of environmental sensors, relay control, simple gateways, and nodes that send data to the cloud. Many developers have tried combinations with ESP32-LoRa, where the system stack (upyOS) manages the network, logs, and timers, and your code only decides what and when to post.

Practical advice: Even with a tidy runtime like upyOS, don't forget to plan for proper device shutdown in the event of power failures; that's where uninterruptible power comes in, and below we'll tell you how to resolve it without any headaches.

upyOS installation and compatibility

Not to be confused with UPS: uninterruptible power supply for your microcontrollers

“UPS” or “SAI” (in English, Uninterruptible Power Supply; in Spanish, Uninterruptible Power Supply) is not an operating system, but a electrical backup equipment that keeps your devices alive during a network outage or anomaly. This is key in IoT scenarios, laboratories, or remote deployments where losing power would mean data loss or crashes.

How it works in general: a UPS has internal batteries that are charged while there is a network, a rectifier (goes from AC to DC for charging), a investor (converts battery DC to AC output) and a small microcontroller that detects the cut and switches in milliseconds. Some models also stabilize the voltage and filter harmonics and peaks.

There are three main technologies UPS that should be distinguished to choose well according to the criticism of the protected equipment:

  • Off-line (basic): They switch to battery power when they detect a power cut. Economical and effective for PCs, basic or hobby systemsThere is a short changeover time, acceptable for most non-critical loads.
  • Interactive line: like the previous one, but with automatic voltage regulator (AVR). They correct minor drops/rises without draining the battery, and they switch faster. Very suitable for routers, NAS or office equipment.
  • On-line (double conversion): The inverter always powers from battery/DC, so there are no switching windows. They give the “cleanest” and most stable output for delicate loads (switches, links, servers, instrumentation). They are more expensive and efficient at the cost of greater complexity.

Practical advantages: a UPS not only allows you to save and turn off safely, it also protects against spikes, transients and drops, extending the equipment lifespan and reducing maintenance costs. For embedded nodes, it also prevents file system corruption if a power outage catches the device writing to flash.

Components to remember when selecting a UPS or designing an embedded backup: battery (its capacity determines autonomy), investor (wave quality and output power), rectifier (carrying capacity) and power control (transfer times and protections).

A note that many overlook: while Arduinos tend to be undemanding, ESP (ESP8266/ESP32) They require considerable current peaks in WiFi/LoRa. Some mobile chargers deliver less current than they claim in practice, and the result is random resetsAlways check with real-world testing before relying on the label.

If you work with the electrical grid, remember safety: Mains voltages should only be handled by qualified professionalsFor prototypes, a laboratory power supply or a commercial UPS makes life much easier without exposing yourself to unnecessary risks.

DIY alternative to a microcontroller? It's relatively easy to build a DC backup with a 18650 Li‑ion battery and a charger/protection module. The battery is charged from a stable 5V source, the controller cuts off in time to prevent overcharge and deep discharge, and the microphone remains powered during the cut.

On those modules you will see pins marked as BAT+ and BAT‑ to connect the cell, and outputs to your board (5 V via USB or 3,3 V regulated, depending on the design). If your USB connector is very “fat”, it is not unusual to have to bend or adapt carefully the physical link in compact assemblies.

A typical switching test flow is to schedule a ESP32 with LoRa and WiFi and force a power outage to verify that the system doesn't reboot and that upyOS continues to run tasks and resend data when the network returns. This will give you confidence before deploying.

Sizing Tips: Add up the power (W) of your loads and add a margin of 20-25%If you have values ​​in amps, multiply by the voltage (V) to estimate watts. Choose the runtime according to your case (minutes to shut down neatly, or more if you want). operational continuity prolonged).

The actual autonomy depends on consumption and duty cycle; if you go with internal batteries, remember that they usually last 3–5 years and it is advisable to test the UPS from time to time (self-test) to avoid surprises. Some recommend a periodic controlled discharge when used as an embedded UPS. enlarge the life and “move” the chemistry of the cell.

Applications and benefits summarized:

  • Data Protection: Prevents file corruption and telemetry loss; allows for clean shutdown of processes.
  • Quality of supply: filters spikes, regulates voltage and reduces electrical noise, key in sensitive equipment.
  • Saving: fewer breakdowns, less maintenance, longer lifespan of routers, switches, boards and peripherals.

Of course, there are also high-power, high-performance industrial UPSs (> 93% efficiency (in some multi-kilowatt models) for serious loads. For microcontrollers and lab electronics, with a well-sized line-interactive or a small DC backup with an 18650 you are served in most cases.

Practical details of experimental setup: with modular “mini PSU” sources you can build your own AC input if you are professional and meet touch-proof terminals, insulation and air gapsFor the rest, a laboratory power supply or a commercial UPS with a USB/12 V output is better, and the box should be closed without being exposed to the mains.

And one last recommendation: even if you see that your plate is “holding”, valid under load real (WiFi transmitting, active sensors, flash writing). Many instabilities only appear at peak power consumption, and that's where a well-resolved backup makes all the difference.

With all of the above in mind, upyOS puts you in order on the software level (tasks, services, network, logs) and a UPS/DC backup protects you on the electrical level; combined, they turn a fragile prototype into a reliable device Ready to go without a hitch: Plan your services with MicroPython, log what happens, size power correctly, and verify with switching tests before deploying in the field.

What are ARM Cortex-R and Cortex-M?
Related article:
ARM Cortex-R and Cortex-M: what they are, differences, and when to choose each one