Difference between revisions of "ESP-WROOM-02 flashing and applications"

From Take-Air Wiki
Jump to navigation Jump to search
Line 1: Line 1:
The onboard ESP-WROOM-02 module can be programmed with any custom firmware to provide highly flexible 2.4GHz Wifi functionality.
+
The onboard ESP-WROOM-02 module can be programmed with any custom firmware to provide highly flexible 2.4GHz WiFi functionality.
The module can for example be used to provide a data interface to the Jetson module over wifi, or to provide a Wifi beacon that transmits flight characteristics to comply with French drone laws, see e.g. https://github.com/khancyr/droneID_FR.
+
The module can for example be used to provide a data interface to the Jetson module over wifi, or to provide a WiFi beacon that transmits flight characteristics to comply with French drone laws, see e.g. https://github.com/khancyr/droneID_FR.
  
 
== ESP firmware flashing ==
 
== ESP firmware flashing ==

Revision as of 12:18, 27 October 2021

The onboard ESP-WROOM-02 module can be programmed with any custom firmware to provide highly flexible 2.4GHz WiFi functionality. The module can for example be used to provide a data interface to the Jetson module over wifi, or to provide a WiFi beacon that transmits flight characteristics to comply with French drone laws, see e.g. https://github.com/khancyr/droneID_FR.

ESP firmware flashing

The module is connected over UART to the Jetson module. In normal operation this UART interface can be used to communicate between the Jetson and the ESP, but it is also used for flashing new firmware to the ESP. To do so, follow the instructions below.

Pre-requisite installs

Esptool is required for flashing, follow the instructions below to install it:

  1. Login to the Jetson module using ssh (or remote desktop, if it is set up)
  2. If pip is not installed on your system, install it using:
    $ sudo apt install python-pip
  3. Some extra dependencies:
    $ sudo apt install libssl-dev
  4. Install setuptools-rust:
    $ pip install setuptools-rust
  5. Install the esp toolkit:
    $ pip install esptool

A script for automatic flashing is available, download it using:

$ git clone https://github.com/TakeAirRobotics/OpenOC2_ESPFlash.git; cd OpenOC2_ESPFlash/

Other option:

  1. Login to the Jetson module using ssh (or remote desktop, if it is set up)
  2. Install pip for Python3:
    sudo apt install python3-pip
  3. Install virtualenv:
    sudo pip3 install virtualenv
  4. Download the script for automatic flashing is available, download it using:
    cd ~; git clone https://github.com/TakeAirRobotics/OpenOC2_ESPFlash.git
  5. Create a virtual environment using python3 in the project folder:
    cd OpenOC2_ESPFlash
    virtualenv -p python3 env
  6. Enable the virtual environment:
    source env/bin/activate
  7. Install esptool (https://github.com/espressif/esptool) using pip:
    pip install esptool

Demo: Flashing the ESP

  1. Locate the firmware binary to upload, or transfer it from another system using for example scp
    An example binary that toggles a GPIO pin (OpenOC2-ESPDemo.bin) is included in the repository for testing purposes. When working correctly it will broadcast a SSID named "Open.OC2".
  2. Flash the ESP, replace blink.bin with the name of your binary.
    $ sudo ./OOC2_ESPFlash.sh OpenOC2-ESPDemo.bin
  3. Follow the onscreen instructions. You will be asked to close and open jumper J9 which can be found on the Jetson side of the board, near the ESP module.
  4. When completed, the access point should appear on WiFi capable devices:

ESP WIFI.png