EmbeddedRelated.com
The 2026 Embedded Online Conference

When a Mongoose met a MicroPython

Sergio R Caprile
Still RelevantIntermediate

This is more a framework than an actual application, with it you can integrate MicroPython and Cesanta's Mongoose.
Mongoose runs when called by MicroPython and is able to run Python functions as callbacks for the events you decide in your event handler. The code is completely written in C, except for the example Python callback functions, of course. To try it, you can just build this example on a Linux machine, and, with just a small tweak, you can also run it on any ESP32 board.


Summary

This post presents a framework for integrating MicroPython with Cesanta's Mongoose networking library, implemented primarily in C. Readers will learn how Mongoose can be invoked from MicroPython and how Python functions can be used as event callbacks, with instructions to build on Linux and a small porting note for ESP32 boards.

Key Takeaways

  • Understand how to call Mongoose from MicroPython and wire C-level events to Python callbacks.
  • Integrate the Mongoose networking library into a MicroPython-enabled firmware using a C bridge.
  • Implement event handlers that dispatch to Python functions while keeping the core in C for performance.
  • Port and build the example on Linux and apply a minimal tweak to run the same framework on ESP32.

Who Should Read This

Embedded/firmware engineers with C and MicroPython experience who want to combine a lightweight networking stack with Python callbacks for IoT or embedded Linux projects.

Still RelevantIntermediate

Topics

Firmware DesignIoTEmbedded LinuxRTOS

Related Documents


The 2026 Embedded Online Conference