undefined Sets up and or Refreshes the terminals ENV
Display value associated with an enviornment variable using undefined
Users Enviornment Variables:
undefined is equivilant to undefined
undefined configured by get_idf. /home/username/esp
Get you USB Device's com port undefined
undefined
undefined
Setup
Install Prerequisites
Special ones for Linux
Fix the Permission issues fordev/ttyUSB0
Set up Python 3 as default for Ubuntu
Git clone Esp-Idf into ~/esp/esp-idf
Set up the tools
Run /install.sh to setup compilation tools required by ESP-IDF into the user home directory ($HOME/.espressif on Linux)
If you wish to install the tools into a different directory, set the environment variable IDF_TOOLS_PATH before running the installation scripts. Make sure that your user account has sufficient permissions to read and write this path.
Set Up Enviornment Variables
ESP-IDF provides another script which does that. export.sh
If you plan to use esp-idf frequently, you can create a .bashrc alias for executing export.sh
Now you can run get_idf to set up or refresh the esp-idf environment in any terminal session.
Start A Project
find an Example
undefined 6. Connect your device
undefined
Configure
Navigate to the Project Directory from Step 5
run the project configuration utility menuconfi
undefined undefined undefined
Setting the target with idf.py set-target esp32 should be done once, after opening a new project. (If the project contains some existing builds and configuration, they will be cleared and initialized)
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.
An application interfaces with ESP-MESH via ESP-MESH Events
it is also possible for the application to interface with the Wi-Fi driver via the Wi-Fi Event Task.
The mesh_event_id_t defines all possible ESP-MESH system events and can indicate events such as the connection/disconnection of parent/child.
Before ESP-MESH system events can be used, the application must register a Mesh Event Callback via esp_mesh_set_config()
The callback is used to receive events from the ESP-MESH stack as well as the LwIP Stack and should contain handlers for each event relevant to the application.
Typical use cases of system events include using events such as MESH_EVENT_PARENT_CONNECTED and MESH_EVENT_CHILD_CONNECTED to indicate when a node can begin transmitting data upstream and downstream respectively.
When using ESP-MESH under self-organized mode, users must ensure that no calls to Wi-Fi API are made. This is due to the fact that the self-organizing mode will internally make Wi-Fi API calls to connect/disconnect/scan etc. Any Wi-Fi calls from the application (including calls from callbacks and handlers of Wi-Fi events) may interfere with ESP-MESH’s self-organizing behavior. Therefore, user’s should not call Wi-Fi APIs after esp_mesh_start() is called, and before esp_mesh_stop() is called.
LwIP & ESP-MESH
The application can access the ESP-MESH stack directly without having to go through the LwIP stack.
Initialize Mesh -> esp_mesh_init())
Configure an ESP-MESH Network -> esp_mesh_set_config()
Parameter | Description
Channel | Range from 1 to 14
Event Callback | Callback for Mesh Events, see mesh_event_cb_t
Mesh ID | ID of ESP-MESH Network, see mesh_addr_t
Router | Router Configuration, see mesh_router_t
Mesh AP | Mesh AP Configuration, see mesh_ap_cfg_t
Crypto Functions | Crypto Functions for Mesh IE, see mesh_crypto_funcs_t
Start Mesh -> esp_mesh_start()
After starting ESP-MESH, the application should check for ESP-MESH events to determine when it has connected to the network.
After connecting, the application can start transmitting and receiving packets over the ESP-MESH network using esp_mesh_send() and esp_mesh_recv().
Self Organized Networking
Selection or election of the root node (see Automatic Root Node Selection in Building a Network)
Selection of a preferred parent node (see Parent Node Selection in Building a Network)
Automatic reconnection upon detecting a disconnection (see Intermediate Parent Node Failure in Managing a Network)
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:
bool enable specifies whether to enable or disable self organized networking.
bool select_parent specifies whether a new parent node should be selected when enabling self organized networking. Selecting a new parent has different effects depending the node type and the node’s current state. This parameter is unused when disabling self organized networking.
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.
If the node was previously connected to other nodes, it will remain connected.
If the node was previously disconnected and was scanning for a parent node or router, it will stop scanning.
If the node was previously attempting to reconnect to a parent node or router, it will stop reconnecting.
IDF SDK and Arduino-ESP32
CPP
https://docs.microsoft.com/en-us/cpp/cpp/header-files-cpp?view=vs-2019
ESPNow BT BLE MQTT
ESPNow
A connectionless wifi comm prot.
A kind of 802.11 Broadcast
Extends 165.5 meters
10-30ms latency 2 w 100nodes
A ESP using wifimode would last 156 days wheras w/ ESPNow made it would last 535 days
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
+1 to this Or buy a 18650 charger micro USB like this one
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/
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/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
Easy setup: ESP-MESH expands the original Wi-Fi hotspot range to the reach of the most distant node in the mesh cloud. Such a network is automatically formed, self-healing and self-organizing. It saves the efforts of laying cables. All you need to do is configure the router password.
Gateway free: The decentralized structure of ESP-MESH with the absence of a gateway precludes the overall network breakdown if one single node fails. Even if there is a single ESP-MESH device, the network still works as usual.
unicast, multicast and broadcast transmissions are supported
Large network capacity: ESP-MESH takes the form of a tree topology, so one single device can connect to 10 devices at maximum, and an entire network can have over 1,000 nodes.
Wider transmission coverage: The transmission distance between two devices is 30 m through walls, and 200 m without any obstacles in between (relevant to ESP32-DevKitC).
High transmission speed: For Wi-Fi transmission, the speed can reach up to 10 Mbps.
Simultaneously run Wi-Fi and BLE protocol stacks: ESP32 chips can run both Wi-Fi and BLE protocol stacks side by side and use ESP-MESH as the main network to transmit data, receive BLE probe beacon, send BLE broadcasts and connect BLE devices.
ESP MDF updates ESP MESH with
Transmission: the way of data transmission between devices
undefinedhttps://www.reddit.com/r/esp32/comments/ay0ln6/painlessmesh_actually_works_painless/
https://gitlab.com/painlessMesh/painlessMesh/wikis/home