All Projects → chrisjoyce911 → esp32FOTA

chrisjoyce911 / esp32FOTA

Licence: Unlicense license
Experiments in firmware OTA updates for ESP32 dev boards

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to esp32FOTA

ESP-StepperMotor-Server
Turn your ESP32 into a complete stepper motor control server with web UI, REST API and serial control interface
Stars: ✭ 133 (-28.11%)
Mutual labels:  esp32, esp32-arduino
ESP DoubleResetDetector
ESP_DoubleResetDetector is a library for the ESP32/ESP8266 Arduino platform to enable trigger configure mode by resetting twice.
Stars: ✭ 34 (-81.62%)
Mutual labels:  esp32, esp32-arduino
esp32-ota
ESP32 OTA based on ThingsBoard Open-source IoT Platform
Stars: ✭ 45 (-75.68%)
Mutual labels:  ota, esp32
Blynk Server
Blynk is an Internet of Things Platform aimed to simplify building mobile and web applications for the Internet of Things. Easily connect 400+ hardware models like Arduino, ESP8266, ESP32, Raspberry Pi and similar MCUs and drag-n-drop IOT mobile apps for iOS and Android in 5 minutes
Stars: ✭ 8 (-95.68%)
Mutual labels:  ota, esp32
OctoWifi-LEDs-Controller
LEDs driver for ESP32 ( support ART-NET, RGB888, RGB565, Z888 )
Stars: ✭ 16 (-91.35%)
Mutual labels:  esp32, esp32-arduino
Esp Webota
Simple web based Over-the-Air (OTA) updates for ESP based projects
Stars: ✭ 189 (+2.16%)
Mutual labels:  ota, esp32
SuperGreenOS
🧠 SuperGreenOS home farming automation software for esp32, all in one package, and controllable from your smartphone, pc, mac, linux, toaster, plumbus, whatnot...
Stars: ✭ 83 (-55.14%)
Mutual labels:  ota, esp32
Lws Esp32 Factory
Libwebsockets ESP32 Factory Application
Stars: ✭ 60 (-67.57%)
Mutual labels:  ota, esp32
ESPHome-Air-Quality-Monitor
ESPHome configuration for a DIY indoor air quality monitor for CO₂ concentration, PM2.5 and PM10 concentrations, and temperature, humidity and pressure
Stars: ✭ 42 (-77.3%)
Mutual labels:  esp32, esp32-arduino
OneWire
Library for Dallas/Maxim 1-Wire Chips
Stars: ✭ 32 (-82.7%)
Mutual labels:  esp32, esp32-arduino
Elegantota
Push OTAs to ESP8266 or ESP32 Elegantly.
Stars: ✭ 128 (-30.81%)
Mutual labels:  ota, esp32
NeoGB-Printer
An open-source and standalone Gameboy Printer emulator 100% compatible with all officially released games (110 in total) that support the accessory. Just print and save the images as BMP
Stars: ✭ 61 (-67.03%)
Mutual labels:  esp32, esp32-arduino
Ota update stm32 using esp32
Program STM32Fxx MCUs Over-the-Air using ESP32
Stars: ✭ 122 (-34.05%)
Mutual labels:  ota, esp32
fullmetalupdate
FullMetalUpdate Python client application.
Stars: ✭ 19 (-89.73%)
Mutual labels:  ota, ota-firmware-updates
Esp Request
This project is no longer supported, please use
Stars: ✭ 65 (-64.86%)
Mutual labels:  ota, esp32
ESP-Alerts-for-Android
Send Android Notifications to an ESP32 with OLED display
Stars: ✭ 42 (-77.3%)
Mutual labels:  esp32, esp32-arduino
Blynk Library
Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc.
Stars: ✭ 3,305 (+1686.49%)
Mutual labels:  ota, esp32
Esphelper
A library to make using WiFi & MQTT on the ESP8266 easy.
Stars: ✭ 310 (+67.57%)
Mutual labels:  ota, esp32
esp32-i2s-mems
Using an I2S MEMS microphone on an ESP32
Stars: ✭ 103 (-44.32%)
Mutual labels:  esp32, esp32-arduino
wifiaudio-tx-firmware
ESP32 based wifi auio transmitter firmware
Stars: ✭ 31 (-83.24%)
Mutual labels:  esp32, esp32-arduino

PlatformIO

esp32FOTA library for Arduino

Purpose

A simple library to add support for Over-The-Air (OTA) updates to your project.

Features

  • Web update (requires web server)
  • Batch firmware sync
  • Force firmware update issues 8
  • https support [#26][i26] ( Thanks to @fbambusi )
  • Signature check of downloaded firmware-image issue 65
  • https or https
  • Signature verification
  • Semantic versioning support
  • Checking for update via bin headers issue 15

How it works

This library tries to access a JSON file hosted on a webserver, and reviews it to decide if a newer firmware has been published, if so it will download it and install it.

There are a few things that need to be in place for an update to work.

  • A webserver with the firmware information in a JSON file
  • Firmware version
  • Firmware type
  • Firmware bin
  • For https or signature check: SPIFFS with root_ca.pem (https) and rsa_key.pem (signature check)

You can supply http or https URLs to the checkURL. If you are using https, you need the root_ca.pem in your SPIFFS partition. For the actual firmware it will use https when you define port 443 or 4433. Otherwise it will use plain http.

Usage

Hosted JSON

This is hosted by a webserver and contains information about the latest firmware:

{
    "type": "esp32-fota-http",
    "version": 2,
    "host": "192.168.0.100",
    "port": 80,
    "bin": "/fota/esp32-fota-http-2.bin"
}

Version information can be either a single number or a semantic version string. Alternatively, a full URL path can be provided:

{
    "type": "esp32-fota-http",
    "version": "2.5.1",
    "url": "http://192.168.0.100/fota/esp32-fota-http-2.bin"
}

A single JSON file can provide information on multiple firmware types by combining them together into an array. When this is loaded, the firmware manifest with a type matching the one passed to the esp32FOTA constructor will be selected:

[
   {
      "type":"esp32-fota-http",
      "version":"0.0.2",
      "url":"http://192.168.0.100/fota/esp32-fota-http-2.bin"
   },
   {
      "type":"esp32-other-hardware",
      "version":"0.0.3",
      "url":"http://192.168.0.100/fota/esp32-other-hardware.bin"
   }
]

Firmware types

Types are used to compare with the current loaded firmware, this is used to make sure that when loaded, the device will still do the intended job.

As an example, a device used as a data logger should ony be updated with new versions of the data logger.

examples
  • TTGO-T8-ESP32-Logger
  • TTGO-T8-ESP32-Temp
  • TTGO-T8-ESP32-Relay

Debug

Messages depends of build level. If you pass -D CORE_DEBUG_LEVEL=3 to build flags, it enable the messages

Sketch

In this example a version 1 of 'esp32-fota-http' is in use, it would be updated when using the JSON example.

#include <esp32fota.h>
#include <WiFi.h>

const char *ssid = "";
const char *password = "";

esp32FOTA esp32FOTA("esp32-fota-http", "1.0.0");

void setup()
{
  esp32FOTA.checkURL = "http://server/fota/fota.json";
  Serial.begin(115200);
  setup_wifi();
}

void setup_wifi()
{
  delay(10);
  Serial.print("Connecting to ");
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
}

void loop()
{
  bool updatedNeeded = esp32FOTA.execHTTPcheck();
  if (updatedNeeded)
  {
    esp32FOTA.execOTA();
  }
  delay(2000);
}

Verified images via signature

You can now sign your firmware image with an RSA public/private key pair and have the ESP32 check if the signature is correct before it switches over to the new image.

In order to use this feature just set the boolean validate to true in the constructor. Next create a key-pair to sign your firmware image:

openssl genrsa -out priv_key.pem 4096
openssl rsa -in priv_key.pem -pubout > rsa_key.pub

Compile your code so you get your OTA update file (e.g. firmware.bin). Now it's time to create the signature:

# Create signature file
openssl dgst -sign priv_key.pem -keyform PEM -sha256 -out firmware.sign -binary firmware.bin

# throw it all in one file
cat firmware.sign firmware.bin > firmware.img

Upload firmware.img to your OTA server and point to it in your firmware.json

Last step, create an SPIFFS partition with your rsa_key.pub in it. The OTA update should not touch this partition during the update. You'll only need to distribute this partition once.

On the next update-check the ESP32 will download the firmware.img extract the first 512 bytes with the signature and check it together with the public key against the new image. If the signature check runs OK, it'll reset into the new firmware.

Libraries

This relies on semver.c by h2non for semantic versioning support. semver.c is licensed under MIT.

Thanks to

  • @nuclearcat
  • @thinksilicon
  • @nuclearcat
  • @hpsaturn
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].