DEV Community

Cover image for  Simple OTA updates for Micropython with Senko.
Jakub Bednarski
Jakub Bednarski

Posted on • Originally published at

Simple OTA updates for Micropython with Senko.

With the rise of Micropython usage across Espressif microcontrollers, It is worth noting the importance of Over-The-Air updates in developing new features and maintaining security.

That is why I built Senko, a simple way to update your Micropython microcontroller from the GitHub repository, which I used for my ESP8266 based sensor fleet.

GitHub logo RangerDigital / senko

Simplest OTA update solution for your Micropython projects.

Operating Principle

Senko synchronizes selected files on your microcontroller with the remote ones from the GitHub repository.

Every time .fetch() or .update() methods are called Senko compares SHA1 hashes of local files with remote ones to determine if they are the same.

If they are not, Senko saves remote files from GitHub repository to your microcontroller. This means you need to reboot to run the latest code.

You are responsible for implementing a network connection and reboot strategy!


Senko consists of a single module that you import.

You can use uPip to install Senko from PyPi:

import upip

Enter fullscreen mode Exit fullscreen mode


You should start by importing the module and creating a Senko object.

You have to specify user with your GitHub username, repo, and files that you want to keep synchronized.

import senko

OTA = senko.Senko(
  user="ocktokit", # Required
  repo="octokit-iot", # Required
  branch="master", # Optional: Defaults to "master"
  files = ["", ""]
Enter fullscreen mode Exit fullscreen mode

Check out other examples in the Senko repository!


Then after connecting to Wi-Fi network call OTA.update():

import senko
import machine
import network

OTA = senko.Senko(
   files=["", ""]

# Connect to Wi-Fi network.

if OTA.update():
    print("Updated to the latest version! Rebooting...")
Enter fullscreen mode Exit fullscreen mode

That's It!

This setup will try to keep and updated every time the microcontroller boots.

Check out my other projects at!

Top comments (0)