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

Overview

esp32-internet-ota

ESP32 + GitHub Actions + Husarnet.

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

Prerequisites

Install Visual Studio Code with PlatformIO extension.

Quick start

First setup

  1. Click Use this template button to create your own copy of this repo.

  2. Clone the repo you have just created and open it in Visual Studio Code. Platformio should automatically install all project dependencies.

  3. Rename credentials-template.h to credentials.h and type your WiFi an Husarnet credentials there (you will find you Husarnet Join Code at https://app.husarnet.com).

  4. Click "PlatformIO: upload" button to flash your ESP32 board connected to your laptop. You will find the following log in the serial monitor:

    **************************************
    GitHub Actions OTA example
    **************************************
    
    📻 1. Connecting to: FreeWifi Wi-Fi network .. done
    
    ⌛ 2. Waiting for Husarnet to be ready ... done
    
    🚀 HTTP server started
    
    Visit:
    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)

Internet OTA with GitHub Actions

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

    Secret Sample Value Desription
    WIFI_SSID FreeWifi just your WiFi network name
    WIFI_PASS hardtoguess ... and password
    HUSARNET_HOSTNAME my-esp32 hostname under which you want your ESP32 to be available by other peers
    HUSARNET_JOINCODE fc94:...:932a/xhfqwPxxxetyCExsSPRPn9 find your own secret Join Code at your user account at https://app/husarnet.com > choosen network > add element button. Anyone with this Join Code can connect to your Husarnet network
  2. Push changes to your repo:

    git add *
    git commit -m "triggering the workflow"
    git push
  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

Erasing flash memory of ESP32

  1. Connect ESP32 to your laptop

  2. Install platformio CLI

    pip install -U platformio
  3. Make flash erase:

    pio run --target erase

Monitoring network traffic on hnet0 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 to provide a public access to web servers hosted by Husarnet connected devices using: https://husarnet.com/blog/reverse-proxy-gui . It can be used also to provide the access to a web server hosted by ESP32 using a nice looking link like: https://my-awesome-esp32.mydomain.com.

You might also like...
Exploit allowing you to read registry hives as non-admin on Windows 10 and 11
Exploit allowing you to read registry hives as non-admin on Windows 10 and 11

HiveNightmare aka SeriousSam, or now CVE-2021–36934. Exploit allowing you to read any registry hives as non-admin. What is this? An zero day exploit f

Thread Stack Spoofing - PoC for an advanced In-Memory evasion technique allowing to better hide injected shellcode's memory allocation from scanners and analysts.
Thread Stack Spoofing - PoC for an advanced In-Memory evasion technique allowing to better hide injected shellcode's memory allocation from scanners and analysts.

Thread Stack Spoofing PoC A PoC implementation for an advanced in-memory evasion technique that spoofs Thread Call Stack. This technique allows to byp

32blit SDK boilerplate for the PicoSystem RP2040-based handheld

PicoSystem 32blit Boilerplate This is a basic template for starting 32blit projects for the Pimoroni PicoSystem. It shows a minimal code layout and as

Boilerplate-free YAML parsing for C++

AutoYAML AutoYAML is a Clang/LLVM/LibTooling-based program that automatically generates yaml-cpp conversion code for C++ record types. Usage As a moti

A set of tools allowing JUCE 6.1 + Cmake to build a CLAP

JUCE6/CMake Clap Support This is a set of code which, combined with a JUCE6/CMake project, allows you to build a (buggy, feature incomplete, work in p

std::tuple like methods for user defined types without any macro or boilerplate code

Boost.PFR This is a C++14 library for very basic reflection that gives you access to structure elements by index and provides other std::tuple like me

Beacon Object File allowing creation of Beacons in different sessions.
Beacon Object File allowing creation of Beacons in different sessions.

JumpSession_BOF This is a Beacon Object File allowing creation of Beacons in different sessions. Must be Elevated. This BOF was created on the heels o

GPU 3D signed distance field generator, written with DirectX 11 compute shader
GPU 3D signed distance field generator, written with DirectX 11 compute shader

GPU SDF Generator GPU 3D signed distance field generator, written with DirectX 11 compute shader Building git clone --recursive https://github.com/Air

Finite Field Operations on GPGPU

ff-gpu Finite Field Operations on GPGPU Background In recent times, I've been interested in Finite Field operations, so I decided to implement few fie

Comments
  • Old version of ESPAsyncWebserver

    Old version of ESPAsyncWebserver

    Hello Dominik,

    please change ESPAsync webserver lib deps to:

    ottowinter/ESPAsyncWebServer-esphome@^1.3.0

    This new version has significantly lower flash/ram consumption and maybe is more stable

    Old webserver: 92.4% FLASH / 13.7% RAM New webserver 81.9% FLASH / 12.2% RAM

    Same situation is with asyncTCP:

    esphome/AsyncTCP-esphome@^1.2.2

    But new webserver work well also with old asyncTCP with Husarnet ip v6 mods.

    opened by Sejny 2
Owner
Husarnet
Husarnet
Firmware update for XeniumOS used on Xenium and OpenXenium modchips to provide software fixes and various improvements.

Firmware update for XeniumOS used on Xenium and OpenXenium modchips to provide software fixes and various improvements. About • Features • Installatio

MakeMHz LLC 51 Dec 9, 2022
Diwali Lighting using ESP32 with OTA update support

OTA_ESP32_8x50_ws2811 Diwali Lighting using ESP32 with OTA update support! This code is meant to drive 8 neopixel chains through separate pins. Being

Anindya Mitra 1 Feb 5, 2022
Turn your ESP32 into a easy to use micro web-server allowing to interact with any GPIO by simple http(s) calls.

WebhooksTriggeredESP32WiFi Turn your ESP32 into an easy to use and manage wireless micro web-server allowing it to process reliably and asynchronouly

JayDeLux 3 Nov 24, 2022
Boilerplate to create a project with: STM32 + Ethernet + micro-ROS + FreeRTOS + Arduino + PlatformIO

micro_ros_stm32_template Boilerplate to create a project with: STM32 + Ethernet + micro-ROS + FreeRTOS + Arduino + PlatformIO Default config STM32F407

Husarion 14 Aug 29, 2022
Project in the field of Advanced Programming Techniques by prof. Brian Kernighan, inspired by real event that made Ken Thompson invent grep command

ed_to_grep Project in the field of Advanced Programming Techniques by prof. Brian Kernighan, inspired by real event that made Ken Thompson invent grep

mirko 1 Nov 1, 2022
Epitech Criterion Actions example project.

Epitech Criterion Actions Example Epitech Criterion Actions example project Original project : MaximePremont/EpitechCriterionAction Epitech Criterion

null 3 Nov 21, 2022
The c++ micro framework for building web applications based on workflow

wfrest The c++ micro framework for building web applications based on workflow ⌛️ Build Step 1 : install workflow git clne [email protected]:sogou/workfl

Shiyu Yi 539 Jan 3, 2023
Arnold-compatible implementation of Pixar's bump-to-roughness workflow

Arnold-compatible implementation of Pixar's bump-to-roughness workflow Read first https://rmanwiki.pixar.com/display/REN24/PxrBumpRoughness https://gr

Zeno Pelgrims 8 Oct 16, 2022
Binary Ninja plugin & workflow to help analyze Objective-C code

Objective Ninja Objective Ninja is a Binary Ninja plugin to assist in reverse engineering Objective-C code. Beware, Objective Ninja is still in very e

Jon Palmisciano 80 Aug 16, 2022