Skip to main content

Implementation of OTA for remote monitoring and controlling of IoT devices

Project description

OTAUpdateManager

Implementation of OTA for remote monitoring and control of IoT devices

micropython

ESP8266

ESP32 ESP32 ESP32

Contents

How It Works

User Connection:

  • Manually enter the network name (SSID) and password.

MQTT Connection:

  • The ESP can connect to an MQTT server to check for updates and maintain a live connection.

  • This connection allows for monitoring the live online state and managing updates.

  • Use the web application to check the live online state.

  • Upload new code to the ESP board through the update section.

How It Looks

ESP8266/ESP32 modules OTA update and monitoring using website. Homepage user dashboard program editor

Quick Start

Installing

Installing with mip

Py-file

import mip
mip.install('github:raghulrajg/MicroPython-OTAUpdateManager/OTAUpdateManager.py')

To install using mpremote

    mpremote mip install github:raghulrajg/MicroPython-OTAUpdateManager

To install directly using a WIFI capable board

    mip.install("github:raghulrajg/MicroPython-OTAUpdateManager")

Installing Library Examples

If you want to install library examples:

    mpremote mip install github:raghulrajg/MicroPython-OTAUpdateManager/examples.json

To install directly using a WIFI capable board

    mip.install("github:raghulrajg/MicroPython-OTAUpdateManager/examples.json")

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI <https://pypi.org/project/MicroPython-OTAUpdateManager/>_. To install for current user:

    pip3 install MicroPython-OTAUpdateManager

To install system-wide (this may be required in some cases):

sudo pip3 install MicroPython-OTAUpdateManager

To install in a virtual environment in your current project:

    mkdir project-name && cd project-name
    python3 -m venv .venv
    source .env/bin/activate
    pip3 install MicroPython-OTAUpdateManager

Also see examples.

Using

This library provides a OTA update 1. handling code updates during boot (OTAUpdateManager)

Put the file name is called main.py

import OTAUpdateManager

#Avoid the GPIO pin number 2 because of predefine pin
#create your User ID and Token in https://ota.serveo.net/

#server connection config
User = b"YOUR_USER_ID"
Token = b"YOUR_TOKEN"

#WiFI Network connection config
SSID = "YOUR_APN_NAME"
Password = "YOUR_APN_PASSWORD"

OTAUpdate = OTAUpdateManager.espFOTA(User, Token, SSID, Password)

def loop():
    while True:
        #Put your code here
        OTAUpdate.run()

if __name__ == '__main__':
    loop()

Here's the provided main.py file, which includes configuration details for connecting to a Wi-Fi network and checking for OTA (Over-the-Air) updates using a user ID and token. You need to fill in your actual Wi-Fi credentials, user ID, and token.

Documentation

Server connection configuration

Connecting to the Web Application:

Token Configuration:

  • In the Token section, a default token is created.
  • Copy the UserID and Token from this section.

Example Code Integration:

  • Paste the UserID and Token into your example code.
  • Set your connection method to either manual WiFi or APN.

Upload Program:

  • Upload the program to the ESP.
  • The ESP will connect to the MQTT server and send packets to keep the connection alive.

OTA Update Process

Update Detection:

  • The server will notify the ESP when an update is available.
  • The ESP receives a payload to prepare for the update.

Update Execution:

  • Once the update process is initiated, the ESP will start updating.
  • The update status can be monitored on the website in the status section.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

micropython-OTAUpdateManager-1.0.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file micropython-OTAUpdateManager-1.0.0.tar.gz.

File metadata

File hashes

Hashes for micropython-OTAUpdateManager-1.0.0.tar.gz
Algorithm Hash digest
SHA256 43c232b5bb51ceb3bc297f129b7e11aa3c31b7f7854ee97e380c8673b0b64734
MD5 97e4f879bced6fdec81a2271e4841e88
BLAKE2b-256 50b11e385fcdb26e29ca065b406cc22d4183958ec3c435b725a78388f15ec017

See more details on using hashes here.

File details

Details for the file micropython_OTAUpdateManager-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for micropython_OTAUpdateManager-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ac8728a4e197ec5edc82b471c38124f08e4755ff812353bcdb513152a7f55f0
MD5 4803c00c6c3b1aae955c267a19fa84f0
BLAKE2b-256 2754f75b0fd06a0b75d30a0a94ecd1a54912d9d7320e501507dfa356313725f6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page