Home Lights ) Esp32 Platformio ... Boarddesign Esp32 Everything Esp32 Midi Usb Notes Plan Aboutlights Esp Notes Upload Wled

Don't Look! I'm changing!

URL Copied

Display value associated with an enviornment variable using undefined

Users Enviornment Variables:

Get you USB Device's com port undefined

undefined

undefined

Setup

  1. Install Prerequisites

  1. Git clone Esp-Idf into ~/esp/esp-idf

  2. Set up the tools

  1. Set Up Enviornment Variables

  1. Start A Project

undefined 6. Connect your device

  1. Configure

ESP ToolChain

Required for both IDF and MDF

Tutorial: https://docs.espressif.com/projects/esp-idf/en/latest/get-started-cmake/linux-setup.html

Install Prerequeisites :

undefined

Download the Toolchain

ESP32 toolchain for Linux is available for download from Espressif website:

https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz

Click the link above or run the Curl command below to download.

Then extract it in ~/esp directory.

** undefined **

Update your PATH env

The toolchain will be extracted into ~/esp/xtensa-esp32-elf/ directory.

To use it, you will need to update your PATH environment variable in ~/.profile file. To make xtensa-esp32-elf available for all terminal sessions, add the following line to your ~/.profile file:

undefined

Alternatively, you may create an alias for the above command. This way you can get the toolchain only when you need it. Then when you need the toolchain you can type get_esp32 on the command line and the toolchain will be added to your PATH.

To do this, add different line to your ~/.profile file:

** undefined**

*note: If you have /bin/bash set as login shell, and both .bash_profile and .profile exist, then update .bash_profile instead.

Log off and log in back to make the .profile changes effective.

Instead of /home/user-name there should be a home path specific to your installation.

Run the following command to verify if PATH is correctly set:

Permission issues /dev/ttyUSB0

With some Linux distributions you may get the Failed to open port /dev/ttyUSB0 error message when flashing the ESP32. This can be solved by adding the current user to the dialout group.

Adding users to a dialout group: https://docs.espressif.com/projects/esp-idf/en/latest/get-started-cmake/establish-serial-connection.html#linux-dialout-group-cmake

Espressif IoT Development Framework (ESP-IDF)

https://docs.espressif.com/projects/esp-idf/en/latest/

ESP MESH

https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/network/esp_mesh.html

https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/mesh.html

ESP NOW

https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/network/esp_now.html

Wifi Network Protocol

Add Paired Device Before sending data to other device, call esp_now_add_peer() to add it to the paired device list first. The maximum number of paired devices is twenty.

ESP Mesh Development Framework (ESP-MDF)

https://docs.espressif.com/projects/esp-mdf/en/latest/?badge=latest

https://github.com/espressif/esp-mdf#espressif-mesh-development-framework

Sitting on top of the Espressif IoT Development Framework (ESP-IDF), the official development framework for the chip, this new framework is a way to develop mesh networking solutions using the ESP32 chip.

Mwifi API

https://docs.espressif.com/projects/esp-mdf/en/latest/api-reference/mwifi/index.html

Mwifi (Wi-Fi Mesh) is the encapsulation of ESP-MESH APIs, and it adds to ESP-MESH the retransmission filter, data compression, fragmented transmission, and P2P multicast features.

API's

Utils - MCommon (eventloop, errorcheck)

Utils - Transmission - Mwifi

Utils - Transmission - Mespnow

Components - Mconfig (mconfig-blufi, mconfig-chain)

Components - Mupgrade (OTA, factory)

Components - Mlink (HTP Server, Association)

Third Party

Configuration Options

Applications developers can use make menuconfig build target to edit components’ configuration.

This configuration is saved inside sdkconfig file in the project root directory.

Based on sdkconfig, application build targets will generate sdkconfig.h file in the build directory, and will make sdkconfig options available to component makefiles.

LwIP & ESP-MESH

Initialize Mesh -> esp_mesh_init())

Configure an ESP-MESH Network -> esp_mesh_set_config()

Start Mesh -> esp_mesh_start()

Self Organized Networking

Self organized networking can be enabled or disabled by the application at runtime by calling the esp_mesh_set_self_organized() function. The function has the two following parameters:

esp_mesh_set_self_organized(false, false);

ESP-MESH will attempt to maintain the node’s current Wi-Fi state when disabling self organized networking.

IDF SDK and Arduino-ESP32

link

image.png

image.png

image.png

CPP

https://docs.microsoft.com/en-us/cpp/cpp/header-files-cpp?view=vs-2019

ESPNow BT BLE MQTT

ESPNow

Broadcast, MultiCast, Unicast

Wifi Dataframe: MacHeader| Frame| CheckSum (TCP, saveAddr, DestAddr, OPS) (Payload, Binary, HTTP, Json)

SecretSharing, Cointoss, Threshold Signatrues

esp-iot-solution

https://github.com/espressif/esp-iot-solution

Provides a range of solutions, functions and drivers intended for IOT applications. Review these solutions, functions and drivers, if this is what you may need in your projects.

Same with esp-adf, that is focused on using ESP32 for audio applications, or esp-mdf, that provides application examples using mesh networking.

All these repositories use esp-idf as a submodule. If none of your projects fall into the above categories, then get plain esp-idf.

BT

Specification:

• 34 × programmable GPIOs • 34 × programmable GPIOs • 12-bit SAR ADC up to 18 channels • 2 × 8-bit DAC • 10 × touch sensors • 4 × SPI • 2 × I²S • 2 × I²C • 3 × UART • 1 host (SD/eMMC/SDIO) • 1 slave (SDIO/SPI) • Ethernet MAC interface with dedicated DMA and IEEE 1588 support • CAN 2.0 • IR (TX/RX) • Motor PWM • LED PWM up to 16 channels • Hall sensor

• 4 × virtual Wi-Fi interfaces • Simultaneous Infrastructure BSS Station mode/SoftAP mode/Promiscuous mode • Automatic beacon monitoring (hardware TSF) • Multi-connections in Classic BT and BLE • Simultaneous advertising and scanning ESP32’s internal memory includes: • 448 KB of ROM for booting and core functions • 520 KB of on-chip SRAM for data and instructions • 16 KB SRAM in RTC ---> • 8 KB of SRAM in RTC, which is called RTC FAST Memory and can be used for data storage; it is accessed by the main CPU during RTC Boot from the Deep-sleep mode. • 8 KB of SRAM in RTC, which is called RTC SLOW Memory and can be accessed by the co-processor during the Deep-sleep mode. • The operating voltage of ESP32 ranges from 2.3 V to 3.6 V. When using a single-power supply, the recommended voltage of the power supply is 3.3 V, and its recommended output current is 500 mA or more. 3.1.1 CPU ESP32 contains one or two low-power Xtensa® 32-bit LX6 microprocessor(s) with: • clock frequency of up to 40 MHz The single-/dual-CPU interfaces include: • Xtensa RAM/ROM Interface for instructions and data • Xtensa Local Memory Interface for fast peripheral register access • QSPI supports multiple flash/SRAM chips • Internal 8 MHz oscillator with calibration • External 2 MHz ~ 60 MHz crystal oscillator (40 MHz only for Wi-Fi/BT functionality) • External 32 kHz crystal oscillator for RTC with calibration Two 8-bit DAC channels can be used to convert two digital signals into two analog voltage signal outputs Capacitive-sensing signal name Pin name T0 GPIO4 T1 GPIO0 T2 GPIO2 T3 MTDO T4 MTCK T5 MTD1 T6 MTMS T7 GPIO27 T8 32K_XN T9 32K_XP 4.1.10 Universal Asynchronous Receiver Transmitter (UART) 4.1.11 I²C Interface

Variables) • WIFI_USERNAME • WIFI_PASSWORD • NODE_OWNER • BLE_NAME 2.4ghz rf tx/rx • PURPOSE?

Support in Google and Firefox. Google has 10MB limit before storage permissions average processing power of average computers

A million seconds is a bit less than 2 weeks. A billion seconds is a bit more than 30 years. A trillion seconds is a bit more than 30,000 years.

https://www.amazon.com/s?k=esp32+burn&qid=1550083473&ref=sr_pg_1

painlessMesh: No OTA. ESP8266MQTTMesh: Needs a mqtt broker. Using an arduino as broker limits the number of working nodes.

https://www.arduino.cc/en/Guide/Libraries https://adafruit.github.io/arduino-board-index/package_adafruit_index.json https://dl.espressif.com/dl/package_esp32_index.json

https://www.bouvet.no/bouvet-deler/machine-learning-with-esp32?fbclid=IwAR1aBlck9-y18roplJJV-Cdx3jvOMsCVI-1mGPihUuTFiITgKukKLmKn3a8 https://www.amazon.com/Areyourshop-System-Fixture-ESP-WROOM-32-Module/dp/B07434F387

{ "version":0.1, "file":"https://balbala.galla.https_ota/https_ota_v2.bin" }

https://www.youtube.com/watch?v=qE0UimODxNg

check if you can connect to the internet -if you can -> check for updated version -> update -> restart broadcast bluetooth

Search and subscribe to up to 4 ESP32 wifi AP's

Beacon frame is one of the management frames in IEEE 802.11 based WLANs. It contains all the information about the network. Beacon frames are transmitted periodically, they serve to announce the presence of a wireless LAN and to synchronise the members of the service set. Beacon frames are transmitted by the access point (AP)

multi mesh MeshName = esp_

every node has to be connected with once via bluetooth. once connected the node the Users Name. A Node can only have one Users Name registered. The Node can also be given group names of mesh networks it should connect with.

the complication im having is that the desirable mesh network plays no reliance on any one node what im doing here though is forcing communication to relay from the broker.

only the root node broadcasts messages. any leaf node directs single messages back to the root(s). It doesn't matter how the topology is configured. nodes can have multiple meshes (like one to respond to the owner, one to an external source) In such an event. the mesh messages from the external source gets directed to the internal root node. the root node may then send a direct message back to the leaf who will then send a directed message to the other root from the external source. end transaction.

receivedCallback( uint32_t from, String &msg ) :setNewConnectionCallback( &newConnectionCallback ) This fires every time the local node makes a new connection ###bool easyMesh::sendBroadcast('msg') ###bool easyMesh::sendSingle('id','msg') ###connectionCount() ::getChipId( void ) getNodeTime( void )

esp32 connects to via bluetooth to your phone esp32 creates access point with its name & password the same. starting w 'ESP32' Figure out if thats sufficient... Anyone who can connect to your wifi may subscribe for the AP's publishings ... Only the Access Points struggle to communicate with eachother... .. They can communicate with eachther using the mesh network ... ... but take orders from bluetooth or mqtt. esp32 Mesh

first node will look for other nodes on the mesh if no mesh exists meeting the nodes specific requirements -- The node will Broadcast BT -- The node will Create its own Mesh using Defaults removing a node from the mesh will respond -> indicating to the user

Every node in ESP-MESH that is able to form downstream connections (i.e. has a softAP interface) will periodically transmit Wi-Fi beacon frames A node uses beacon frames to allow other nodes to detect its presence and know of its status. Idle nodes will listen for beacon frames to generate a list of potential parent nodes, one of which the idle node will form an upstream connection with.

The routing table of a particular node will consist of the MAC addresses of all nodes within the particular node’s subnetwork (including the MAC address of the particular node itself). Each routing table is internally partitioned into multiple subtables with each subtable corresponding to the subnetwork of each child node.

How do users pair with eachother? Nodes scan for other APs -- inform the root node who informs the owner -- nodes can multi 'mesh' and merge information across networks

platformio run -target upload

https://github.com/WebBluetoothCG/web-bluetooth/blob/master/implementation-status.md

https://www.reddit.com/r/esp32/comments/f102z9/loosing_my_mind_over_powering_the_esp32_from/

https://randomnerdtutorials.com/power-esp32-esp8266-solar-panels-battery-level-monitoring/

Maybe this helps. Keep in mind using an LDO with 400-500ma throughput depending on how much you gonna want to stress the ESP32.

Also Andreas Spiess on Youtube has a useful video on regulating voltage and batteries for microcontrollers

https://www.youtube.com/watch?v=heD1zw3bMhw&feature=youtu.be https://www.youtube.com/watch?v=ffLU7PSuI5k&feature=youtu.be

On-board battery management and automatic fall-over if the external power source dies. Takes an 18650 battery that will recharge whenever the power is plugged in and power the unit when it's not.

tp4056 is what you're looking for

make sure you use the one with separate inputs/battery/output connectors though, the cheapest models don't have this distinction

https://www.ebay.com/i/401377749606?chn=ps&norover=1&mkevt=1&mkrid=711-117182-37290-0&mkcid=2&itemid=401377749606&targetid=856845407982&device=c&mktype=pla&googleloc=9003236&poi=&campaignid=2086170139&mkgroupid=89753975715&rlsatarget=pla-856845407982&abcId=1141016&merchantid=101644847&gclid=CjwKCAiA1fnxBRBBEiwAVUouUlqpeNCBhFDfWXSLeo8b72gpOkWC9ht5utjUsw9utuWPZSrrAORkyhoCNhAQAvD_BwE

+1 to this Or buy a 18650 charger micro USB like this one

https://m.banggood.com/ESP32S-ESP32-0_5A-Micro-USB-Charger-Board-18650-Battery-Charging-Shield-without-Battery-p-1395271.html?rmmds=search

Get a 3.7V LITHIUM battery. Lithium is key since they maintain their peak voltage for longer. Regular batteries drop out too quickly and you wont get as much use out of them. 3.7 V Lithium battery because it handles the power drain better than a 18650 and hope that the devkit handles the full voltage spectrum like others here experienced. Charge it from a charge module thats powered by the 5V out from the ESP32 devkit. That way it charges everytime USB is connected and I dont need a seperate USB connection.

The ESP32 doesn't have a "USB plug" so you're probably talking about one of the dev boards with it's own regulator, FTDI and other stuff, all of which could drain a lot of power in a battery-based situation. If you tell us which board you're using than someone might be able to say "No this will never work on low power because of the parts already involved" or suggest something more appropriate.

The ESP32 is power hungry so any battery powered application requires that it be turned off for as much time as possible. When the ESP does need power, avoid power-wasting linear regulators and use a buck/boost converter. For example, you could use an 18650 LiOn or LiPo battery with a buck/boost converter that takes any voltage from 1-6v and outputs 3.3v to the ESP32.

https://jiahuang.github.io/2016/10/01/designing-a-esp32-board/

https://www.tindie.com/products/ddebeer/esp32-dev-board-wifibluetooth/

http://esp32.net/

https://www.espressif.com/sites/default/files/documentation/esp32_hardware_design_guidelines_en.pdf

https://easyeda.com/charleskarpati

https://github.com/espressif/arduino-esp32/tree/master/libraries

https://randomnerdtutorials.com/esp32-flash-memory/

https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/storage/nvs_flash.html

BT BLE Guide

https://desire.giesecke.tk/index.php/2018/02/27/esp32-bluetooth-serial-and-ble-server-running-together/

https://desire.giesecke.tk/index.php/2018/04/06/esp32-wifi-setup-over-ble/

https://desire.giesecke.tk/index.php/2018/04/10/esp32-wifi-setup-over-bluetooth-serial/

MQTT

https://learn.adafruit.com/alltheiot-protocols/mqtt

MQTT (Message Queue Telemetry Transport) has become the most popular and essentially the second standard IoT protocol (besides HTTP+REST).

Note that even though it is called M.Q.T.Transport, we’ll be referring to it as IoT protocol since it does session management.

One confusing thing about the name, it does not really queue messages (it’s more of a store-retrieve model). This is why you may see it called MQ Telemetry Transport.

""" MQTT stands for MQ Telemetry Transport. It is a publish/subscribe, extremely simple and lightweight messaging protocol, designed for constrained devices and low-bandwidth, high-latency or unreliable networks. The design principles are to minimise network bandwidth and device resource requirements whilst also attempting to ensure reliability and some degree of assurance of delivery. These principles also turn out to make the protocol ideal of the emerging “machine-to-machine” (M2M) or “Internet of Things” world of connected devices, and for mobile applications where bandwidth and battery power are at a premium.

MQTT was invented by Dr Andy Stanford-Clark of IBM, and Arlen Nipper of Arcom (now Eurotech), in 1999. """

MQTT was developed at IBM in the late 1990s, it was used to link oil pipeline sensors with satellites. The oil pipeline sensors and controls were not high speed, did not require a lot of data and were not near infrastructure.

The up/downlink used satellites that would move in and out of range, so HTTP would have been a very bad protocol to use because it requires a durable underlying transport.

Instead, the network needed something more flexible and understanding of failures and dropouts. One interesting piece of MQTT is that the protocol manages messages asynchronously. That is: the server/broker in an MQTT network can hold and forward messages from client to client so if one gets disconnected, it will be able to fetch the message when it reconnects later.

The packet structure uses binary as much as possible for compactness. Compare this to HTTP and REST where data is encoded in unicode or ASCII.

**overall, connecting to a server only takes about 80 bytes (certainly less than 1KB) **

Every data 'publication' (push data from client to broker) and data 'subscription' (push data from broker to clients) is as little as 20 bytes.

Publication to subscription delay - the time it takes from when one client publishes data, to when that data is made available to subscriber clients, is instant.

The connection is single ‘socket’ so overhead is at a minimum. This makes connections and data super fast, Facebook uses it for the billions of people who use messenger on mobile

The single-socket state-full connection does have a tradeoff in that, while not a lot of data is transmitted, it does have to hold that socket connection open. On the other hand, connections are so light and fast, maybe your publication application is OK with connecting every time needs to send data. There's flexibility for you to experiment with!

Don't Forget Your Gateway!

** While MQTT can run on top of any kind of transport, whether it be a mesh network, TCP/IP, Bluetooth, etc. If you are using Bluetooth, XBee, Bluetooth LE, or another non-Internet-connected protocol & device, you will need a gateway to get data to and from the Internet. **

ESP-MESH Highlights

ESP MDF updates ESP MESH with

Transmission: the way of data transmission between devices

undefined

https://www.reddit.com/r/esp32/comments/ay0ln6/painlessmesh_actually_works_painless/

https://gitlab.com/painlessMesh/painlessMesh/wikis/home

https://www.esp32.com/viewtopic.php?t=3597

https://gitlab.com/painlessMesh/painlessMesh