Skip to content

Blynk-Technologies/Blynk-MicroPython-Edgent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blynk.Edgent for MicroPython

Blynk provides custom MicroPython builds specifically designed for IoT applications. These builds offer a standard MicroPython environment, enriched with numerous fixes, improvements, and additional features such as Smartphone Apps, Web Dashboards, secure Blynk.Cloud connection, device claiming and provisioning, OTA updates, configuration storage, and more.

image

Getting Started

1. Install MicroPython + Blynk.Edgent

See instructions for ESP32 based devices

You can use ESP Launchpad to flash your device. You will need a Chrome-based browser.

  1. Plug your board into a USB port
  2. Click Connect in upper right corner and select your board
    • Recommended: click Erase Flash on the DIY tab
  3. Select Application (generic boards vs specialized builds)
  4. Select Develop Kit variant based on flash size and type
  5. Click the Flash button (if disabled, try clicking the Connect button again)
  6. Press Reset button on your board to run the MicroPython firmware

Alternatively, you can flash your ESP32 device manually

See instructions for Raspberry Pi Pico W
  1. Hold down the BOOTSEL button while plugging the board into a USB port
  2. Copy the latest UF2 firmware file to the USB mass storage device that appears
  3. Once programming of the new firmware is complete, the device will automatically reset and be ready for use

2. Connect your device to Blynk.Cloud

Warning

The automatic connection using Blynk Apps is currently in development.
For now please connect your device manually using REPL

3. Edit the default MicroPython app

The main.py is a simple asyncio-based script that defines the high level device operation. It could be as simple as this:

from blynk import edgent
from time import ticks_ms
from asyncio import sleep_ms

async def publisher_task():
    while True:
        await sleep_ms(1000)
        edgent.publish("Uptime", ticks_ms())

edgent.run_asyncio_loop([
    publisher_task()
])

There are many ways to program your device. Here, we'll guide you through the two most popular options:

Features

  • blynk.inject - BLE-assisted device claiming and provisioning
  • blynk.air - OTA updates using Blynk.Console and Blynk.Apps
  • blynk.time - Time Zone handling (including DST transitions), Sunrise/Sunset calculation
  • blynk.repl - Remote MicroPyhton REPL for Blynk Terminal
  • netmgr - Automatic network management
    • WiFi: Maintains connection to the most reliable WiFi network (up to 16 configured networks)
    • Ethernet: Supports Static IP or DHCP network configuration
    • Cellular: Provides connectivity through 2G GSM, EDGE, 3G, 4G LTE, Cat M1, or 5G networks using PPP
  • config - System-wide configuration registry
  • aiontp - A versatile asyncio-based NTP client
  • aiohttp - Asyncio-based HTTP v1.1 client with session keep-alive support
  • aiomqtt - Asyncio-based MQTT v3.1.1 client
  • aioinput - An asyncio variant of input function
  • aioprof - Asyncio profiling tool
  • logging - System-wide, preconfigured logging
  • board - A unified way to access the board peripherals
  • Factory reset function
  • Support for TLS certificate bundles
  • For ESP32:
    • coredump - Collect crash reports remotely
    • OTA updates for MicroPython system firmware

Further reading