Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ESP32 + GitHub Actions + Husarnet. A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

License

NotificationsYou must be signed in to change notification settings

husarnet/esp32-internet-ota

Repository files navigation


esp32-internet-ota

ESP32 + GitHub Actions + Husarnet.

A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

Prerequisites

Install platformio CLI:

pip3 install -U platformio

If you are working inVisual Studio Code thePlatformIO extension will be helpful.

Quick start

First setup

  1. ClickUse this template button to create your own copy of this repo. Clone the repo, and open it:

    git clone https://github.com/husarnet/esp32-internet-otacd esp32-internet-ota/
  2. Erase the ESP32 flash

    pio run --target erase# or# esptool.py erase_flash
  3. Prepare the.env file:

    cp .env.template .env

    And edit its content:

    export WIFI_SSID="<place-your-wifi-ssid-here>"export WIFI_PASS="<place-a-password-to-your-wifi-here>"export HUSARNET_JOINCODE="<place-your-husarnet-joincode-here"

Tip

If your SSID or WLAN Password contains special characters (ex.$ & ( ) ? ; : , . < > | `) you need to escape them like this::

If WiFi password is$&()? then:

export WIFI_PASS="\$\&\(\)\?"

Some special characters (ex.' " \) can't be escaped.We recommend to not use special characters and emojis in WiFi SSID/Password.

  1. The first time you need to upload the firmware over the USB cable:

    source .envpio run -e serial_upload --target upload
  2. Open the Platformio Device Monitor:

    pio device monitor

    If you will open a serial monitor you will see the similar output (the first time you may wait up to 2 minutes):

    **************************************GitHub Actions OTA example**************************************📻 1. Connecting to: FreeWifi Wi-Fi network ..done⌛ 2. Waitingfor Husarnet to be ready ...done🚀 HTTP server startedVisit:http://my-esp32:8080/Known hosts:my-laptop (fc94:a4c1:1f22:ab3b:b04a:1a3b:ba15:84bc)my-esp32 (fc94:f632:c8d9:d2a6:ad18:ed16:ed7e:9f3f)
  3. Visithttp://my-esp32:8080/ from your laptop (that should be in the same Husarnet group) and if the website is avaialble you can test OTA upgrade from the level of your laptop:

    source .envpio run -e ota_upload --target upload
  4. If it works you can configure your GitHub repository.

Editing in Visual Studio Code with a PlatformIO extenstion

Source environment variables from.env file before opening VS Code.

cd esp32-internet-ota/source .envcode.

Internet OTA with GitHub Actions

warning!

Before launching an Internet OTA, you need to upload theinitial firmware at first to make your board accessible over the Husarnet VPN.

  1. Create the folowing GitHub repository secrets (Settings >Secrets >New repository secret):

    SecretSample ValueDesription
    WIFI_SSIDFreeWifijust your WiFi network name
    WIFI_PASShardtoguess... and password
    HUSARNET_JOINCODEfc94:...:932a/xhfqwPxxxetyCExsSPRPn9find your ownsecret Join Code at your user account athttps://app/husarnet.com >choosen network >add element button. Anyone with this Join Code can connect to your Husarnet network
    HUSARNET_DASHBOARD_LOGINme@acme.comA login for your account athttps://app.husarnet.com (needed byHusarnet Action)
    HUSARNET_DASHBOARD_PASSWORDhardtoguessA password for your account athttps://app.husarnet.com (needed byHusarnet Action)
  2. Push changes to your repo:

    git add*git commit -m"triggering the workflow"git push

    And trigger the workflow manually (workflow_dispatch) in your GitHub repository.

  3. In ~3 minutes the GitHub workflow should finish its job. Visit:http://my-esp32:8080 URL with a sample "Hello world" website hosted by your ESP32.

    Of course your laptop need to be connected to the same Husarnet network - you will find quick start guide showing how to do it here:https://husarnet.com/docs/

Tips

Monitoring network traffic onhnet0 interface

sudo tcpflow -p -c -i hnet0

Accesing a webserver hosted by ESP32 using a public domain

Here is a blog post showing how to configure Nginx Proxy Manager toprovide a public access to web servers hosted by Husarnet connected devices:https://husarnet.com/blog/reverse-proxy-gui

It can be also used o provide the access to a web server hosted by ESP32 using a nice looking link like:https://my-awesome-esp32.mydomain.com.

About

ESP32 + GitHub Actions + Husarnet. A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

Topics

Resources

License

Stars

Watchers

Forks

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp