今日已更新 84 条资讯 | 累计 37333 条内容
关于我们

标签:#esp32

找到 10 篇相关文章

AI 资讯

Beyond Arduino: Getting Started with ESP-IDF in VS Code for ESP32

Note: This tutorial was originally published on effessdev.github.io . Check out the original article for the most up-to-date version: https://effessdev.github.io/posts/2026-07-27/ This is a step-by-step tutorial that explains how you can set up your development environment for working with ESP-IDF projects in VS Code . Install ESP-IDF Install EIM Espressif Systems provides a graphical tool called EIM (ESP-IDF Installation Manager) to install ESP-IDF. Click the link below to go to the official page to download EIM: https://dl.espressif.com/dl/eim/ Make sure you are in the "Online Installer" tab. The exact file to download depends on your system: Windows: Download eim-gui-windows-x64.exe . Run this installer to install EIM. Linux x64 (Ubuntu): Download and install the .deb package ( eim-gui-linux-x64.deb ). Install ESP-IDF using EIM Now that we have installed EIM, let's install ESP-IDF using it. Open EIM. Under "New Installation" click "Start Installation". Under "Easy Installation", click "Start Easy Installation" to install the latest stable version of ESP-IDF with default settings. If there are no problems, you will see the "Ready to Install" page. Click "Start Installation". Install ESP-IDF VS Code Extension We use this extension as a high-level wrapper for ESP-IDF. Most times, we do not use ESP-IDF directly. For example, if we need to compile our source code, we ask the extension to do it, which uses the ESP-IDF we just installed internally to to compile the source code. Install the extension named "ESP-IDF" by "Espressif Systems" in VS Code. Verify installation After installing, restart VS Code. Use the shortcut Ctrl + Shift + P to open the command palette (remember this shortcut, we are going to use it a lot). Inside the command palette, search ESP-IDF . You will see many entries which start with ESP-IDF: . Those commands are provided my the ESP-IDF extension. These commands are what we use for almost everything. Note If you are not in an ESP-IDF project, you m

2026-08-29 原文 →
AI 资讯

ESP32 Energy Metering with HLW8032, BL0942, and ESPHome

ESP32 Energy Metering with HLW8032, BL0942, and ESPHome ESP32 energy metering with HLW8032, BL0942, and ESPHome is not just about reading voltage, current, power, and energy. This article explains how to design the UART boundary, reporting cadence, calibration, entity model, and diagnostics as one stable data path. Many ESP32 energy metering projects start well. You connect an HLW8032 or BL0942 module, enable the matching ESPHome component, and Home Assistant quickly shows voltage, current, power, and energy. But reading values is not the same as building an energy metering node that can run reliably over time. The core conclusion is this: the hard part of ESP32 energy metering is not whether HLW8032 or BL0942 can be read. The hard part is designing the metering chip, UART, Wi-Fi behavior, ESPHome entities, calibration, and diagnostics as one stable data path. If the project focuses only on sensor YAML, it can later fail on transient loads, serial conflicts, unstable sampling, Wi-Fi reconnects, Home Assistant database growth, and calibration drift. In this article, an ESP32 energy metering node means an edge device where ESP32 reads voltage, current, power, and energy from a metering chip such as HLW8032 or BL0942, then exposes those values through ESPHome to Home Assistant or another upper-layer platform. It is suitable for device energy monitoring, trend observation, and low-risk operational diagnostics. It should not be treated as a billing-grade meter or an electrical protection device. If the goal is to monitor the energy behavior of one appliance, one small circuit, or one commercial device inside Home Assistant, ESP32 + ESPHome + HLW8032/BL0942 is a fast and low-cost path. If the goal is billing, electrical protection, high-accuracy compliance measurement, or safety interlocking, use certified meters, protection devices, or industrial acquisition hardware instead of stretching an ESPHome node beyond its boundary. 1. Why energy metering is more fragile than or

2026-08-27 原文 →
开发者

ESP32 + Python: From Microcontroller to IoT

ESP32 + Python: From Microcontroller to IoT Artcal 0: Introduction When it comes to transferring data from one place to another, things can sometimes become tricky, especially when communication happens between the hardware and software levels. In this article series, I would love to share the experience and knowledge I’ve gathered while working with ESP32 and Python. We’ll explore how these two technologies can work together, starting from the basics and gradually moving towards more interesting and practical projects. If you have any questions, suggestions, or ideas along the way, feel free to share them in the comments section below. I’d love to hear from you and discuss them with the community. So, without further ado, let’s begin! 🚀 What is ESP32? Think about Esp32 as a microcontroller with Internet facilities, consisting WiFi, Bluetooth and a own wireless data transfer protocol called ESP-NOW between ESP32 chips. Nowdays, the developers have made development boards integrading these chips for the easy use. ESP32 is a family of microcontrollers developed by Espresiff. This can read sensor inputs, process data, contol devices and specially connect to the internet. This is like Arduino but better, faster and smaller. With these information that we have, we can speak about this board as, "A powerful microcontroller that can interact with electronic components and communicate with other devices through Wi-Fi, Bluetooth, and other communication methods." Python??? We use different languages to tell the same thing but in different ways. We use programming languages to tell the computer the same thing but in different approches. Some languages can be hard to learn and some are easy. Some are well developed and some are not. Python programming language was created back in 1980s by Guido Van Rossum, with the development begining around 1989. It was publicly released in Feb, 1991. 🐍 1989 — Guido van Rossum developing Python. 🐍 1991 — The first public release. 🐍 2000 — Py

2026-08-24 原文 →
AI 资讯

LighthouseReckoning: A Lightweight LoRa Mesh Network for Arduino, ESP32 and RP2040

LighthouseReckoning LighthouseReckoning is a lightweight LoRa mesh networking library for Arduino-compatible microcontrollers, currently tested on ESP32 and RP2040 with SX126x LoRa radios. What is LighthouseReckoning? The goal is simple: Sensor → Relay → Relay → Home One node acts as the Home node . Other nodes automatically determine a path toward it. A node does not need to know the entire network topology. Instead, nodes exchange information about their distance to Home and select a suitable neighboring node as their next hop. For example: Sensor | v Sensor → Relay → Relay → Home ^ | Sensor This allows nodes to communicate over multiple hops without manually configuring routes. How does routing work? Each node keeps track of information about its neighbors and their distance to Home. For example: Node Distance Home 0 hops Relay A 1 hop Relay B 2 hops Sensor C 3 hops Sensor C can therefore forward its data toward Relay B, which forwards it toward Home. When the network changes, nodes can update their routing information and select a different path. Hop-by-hop reliability LighthouseReckoning uses hop-by-hop confirmation instead of requiring one end-to-end acknowledgment. Sensor C → Relay A → Relay B → Home Sensor C only needs confirmation that Relay A received its packet. Relay A then handles the next hop independently. This allows each node to deal with retries locally instead of requiring Home to maintain the state of every route in the network. Using the library A basic node can be initialized with: #include <RadioLib.h> #include <LighthouseReckoning.h> LighthouseReckoning lhr ; void setup () { // Initialize your LoRa radio here lhr . beginAsNode ( & radio , 0xA1B2C3D4 ); } void loop () { lhr . update (); uint8_t payload [] = { 0x01 , 0x02 , 0x03 }; // Send application data when needed lhr . sendData ( payload , sizeof ( payload )); } The Home node uses beginAsHome() and can receive application data through the library's callback mechanism. The library is design

2026-08-19 原文 →
AI 资讯

How to Use the SH-C30L USB-to-CAN Adapter with Arduino UNO and MCP2515

Controller Area Network (CAN) is one of those technologies that quietly powers a huge number of embedded systems. It is commonly found in cars, EVs, industrial controllers, robotics, and other distributed systems where multiple devices need to exchange data reliably over a shared bus. For development and debugging, it is useful to connect that CAN network to a computer. The problem is that a standard computer communicates through USB, while CAN uses a dedicated differential bus. A USB-to-CAN interface solves this problem by translating between the two. In this project, we will explore the DSD TECH SH-C30L USB-to-CAN adapter , learn how its different firmware modes work, connect it to a PC, and then use an Arduino UNO with an MCP2515 CAN module to create a simple bidirectional CAN communication setup. The goal is not just to make the hardware work, but also to understand what happens between the Arduino, CAN bus, USB adapter, and computer. SH-C30L USB-to-CAN Adapter Overview The SH-C30L is a compact USB-to-CAN interface designed to connect a computer directly to a CAN network. It is based on an STM32F072C8T6 microcontroller, which contains an integrated CAN controller. This allows the adapter to handle CAN protocol processing without requiring a separate external CAN controller. The microcontroller communicates with the computer through USB, while a dedicated CAN transceiver handles the physical CAN interface. The transceiver converts the controller's logic-level signals into the differential CAN_H and CAN_L signals used on a CAN network. One of the interesting aspects of the SH-C30L is its firmware flexibility. The adapter can work with Candlelight firmware , which allows it to operate with Linux SocketCAN and compatible CAN applications, or with SLCAN firmware , where it behaves more like a serial CAN interface. This makes the same hardware useful with different operating systems and software environments. The adapter supports both CAN 2.0A and CAN 2.0B frames, wit

2026-08-18 原文 →
AI 资讯

Reverse-Engineering SWIO: Why Existing CH32V003 Programmers Fail and How I Built One That Works

I wanted to see if an ESP32-S3 could be used as a programmer for the WCH CH32V003 instead of using a dedicated WCH-Link. The final setup is: PC → ESP32-S3 → SWIO → CH32V003 The ESP32-S3 handles the timing-sensitive SWIO communication and the CH32 debug/DMI interface. On top of that I implemented target detection, memory access, flash unlock, page erase, programming, read-back verification and reset/run. Hardware ESP32-S3 N8R2 CH32V003A4M6 (SOP-16) 4.7kΩ–10kΩ SWIO pull-up CP6208 motor driver Small DC motor 3.7V Li-ion battery Breadboard Important connections: ESP32-S3 GPIO10 → CH32V003 SWIO ESP32-S3 3.3V → CH32V003 VDD Common GND External pull-up on SWIO CH32V003 PC4 → CP6208 control input The software stack The programmer is split into several layers: text PC │ │ Python host tool ▼ ESP32-S3 │ │ SWIO ▼ WCH DMI │ ▼ CH32V003 debug module │ ▼ Abstract commands / program buffer │ ▼ Flash controller The ESP32-S3 is doing the SWIO timing directly rather than relying on a separate programmer IC. I used existing open-source CH32/SWIO implementations as references, particularly CNLohr's CH32V003 work and BlueSyncLine's SWIO implementation. Getting SWIO working The first versions did not work. One of the early failures was: SWIO sync: FAILED DMCFGR = 0xFFFFFFFF I had to work through the SWIO startup sequence, timing, receive behavior and physical wiring before getting reliable target responses. Once it was working, the programmer reported: SWIO sync: OK DMI communication: OK Target detect: OK CH32 ID = 0x0713BB91 Target memory read: OK That gave me a stable base for the flash implementation. Flash programming I then added the flash controller operations: flash unlock 64-byte page erase fast page programming read-back verification target reset/run One useful milestone was observing the flash lock transition: FLASH_CTLR before unlock: 0x00008080 FLASH_CTLR after unlock: 0x00000200 After that I tested programming and verification using deterministic data. The programmer was able

2026-08-16 原文 →
AI 资讯

ESP32 HTTP Client Sem Dores de Cabeça: Consuma REST APIs com Zero Alocação de Memória

Consumindo REST APIs no ESP32 sem Estourar a Memória: Conheça o ESP32-HTTP-Client Se você já desenvolveu projetos IoT no ESP32 que se comunicam com APIs REST (seja para enviar dados de sensores para a nuvem, consultar status de serviços ou integrar com Firebase e AWS), provavelmente já enfrentou um destes problemas clássicos: Fragmentação e estouro de heap: O combo padrão HTTPClient + ArduinoJson precisa carregar todo o payload HTTP na RAM como String antes de desserializar o JSON. Em payloads médios ou grandes, isso gera Out of Memory ou travamentos intermitentes. Lentidão em requisições consecutivas: O HTTPClient padrão refaz o handshake TLS/TCP repetidamente, adicionando centenas de milissegundos a cada chamada. Código verboso e boilerplate excessivo: Mais de 15 a 20 linhas de código para instanciar clientes, extrair buffers, checar erros e navegar em nós JSON. Para resolver esses gargalos de forma elegante e moderna, foi criada a biblioteca ESP32-HTTP-Client . O que é o ESP32-HTTP-Client? O ESP32-HTTP-Client é um cliente HTTP/REST moderno, fluente e orientado a objetos para ESP32, projetado especificamente para sistemas embarcados de alta eficiência. Em vez de "fazer download da resposta, guardar na memória e depois processar", ele utiliza Direct Memory Binding (injeção direta) e Stream Parsing : os dados do JSON são lidos diretamente do stream da rede e injetados direto nas suas variáveis ou struct s em C++, sem armazenar o payload inteiro na RAM . // Uma linha. Zero strings intermediárias. Injeção direta em memória. client . get ( "/sensor" ). getBody ( "temperature" , & myFloatVariable ); Benchmark: ESP32-HTTP-Client vs Abordagem Tradicional Em testes controlados com 100 requisições HTTP consecutivas contendo payloads JSON (usando o endpoint /users do JSONPlaceholder), os resultados comprovam a economia de recursos: Métrica / Recurso HTTPClient + ArduinoJson (Padrão) ESP32-HTTP-Client Diferencial Heap alocado por requisição ~58.2 KB ~0.0 KB (15 bytes) ~99.9%

2026-08-07 原文 →
AI 资讯

Meet Cloudagotchi : Building a virtual pet with a cloud brain (Part 1)

Remember Tamagotchis? Those little egg-shaped keychains from the 90s with a pixelated pet that got hungry, got sad, and, if you were a negligent eight-year-old like me, got dead during math class. I've been looking for an excuse to play with the Waveshare ESP32-S3 Touch AMOLED 1.8" , a $30 board with a gorgeous 368×448 AMOLED touchscreen, an accelerometer, a microphone, and a speaker. And I found one: I'm building a Tamagotchi. But with a twist that makes it worth a four-article series The pet's body lives on the device. Its brain lives in AWS. The device renders an adorable pet and captures your taps and shakes. But its hunger, mood, and energy are rows in DynamoDB. It gets hungry overnight because EventBridge Scheduler says so. And, my favorite part (and because it's 2026, we can't not have genAI in a project 🤪), every morning it fetches the AWS news, has Amazon Bedrock rewrite them in its own squeaky personality, and reads them to me out loud through Amazon Polly. A Tamagotchi with a job. In this series, I will walk you through the whole build: This article : the architecture, and connecting the ESP32-S3 to AWS IoT Core (the pet's nervous system). Part 2 : giving it a face: animations and touch with LVGL on the AMOLED. Part 3 : the serverless brain: Lambda, DynamoDB, and a pet that gets hungry while you sleep. Part 4 : Bedrock + Polly: my Tamagotchi reads me the AWS news. ⚠️ Reality check before you get too excited (sorry 😅): this is a hobby project, not a product. You'll need the specific Waveshare board (or the patience to adapt the code to yours), an AWS account, and a USB-C cable. The AWS bill for the whole series is well under a dollar a month, but it is not zero, and neither is the time you'll spend staring at idf.py monitor . Worth it, though. All the code lives in this repository . Each article has its own branch. For this one, git checkout article-1 . Why put a pet's brain in the cloud? Fair question. The original Tamagotchi ran on a chip with less power

2026-07-21 原文 →
AI 资讯

Getting Started with Modbus RTU on ESP32

Modbus RTU over RS-485 is the serial workhorse of industrial field wiring — the variant you'll meet when connecting an ESP32 directly to an energy meter, PLC, VFD, or temperature transmitter over a wired bus. This tutorial walks through wiring the hardware, installing a library, and flashing working RTU master code. What You'll Build A Modbus RTU master on ESP32 that polls holding registers from an RS-485 slave device over a wired bus. An understanding of register types, addressing, and the reliability practices that separate a demo from a production deployment. Prerequisites Arduino IDE (or PlatformIO) with the ESP32 board package installed. An ESP32 dev board, or an industrial ESP32 controller with a built-in RS-485 transceiver such as the NORVI X — this saves you from wiring a separate MAX485 module. A Modbus RTU slave device (energy meter, sensor, or PLC). Basic familiarity with the Arduino C++ syntax and serial monitor debugging. A 60-Second Modbus Primer Modbus is a master–slave protocol dating back to 1979. One master polls up to 247 slave devices, each with a unique address (1–247). Data lives in four register types, and knowing which one you need is half the battle: Register Type Access Width Typical Use Coils (0x) Read/Write 1-bit Relay outputs, digital controls Discrete Inputs (1x) Read only 1-bit Digital sensor inputs, switch states Input Registers (3x) Read only 16-bit Analog sensor values, process data Holding Registers (4x) Read/Write 16-bit Setpoints, configuration parameters Modbus RTU over RS-485 Step 1 — Wire the Hardware The ESP32's UART pins output 3.3V TTL logic, but RS-485 uses a differential voltage signal — so you need a TTL-to-RS-485 transceiver (typically a MAX485 or MAX3485 chip) between the ESP32 and the bus. UART TX → transceiver DI (driver input) UART RX ← transceiver RO (receiver output) A spare GPIO → transceiver DE and RE tied together (direction control) Transceiver A/B terminals → the RS-485 A+/B− pair on your slave device Skip th

2026-07-17 原文 →
开发者

ESP32 OLED Mini Shooter Game: Full Beginner Tutorial

Want to turn a small ESP32 board into a mini arcade game you can actually play? This ESP32 OLED Mini Shooter Game uses a 128x64 OLED display and two push buttons to create a simple shooter experience. The player moves left and right, bullets fire upward, and enemies fall from the top of the screen. It is a small project, but it already feels like a real handheld game once the display starts updating. This build is a great next step after basic OLED and button tutorials. Instead of only printing text or drawing one shape, the code manages several moving objects at the same time. It tracks the player, bullets, enemies, collisions, and game-over state. The screen is divided into a simple grid. The 128x64 OLED becomes a 16x8 playfield, where each tile is 8x8 pixels. This makes object movement easier to understand because the player, enemies, and bullets move by grid position instead of raw pixel math. Why build it? This project teaches interactive programming on real hardware. The ESP32 reads button input, updates game objects, checks collisions, and draws the next frame on the OLED. That is much more active than a normal sensor display project. It also teaches timing without blocking the whole game flow. The code uses millis() to control when bullets and enemies update, so they can move at different speeds. This is useful because many embedded projects need timed actions without stopping everything else. What you'll learn ESP32 OLED display control - drawing text, squares, circles, and game objects on an SSD1306 screen. Custom I2C pins - using Wire.begin(5, 19) so the OLED uses GPIO5 for SDA and GPIO19 for SCL. Button input handling - reading two push buttons for left and right movement. Debounce logic - preventing one press from being counted many times. Grid-based game design - turning a 128x64 screen into a simple 16x8 game map. Game object arrays - storing multiple bullets and enemies with active/inactive states. Timer-based updates - using millis() to move bullets

2026-06-26 原文 →