mirror of
https://github.com/jomjol/AI-on-the-edge-device-docs.git
synced 2025-12-07 20:16:57 +03:00
357 lines
22 KiB
HTML
357 lines
22 KiB
HTML
<!DOCTYPE html>
|
||
<html class="writer-html5" lang="en" >
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><link rel="canonical" href="https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/" />
|
||
<link rel="shortcut icon" href="../img/favicon.ico" />
|
||
<title>Installation - AI on the Edge Device</title>
|
||
<link rel="stylesheet" href="../css/theme.css" />
|
||
<link rel="stylesheet" href="../css/theme_extra.css" />
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/github.min.css" />
|
||
|
||
<script>
|
||
// Current page data
|
||
var mkdocs_page_name = "Installation";
|
||
var mkdocs_page_input_path = "Installation.md";
|
||
var mkdocs_page_url = "/AI-on-the-edge-device-docs/Installation/";
|
||
</script>
|
||
|
||
<script src="../js/jquery-3.6.0.min.js" defer></script>
|
||
<!--[if lt IE 9]>
|
||
<script src="../js/html5shiv.min.js"></script>
|
||
<![endif]-->
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js"></script>
|
||
<script>hljs.initHighlightingOnLoad();</script>
|
||
</head>
|
||
|
||
<body class="wy-body-for-nav" role="document">
|
||
|
||
<div class="wy-grid-for-nav">
|
||
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
|
||
<div class="wy-side-scroll">
|
||
<div class="wy-side-nav-search">
|
||
<a href=".." class="icon icon-home"> AI on the Edge Device
|
||
</a><div role="search">
|
||
<form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||
<input type="text" name="q" placeholder="Search docs" title="Type search term here" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||
<p class="caption"><span class="caption-text">Getting Started</span></p>
|
||
<ul class="current">
|
||
<li class="toctree-l1"><a class="reference internal" href="..">Welcome</a>
|
||
</li>
|
||
<li class="toctree-l1 current"><a class="reference internal current" href="./">Installation</a>
|
||
<ul class="current">
|
||
<li class="toctree-l2"><a class="reference internal" href="#hardware">Hardware</a>
|
||
<ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="#esp32-cam">ESP32-CAM</a>
|
||
</li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#usb-uart-interface">USB->UART interface</a>
|
||
</li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#power-supply">Power supply</a>
|
||
</li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#housing">Housing</a>
|
||
</li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#wiring">Wiring</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#firmware-flashing">Firmware flashing</a>
|
||
<ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="#files">Files</a>
|
||
</li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#flashing">Flashing</a>
|
||
<ul>
|
||
<li class="toctree-l4"><a class="reference internal" href="#1-web-installer">1. Web Installer</a>
|
||
</li>
|
||
<li class="toctree-l4"><a class="reference internal" href="#2-using-the-flash-tool-from-espressif">2. Using the Flash Tool from Espressif</a>
|
||
</li>
|
||
<li class="toctree-l4"><a class="reference internal" href="#3-using-esptool-in-python-directly">3. Using esptool in python directly</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#sd-card">SD-Card</a>
|
||
<ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="#attention">Attention</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#wlan">WLAN</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../FAQs/">Frequently Asked Questions</a>
|
||
</li>
|
||
</ul>
|
||
<p class="caption"><span class="caption-text">API's</span></p>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="../REST-API/">REST API</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../MQTT-API/">MQTT API</a>
|
||
</li>
|
||
</ul>
|
||
<p class="caption"><span class="caption-text">Links</span></p>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="" href="https://github.com/jomjol/AI-on-the-edge-device/releases">Releases</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="" href="https://jomjol.github.io/AI-on-the-edge-device/index.html">Web Installer/Console</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="" href="https://github.com/jomjol/AI-on-the-edge-device/issues">Place an Issues</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="" href="https://github.com/jomjol/AI-on-the-edge-device/discussions">Join a Discussions</a>
|
||
</li>
|
||
</ul>
|
||
<p class="caption"><span class="caption-text">Asorted Pages</span></p>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Addditional-Information/">Addditional Information</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Best-Practice/">Best Practice</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Build-Instructions/">New</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Choosing-the-Model/">Which model should I use?</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Configuration-Parameter-Details/">Configuration Parameter Details</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Configuration/">Configuration</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Correction%20Algorithm/">Correction Algorithm</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Demo-Mode/">Demo Mode</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Error-Codes/">Error Codes</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Error-Debugging/">Error Debugging</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../External-LED/">External LED</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Frequent%20Reboots/">Frequent reboots</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Gasmeter-Log-Downloader/">Gasmeter Log Downloader</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Graphical-configuration/">Graphical configuration</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Hardware-Compatibility/">Hardware Compatibility</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Install-a-rolling-%28unstable%29-release/">:bangbang: Living on the edge :bangbang:</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Integrated%20Functions/">Integrated Functions</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Integration-Home-Assistant/">Integration into Home Assistant</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Learn-models-with-your-own-images/">Learn models with your own images</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Migrate-Old-Config-To-New-Config/">Migration from water-meter „old“ to water-meter “AI-on-the-edge-device”</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Neural-Network-Types/">Neural Network Types</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../OTA---Update-Firmware-and-Web-Interface/">Over-The-Air (OTA) Update</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../ROI-Configuration/">ROI (Region of Interest) Configuration</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Release-creation/">Release creation</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Testing/">Testing</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../Watermeter-specific-analog---digital-transition/">Understanding the problem</a>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../xxx%20old%20AI-on-the-edge/">(old) Welcome to the AI-on-the-edge-device wiki!</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</nav>
|
||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||
<nav class="wy-nav-top" role="navigation" aria-label="Mobile navigation menu">
|
||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||
<a href="..">AI on the Edge Device</a>
|
||
|
||
</nav>
|
||
<div class="wy-nav-content">
|
||
<div class="rst-content"><div role="navigation" aria-label="breadcrumbs navigation">
|
||
<ul class="wy-breadcrumbs">
|
||
<li><a href=".." class="icon icon-home" alt="Docs"></a> »</li>
|
||
<li>Getting Started »</li>
|
||
<li>Installation</li>
|
||
<li class="wy-breadcrumbs-aside">
|
||
<a href="https://github.com/jomjol/AI-on-the-edge-device-docs/edit/main/doc/Installation.md" class="icon icon-github"> Edit on GitHub</a>
|
||
</li>
|
||
</ul>
|
||
<hr/>
|
||
</div>
|
||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||
<div class="section" itemprop="articleBody">
|
||
|
||
<h1 id="installation">Installation</h1>
|
||
<p>The installation requires multiple steps:
|
||
1. Get the right hardware and wire it up
|
||
1. Flash the firmware onto the ESP32
|
||
1. Write the data to the SD-Card
|
||
1. Insert the SD-Card into the ESP32 board
|
||
1. Power/restart it. </p>
|
||
<h2 id="hardware">Hardware</h2>
|
||
<h4 id="esp32-cam">ESP32-CAM</h4>
|
||
<ul>
|
||
<li>OV2640 camera module</li>
|
||
<li>SD-Card slot </li>
|
||
<li>4 MB PSRAM. </li>
|
||
</ul>
|
||
<p>It can be easily found on the typical internet stores, searching for ESP32-CAM for less than 10 EUR.</p>
|
||
<h4 id="usb-uart-interface">USB->UART interface</h4>
|
||
<p>For first time flashing the firmware a USB -> UART connector is needed. Later firmware upgrades than can be flashed via OTA.</p>
|
||
<h4 id="power-supply">Power supply</h4>
|
||
<p>For power supply a 5V source is needed. Most easily this can be done via an USB power supply. The power supply should support minimum 500mA. For buffering current peaks some users reported to use a large elco condensator like a 2200uF between ground and VCC.</p>
|
||
<p><strong>Attention:</strong> in several internet forums there are problems reported, in case the ESP32-CAM is only supplied with 3.3V.</p>
|
||
<h4 id="housing">Housing</h4>
|
||
<p>A small 3D-printable example for a very small case can be found in Thingiverse here: https://www.thingiverse.com/thing:4571627</p>
|
||
<p><img src="https://raw.githubusercontent.com/jomjol/ai-on-the-edge-device/master/images/main.jpg" width="300"><img src="https://raw.githubusercontent.com/jomjol/ai-on-the-edge-device/master/images/size.png" width="300"> </p>
|
||
<p><strong>Attention</strong>: the focus of the OV2640 needs to be adjusted, as it is normally set from ~40cm to infinity. In order to get an image that is big enough, it needs to be changed to about 10cm. Therefore the sealing glue on the objective ring needs to be removed with a scalpel or sharp knife. Afterwards the objective can be rotated clockwise until the image is sharp again.
|
||
<img src="https://raw.githubusercontent.com/jomjol/ai-on-the-edge-device/master/images/focus_adjustment.jpg" width="200"></p>
|
||
<h3 id="wiring">Wiring</h3>
|
||
<p>Beside the 5V power supply, only for the first flashing a connection to the USB-UART connector, including a short cut of GPIO0 to GND for bootloader start.</p>
|
||
<p>A example for wiring can be found here:</p>
|
||
<p><img src="https://raw.githubusercontent.com/jomjol/ai-on-the-edge-device/master/images/wiring.png" width="600">
|
||
<img alt="" src="../img/progammer_manual.jpg" /></p>
|
||
<p>It is also possible to use external LEDs for the illumination instead of the internal flash LED. This is described here: [[External-LED]]</p>
|
||
<h2 id="firmware-flashing">Firmware flashing</h2>
|
||
<h3 id="files">Files</h3>
|
||
<p>Grab the firmware from the
|
||
- <a href="https://github.com/jomjol/AI-on-the-edge-device/releases">Releases page</a> (Stable, tested versions), or the
|
||
- <a href="https://github.com/jomjol/AI-on-the-edge-device/actions?query=branch%3Arolling">Automatically build development branch</a> (experimental, untested versions). Please have a look on https://github.com/jomjol/AI-on-the-edge-device/wiki/Install-a-rolling-%28unstable%29-release first!</p>
|
||
<p>You need:
|
||
* partitions.bin
|
||
* bootloader.bin
|
||
* firmware.bin
|
||
* html.zip</p>
|
||
<h3 id="flashing">Flashing</h3>
|
||
<p>There are several options to flash the firmware. Here three are described:</p>
|
||
<h4 id="1-web-installer">1. Web Installer</h4>
|
||
<p>There is a Web Installer available which will work right out of the web browser Edge and Chrome.
|
||
You can access it with the following link: https://jomjol.github.io/AI-on-the-edge-device</p>
|
||
<p>This is the preferred way for beginners as it also allows access to the USB Log:</p>
|
||
<p><a href="https://user-images.githubusercontent.com/1783586/200926652-293e9a1c-86ec-4b79-9cef-3e6f3c47ea4b.png"><img src=https://user-images.githubusercontent.com/1783586/200926652-293e9a1c-86ec-4b79-9cef-3e6f3c47ea4b.png height=200px></a></p>
|
||
<h4 id="2-using-the-flash-tool-from-espressif">2. Using the Flash Tool from Espressif</h4>
|
||
<p>The flashing of the firmware can be done with the "Flash Download Tool" from espressif, that can found <a href="https://www.espressif.com/en/support/download/other-tools">here</a> </p>
|
||
<p>Download and extract the Flash tool, after starting choose "Developer Mode", then "ESP32-DownloadTool" and you are in the setup of the flashing tool. Connect the ESP32-CAM with the USB-UART connection and identify the COM-Port. </p>
|
||
<p><img alt="‼" class="twemoji" src="https://twemoji.maxcdn.com/v/latest/svg/203c.svg" title=":bangbang:" /> <strong>Attention</strong> <img alt="‼" class="twemoji" src="https://twemoji.maxcdn.com/v/latest/svg/203c.svg" title=":bangbang:" /> if you reflashing the code again, it is strongly recommended to erase the flash memory before flashing the firmware. Especially if you used OTA in between, which might cause remaining information on the flash, to still boot from an old image in the OTA-area, which is not erased by a normal flash.</p>
|
||
<p>But your ESP32 in bootloader mode and push start, then it will identify the board and you can configure the bin-configuration according to the following table:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Filename</th>
|
||
<th align="right">Offset</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>bootloader.bin</td>
|
||
<td align="right">0x1000</td>
|
||
</tr>
|
||
<tr>
|
||
<td>partitions.bin</td>
|
||
<td align="right">0x8000</td>
|
||
</tr>
|
||
<tr>
|
||
<td>firmware.bin</td>
|
||
<td align="right">0x10000</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p><img src="https://raw.githubusercontent.com/jomjol/ai-on-the-edge-device/master/images/Flash_Settings.png" width="400"> </p>
|
||
<p>Alternatively it can be directly flashed from the development environment - here PlatformIO. But this is rather for experienced users, as the whole development chain needs to be installed for compilation.</p>
|
||
<h4 id="3-using-esptool-in-python-directly">3. Using esptool in python directly</h4>
|
||
<p>For this you need a python environment (e.g. Anaconda in Win10).
|
||
Here you need to install the esptool:</p>
|
||
<pre><code>pip install esptool
|
||
</code></pre>
|
||
<p>Then connect the ESP32 with the USB-UART connector to the system, put it in bootmode and with the following command you can erase the flash and flash bootloader, partitions and firmware in two steps:</p>
|
||
<pre><code>esptool erase_flash
|
||
esptool write_flash 0x01000 bootloader.bin 0x08000 partitions.bin 0x10000 firmware.bin
|
||
</code></pre>
|
||
<ul>
|
||
<li>Maybe you need to specify the COM-port if it is not detected by default.</li>
|
||
<li>If the erase command throws the error <code>A fatal error occurred: ESP32 ROM does not support function erase_flash.</code>, your <code>esptool</code> might be too old, see https://techoverflow.net/2022/02/08/how-to-fix-esp32-a-fatal-error-occurred-esp32-rom-does-not-support-function-erase_flash/</li>
|
||
</ul>
|
||
<p>With some Python installations this may not work and you’ll receive an error, try <code>python -m pip install esptool</code> or <code>pip3 install esptool</code></p>
|
||
<p>Further recommendations can be found on the <a href="https://docs.espressif.com/projects/esptool/en/latest/esp32/installation.html">espressif webpage</a></p>
|
||
<h2 id="sd-card">SD-Card</h2>
|
||
<p>The program expects a SD-Card installed with certain directory and file structure in order to work properly.
|
||
For the first setup take the <code>initial_esp32_setup_*.zip</code> from the <a href="https://github.com/jomjol/AI-on-the-edge-device/releases">Release</a> page and extract the content of the contained <code>sd-card.zip</code> onto your SD-Card.</p>
|
||
<p>This must only be done once as further updates of the SD-Card are possible with the OTA Update.</p>
|
||
<h3 id="attention"><img alt="‼" class="twemoji" src="https://twemoji.maxcdn.com/v/latest/svg/203c.svg" title=":bangbang:" /> Attention <img alt="‼" class="twemoji" src="https://twemoji.maxcdn.com/v/latest/svg/203c.svg" title=":bangbang:" /></h3>
|
||
<ul>
|
||
<li>Due to the limited availability of GPIOs (OV2640, Flash-Light, PSRAM & SD-Card) the communication mode to the SD card is limited to 1-line SD-Mode. It showed up, that this results in problems with very large SD-Cards (64GB, sometimes 32 GB) and some no name low cost SD-cards.</li>
|
||
<li>There must be no partition table on the SD-card (no GPT, but only MBR for the single partition)</li>
|
||
<li>Following setting are necessary for formating the SD-card: <strong>SINGLE PARTITION, MBR, FAT32 - 32K. NOT exFAT</strong></li>
|
||
<li>Some ESP32 devices share their SD-card and/or camera GPIOs with the pins for TX and RX. If you see errors like “Failed to connect” then your chip is probably not entering the bootloader properly. Remove the respective modules temporarily to free the GPIOs for flashing. You may find more information about troubleshooting on the <a href="https://docs.espressif.com/projects/esptool/en/latest/esp8266/troubleshooting.html">homepage of Espressif</a>.</li>
|
||
</ul>
|
||
<p><strong>The ESP32 indicates problems with the SD card during startup with a fast not ending blinking.</strong>
|
||
<strong>In this case, please try another SD card.</strong> </p>
|
||
<h2 id="wlan">WLAN</h2>
|
||
<p>The access to the WLAN is configured in the "wlan.ini" directly on the root directory of the sd-card. Just write the corresponding SSID and password before the startup of the ESP32. This file is hidden from external access (e.g. via Filemanager) to protect the password.</p>
|
||
<p>After power on the connection status is indicated by 3x blinking of the red on board LED.</p>
|
||
<p>WLAN-Status indication:</p>
|
||
<ul>
|
||
<li><strong>5 x</strong> fast blinking (< 1 second): connection still pending</li>
|
||
<li><strong>3 x</strong> slow blinking (1 second on/off): WLAN connection established</li>
|
||
</ul>
|
||
<p>It is normal that at first one or two times a pending connection is indicated.</p>
|
||
|
||
</div>
|
||
</div><footer>
|
||
<div class="rst-footer-buttons" role="navigation" aria-label="Footer Navigation">
|
||
<a href=".." class="btn btn-neutral float-left" title="Welcome"><span class="icon icon-circle-arrow-left"></span> Previous</a>
|
||
<a href="../FAQs/" class="btn btn-neutral float-right" title="Frequently Asked Questions">Next <span class="icon icon-circle-arrow-right"></span></a>
|
||
</div>
|
||
|
||
<hr/>
|
||
|
||
<div role="contentinfo">
|
||
<!-- Copyright etc -->
|
||
</div>
|
||
|
||
Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||
</footer>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
</section>
|
||
|
||
</div>
|
||
|
||
<div class="rst-versions" role="note" aria-label="Versions">
|
||
<span class="rst-current-version" data-toggle="rst-current-version">
|
||
|
||
<span>
|
||
<a href="https://github.com/jomjol/AI-on-the-edge-device-docs" class="fa fa-github" style="color: #fcfcfc"> GitHub</a>
|
||
</span>
|
||
|
||
|
||
<span><a href=".." style="color: #fcfcfc">« Previous</a></span>
|
||
|
||
|
||
<span><a href="../FAQs/" style="color: #fcfcfc">Next »</a></span>
|
||
|
||
</span>
|
||
</div>
|
||
<script>var base_url = '..';</script>
|
||
<script src="../js/theme_extra.js" defer></script>
|
||
<script src="../js/theme.js" defer></script>
|
||
<script src="../search/main.js" defer></script>
|
||
<script defer>
|
||
window.onload = function () {
|
||
SphinxRtdTheme.Navigation.enable(true);
|
||
};
|
||
</script>
|
||
|
||
</body>
|
||
</html>
|