ESP Standard Development Environment

MicroPython standard development environment for ESP boards

About the Project

ESP Standard Development Environment (std-env-esp) is a ready-to-use framework for ESP boards using MicroPython. It provides comprehensive connectivity management with WiFi connection support, access point configuration, FTP server functionality, BLE connectivity, and system utilities.

This project streamlines ESP development by providing a standardized environment that handles common tasks such as network connectivity, remote access, and device management.

Features

  • WiFi Connection Management: Easy connection to WiFi networks with static IP support
  • Access Point Configuration: Create and manage WiFi access points
  • WebREPL Support: Remote Python REPL via WebSocket connection
  • FTP Server: Built-in FTP server for convenient file transfers
  • BLE Connectivity: Bluetooth Low Energy UART service
  • Command Server: HTTP API for remote command execution and device control
  • System Information: Utilities to monitor ESP system information
  • CPU Frequency Control: Adjust CPU frequency for power/performance balance
  • JSON Configuration: All settings managed through a central config file

Project Structure

std-env-esp/ ├── app # Executable FTP tool for file transfer ├── _.remove # Related to FTP tool │ └── project/ ├── boot.py # Entry point that loads setup and calls main ├── config.json # Configuration file for all services ├── webrepl_cfg.py # WebREPL configuration │ ├── home/ │ ├── main.py # Main application code │ ├── setup.py # Configuration loader and setup module │ │ │ ├── connection/ # Network connectivity modules │ │ ├── access_point.py # AP management │ │ ├── connection.py # WiFi client connection │ │ │ │ │ └── ble/ # Bluetooth Low Energy modules │ │ ├── b.py # BLE service implementation │ │ ├── ble_advertising.py # BLE advertising helpers │ │ └── ble_uart_peripheral.py # BLE UART implementation │ │ │ ├── utils/ # Utility modules │ │ ├── uftpd.py # FTP server implementation │ │ └── command_server.py # HTTP API command server │ │ │ └── settings/ # System configuration modules │ ├── frequancy.py # CPU frequency management │ └── info.py # System information utilities │ └── lib/ # External libraries (binary format)

Usage Examples

WiFi Connection

from home.connection.connection import Connection # Connect to WiFi with DHCP wifi = Connection("your_ssid", "your_password") wifi.connect() # Connect with static IP wifi = Connection("your_ssid", "your_password", ip="192.168.1.100", subnet="255.255.255.0", gateway="192.168.1.1", dns="8.8.8.8") wifi.connect()

Creating an Access Point

from home.connection.access_point import AP # Create and start an access point ap = AP("ESP_AP", "password123") # Get AP information ap.get_ip() ap.get_config() ap.get_clients() ap.get_mac()

ESP-Remote: FTP Tool

An important side project, ESP-Remote, is a tool that provides file transfer to ESP devices via FTP protocol and enables remote management. This tool makes it easy to:

  • Push and fetch files to/from ESP devices
  • Prevent loading of faulty code with code validation
  • Use .ignore files to exclude specific files and directories from transfers
  • Automatically restart ESP devices after push operations
  • Clean remote files with the .remove file feature
  • Use a friendly interface and command-line tool
ESP Remote FTP Fetch Operation ESP Remote FTP Push Operation

The ESP-Remote tool can be used both as a graphical interface and a command-line tool, and is designed to work on Linux and Windows platforms. This tool significantly speeds up and simplifies your ESP development process.

Steps needed for installation:

  1. For Linux: Install dependencies with the ./scripts/install-dependencies.sh command
  2. For Windows: Install lftp using Chocolatey
  3. Install Python dependencies: pip install -r requirements.txt
  4. Optionally compile the application: ./build-app.sh or ./build-app.ps1

ESP Remote Tool

The included 'app' executable is an ESP Remote application with FTP tool for transferring files to/from your ESP. Source code for this tool is available in a separate repository.

To set up file transfer:

  1. The ESP must be running the uftpd.py server (included in this project)
  2. Make sure the ESP is connected to your network or you're connected to its access point
  3. Ensure the executable has execute permissions (chmod +x app if needed)
  4. Run ./app to start the FTP client tool

Technologies Used

Python MicroPython ESP32/ESP8266 WebREPL FTP BLE