Coder Social home page Coder Social logo

micropython-ota's Introduction

MicroPython Over-the-Air updater

This library enables you to update your MicroPython projects over the air, at start-up, or whenever you choose.


To use this code:

  1. Add the ota.py to your MicroPython device

  2. Create a file named WIFI_CONFIG.py on your MicroPython device, which contains two variables: SSID and PASSWORD:

    SSID = "my wifi hotspot name"
    PASSWORD = "wifi password"
  3. Add this to your main program code:

    from ota import OTAUpdater
    from WIFI_CONFIG import SSID, PASSWORD
    
    firmware_url = "https://raw.githubusercontent.com/<username>/<repo_name>/<branch_name>"

    where <username> is your github username, <repo_name> is the name of the repository to check for updates and <branch_name> is the name of the branch to monitor.

  4. Add this to your main program code:

    ota_updater = OTAUpdater(SSID, PASSWORD, firmware_url, "test.py")
    ota_updater.download_and_install_update_if_available()
  5. On your GitHub repository, add a version.json file, and add a version element to the JSON file, with a version number:

    {
      "version":3
    }

The OTAUpdater will connect to github over wifi using your provided wifi credentials, check what the most up-to-date version of the firmware is, compare this to a local file present on the device named version.json, which contains the version number of the current on device firmware.

If the local file is not present it will create one with a version number of 0. If the Github version is newer, it will download the latest file and overwrite the file on the device with the same name, then restart the MicroPython board.


If you find this useful, please let me know on our discord server: https://www.kevsrobots.com/discord

micropython-ota's People

Contributors

kevinmcaleer avatar pierreyvesbaloche avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.