IoT 入门指南 IoT Beginner Guide
IoT Beginner Guide
从零开始你的物联网之旅 — 不需要任何编程或硬件经验
Start your IoT journey — no programming or hardware experience required
查看学习路线图 ↓ View learning roadmap ↓📍 学习路线图
📍 Learning Roadmap
按顺序学习,或点击感兴趣的步骤直接跳转
Learn in order, or click any step to jump directly
🌐 什么是物联网?
🌐 What is IoT?
物联网(Internet of Things, IoT)是指将日常设备连接到互联网,让它们能够收集和分享数据的技术。简单来说,就是让"东西"变得"智能"。
现实中的物联网
- 智能家居 (Smart Home):用手机远程控制灯光、空调、门锁
- 可穿戴设备 (Wearables):智能手表监测心率、步数、睡眠
- 工业传感器 (Industrial Sensors):工厂设备实时监控温度、压力、振动
- 智慧农业 (Smart Agriculture):土壤湿度传感器自动灌溉
关键术语 (Key Terms)
The Internet of Things (IoT) is the practice of connecting everyday devices to the internet so they can collect and share data. In short — making "things" smart.
IoT in the real world
- Smart Home — control lights, AC, and door locks from your phone
- Wearables — smartwatches tracking heart rate, steps, and sleep
- Industrial Sensors — factory equipment monitoring temperature, pressure, and vibration in real time
- Smart Agriculture — soil moisture sensors triggering automatic irrigation
Key Terms
物联网中最常用的5大无线通信协议
今天我就和大家聊聊物联网领域目前使用最广泛的10大无线通信协议。 物联网的蓬勃发展让我们生活变得更便捷,但各种无线通信协议的出现也给产品选型带来不小困扰。下面我就按使用频率从高到低为大家详细介绍一下当前物联网领域最主要的10种无线通信技术。 1. 蓝牙/BLE 蓝牙是一种短距离、低功耗的无线连接技术,主要用于连接固定设备和移动设备。它的主要优势包括: -...
阅读全文 →EPS32简介
ESP32是一系列低成本,低功耗的单片机微控制器,集成了Wi-Fi和双模蓝牙。本文介绍了ESP32模块的特点,和比较不同系列之间的区别,还简单介绍不同厂家生产的ESP32开发板。
阅读全文 →🛒 你需要准备什么
🛒 What You Need
硬件清单 (Hardware List)
| 物品 | 规格建议 | 参考价格 |
|---|---|---|
| ESP32 开发板 | ESP32-WROOM-32 或 ESP32-C3 | ¥15-30 |
| USB 数据线 | Micro-USB 或 USB-C(取决于开发板) | ¥5-10 |
| 面包板 (Breadboard) | 400孔或830孔 | ¥5-8 |
| 杜邦线 (Jumper Wires) | 公对公、公对母各10根 | ¥3-5 |
| DHT22 温湿度传感器 | 数字输出,精度±0.5°C | ¥8-15 |
| LED + 电阻 | 5mm LED + 220Ω电阻 | ¥1-2 |
软件安装 (Software Setup)
- 安装 Arduino IDE — 从
arduino.cc下载最新版 - 安装 ESP32 开发板支持 — 在 IDE 的 Board Manager 中搜索 ESP32 并安装
- 安装 USB 驱动 — 根据开发板芯片型号安装 CH340 或 CP2102 驱动
- 选择开发板和端口 — Tools → Board → ESP32 Dev Module
第一个程序:点亮 LED
连接 LED 到 GPIO 引脚,上传 Blink 示例代码(File → Examples → Basics → Blink),恭喜!你已经完成了第一个嵌入式程序。
关键术语 (Key Terms)
Hardware list
| Item | Recommended spec | Price (¥, RMB) |
|---|---|---|
| ESP32 dev board | ESP32-WROOM-32 or ESP32-C3 | ¥15-30 |
| USB cable | Micro-USB or USB-C depending on the board | ¥5-10 |
| Breadboard | 400 or 830 tie-points | ¥5-8 |
| Jumper wires | 10 male-to-male + 10 male-to-female | ¥3-5 |
| DHT22 temp/humidity sensor | Digital output, ±0.5°C accuracy | ¥8-15 |
| LED + resistor | 5mm LED + 220Ω resistor | ¥1-2 |
Software setup
- Install Arduino IDE — download the latest from
arduino.cc - Install ESP32 board support — search ESP32 in the IDE's Board Manager and install
- Install USB driver — CH340 or CP2102, depending on your board's chip
- Select board and port — Tools → Board → ESP32 Dev Module
Your first program: blink an LED
Wire an LED to a GPIO pin, upload the Blink example (File → Examples → Basics → Blink). Congratulations — you've just written your first embedded program.
Key Terms
ESP32 多核编程:双核任务分配与共享内存同步
ESP32 搭载双核 Xtensa 处理器,本文详解如何用 FreeRTOS 把任务分配到不同核心运行,并通过互斥锁、信号量、消息队列实现跨核共享内存安全同步,附带完整代码示例。
阅读全文 →MicroPython vs Arduino vs PlatformIO:嵌入式开发框架横评
三大主流嵌入式开发框架深度对比:从上手难度、执行效率到调试体验,帮你选出最适合项目的开发工具链
阅读全文 →ESP32引脚图完整指南2026|GPIO分配 + 功能说明 + 实物图
ESP32-C3引脚图完整参考:全部GPIO引脚功能说明、UART/ADC/SPI/I2C通道对照表、电源引脚分配。附开发板原理图、CH341驱动安装、PlatformIO与Arduino环境配置指南。2026实战版,立即下载→
阅读全文 →💡 核心概念
💡 Core Concepts
传感器 (Sensors)
传感器是物联网的"感官",负责检测环境中的物理量并转换为电信号。
- 温湿度传感器:DHT22、SHT30 — 测量温度和湿度
- 光照传感器:BH1750 — 测量环境光强度(勒克斯 lux)
- 距离传感器:HC-SR04 超声波 — 测量物体距离
- 存在传感器:RCWL-0516 毫米波 — 检测人体存在
执行器 (Actuators)
执行器是物联网的"手脚",根据指令执行物理动作。
- LED — 最简单的输出设备,指示状态
- 继电器 (Relay) — 控制高电压设备(如电灯、风扇)
- 电机 (Motor) — 伺服电机、步进电机、直流电机
- 蜂鸣器 (Buzzer) — 发出声音提醒
微控制器基础 (MCU Basics)
数据流 (Data Flow)
一个典型的物联网系统数据流:
关键术语 (Key Terms)
Sensors
Sensors are the "senses" of an IoT system — they detect physical quantities and convert them into electrical signals.
- Temperature / humidity — DHT22, SHT30 measure temperature and humidity
- Light — BH1750 measures ambient light in lux
- Distance — HC-SR04 ultrasonic sensor measures object distance
- Presence — RCWL-0516 millimeter-wave radar detects human presence
Actuators
Actuators are the "hands and feet" of IoT — they perform physical actions on command.
- LED — the simplest output, indicates status
- Relay — switches high-voltage devices like lights and fans
- Motor — servos, steppers, DC motors
- Buzzer — audio alerts
MCU Basics
Data Flow
A typical IoT system pipeline:
Key Terms
温湿度传感器精度测试:DHT22 vs SHT30 对比评测
深入测试 DHT22 和 SHT30 温湿度传感器的精度差异,包含实测数据、代码示例和选型建议,帮你做出正确选择。
阅读全文 →超声波测距模块 HC-SR04 进阶应用:精度优化与多传感器融合
HC-SR04 超声波测距模块进阶教程,包含精度优化技巧、多传感器融合方案、温度补偿算法和实际项目案例,助你打造精准测距系统。
阅读全文 →毫米波雷达传感器 RCWL-0516:人体存在检测实战
深入讲解 RCWL-0516 毫米波雷达传感器的工作原理、硬件接线、Arduino/ESP32 编程实战,以及人体存在检测项目的完整搭建指南。
阅读全文 →📡 通信协议入门
📡 Protocols 101
物联网设备需要通过网络通信。不同的场景需要不同的协议,就像不同的交通工具适合不同的距离。
短距离无线通信
| 协议 | 范围 | 功耗 | 适用场景 |
|---|---|---|---|
| WiFi | ~100m | 高 | 高带宽、持续供电设备 |
| BLE | ~50m | 极低 | 可穿戴、手机配对 |
| Zigbee | ~100m | 低 | 智能家居 mesh 网络 |
| Thread | ~100m | 低 | 新一代智能家居标准 |
长距离无线通信
| 协议 | 范围 | 功耗 | 适用场景 |
|---|---|---|---|
| LoRa | ~10km | 极低 | 农业、环境监测 |
| NB-IoT | 蜂窝覆盖 | 低 | 城市基础设施、计量 |
| 4G Cat.1 | 蜂窝覆盖 | 中 | 移动设备、中等数据量 |
应用层协议
- MQTT — 发布/订阅模式,轻量级,物联网首选。设备"发布"数据到"主题",其他设备"订阅"该主题即可接收
- HTTP/REST — 你熟悉的网页协议,较重但通用性强
关键术语 (Key Terms)
IoT devices need to communicate over networks. Different scenarios call for different protocols — like choosing the right vehicle for different distances.
Short-range wireless
| Protocol | Range | Power | Use case |
|---|---|---|---|
| WiFi | ~100m | High | High bandwidth, mains-powered devices |
| BLE | ~50m | Very low | Wearables, phone pairing |
| Zigbee | ~100m | Low | Smart home mesh networks |
| Thread | ~100m | Low | Next-gen smart home standard |
Long-range wireless
| Protocol | Range | Power | Use case |
|---|---|---|---|
| LoRa | ~10km | Very low | Agriculture, environmental monitoring |
| NB-IoT | Cellular | Low | City infrastructure, metering |
| 4G Cat.1 | Cellular | Medium | Mobile devices, moderate data |
Application-layer protocols
- MQTT — publish/subscribe model, lightweight, IoT's top choice. Devices publish data to a topic; other devices subscribe to that topic to receive it.
- HTTP/REST — the web protocol you already know; heavier but universally supported
Key Terms
物联网中最常用的5大无线通信协议
今天我就和大家聊聊物联网领域目前使用最广泛的10大无线通信协议。 物联网的蓬勃发展让我们生活变得更便捷,但各种无线通信协议的出现也给产品选型带来不小困扰。下面我就按使用频率从高到低为大家详细介绍一下当前物联网领域最主要的10种无线通信技术。 1. 蓝牙/BLE 蓝牙是一种短距离、低功耗的无线连接技术,主要用于连接固定设备和移动设备。它的主要优势包括: -...
阅读全文 →2026 MQTT物联网实战:ESP32数据采集+Node-RED可视化
从零搭建完整MQTT物联网监控系统:Mosquitto服务器部署与配置、ESP32传感器数据采集上报、Node-RED实时仪表盘可视化展示。附完整源码、接线图和常见故障排查方案,涵盖QoS设置、断线重连等实战技巧,适合物联网初学者和开发者参考。
阅读全文 →2026 MQTT代理自建教程:Mosquitto服务器配置与优化
用Eclipse Mosquitto在Linux服务器上自建MQTT代理,数据完全掌控不依赖公共平台。涵盖Mosquitto安装部署、用户认证与ACL权限配置、TLS/SSL加密通信,以及连接数调优等性能优化技巧。适合物联网开发者搭建安全可靠的本地化消息中枢。
阅读全文 →Zigbee 3.0 协议解析:低功耗 mesh 网络智能家居实战
深入讲解 Zigbee 3.0 协议原理,从零搭建低功耗 mesh 网络,实现智能家居设备互联互通,包含完整代码示例和故障排查指南。
阅读全文 →LoRa SX1278 远距离组网实战:ESP32 无线通信模块教程 2026
在物联网项目里,WiFi 和蓝牙够用了——直到你需要覆盖几百米甚至几公里。 农场温湿度监控、园区安防、水库水位监测……这些场景里,WiFi 信号?不存在的。这时候 LoRa(Long Range)就派上用场了。 而 SX1278,是目前性价比最高的 LoRa 芯片之一。淘宝上 15 块钱就能买到一个模块,加上 ESP32 主控,就能搭建一个覆盖数公里的无线传感器网络。...
阅读全文 →🔧 第一个IoT项目
🔧 Your First IoT Project
🎯 项目目标:智能温湿度监控
读取 DHT22 传感器的温湿度数据,通过 WiFi 发送到 MQTT 服务器,在手机上实时查看。
步骤 1:连接硬件
将 DHT22 传感器连接到 ESP32:
- DHT22 VCC → ESP32 3.3V
- DHT22 GND → ESP32 GND
- DHT22 DATA → ESP32 GPIO 4(加 10kΩ 上拉电阻)
步骤 2:读取传感器数据
使用 Arduino DHT 库读取温湿度值。安装库:Sketch → Include Library → Manage Libraries → 搜索 "DHT sensor library"。
步骤 3:连接 WiFi
使用 ESP32 内置的 WiFi 库连接到你的家庭网络。将 WiFi 名称和密码写入代码。
步骤 4:发送 MQTT 数据
使用 PubSubClient 库连接 MQTT Broker,将温湿度数据发布到 home/living-room/temp 和 home/living-room/humidity 主题。
步骤 5:查看数据
在手机上安装 MQTT Dashboard 应用(如 IoT MQTT Panel),订阅相同主题,即可实时查看数据。
常见问题 (Troubleshooting)
- 传感器读数为 NaN — 检查接线,确认上拉电阻已连接
- WiFi 连接失败 — 确认密码正确,ESP32 仅支持 2.4GHz WiFi
- MQTT 连接超时 — 检查 Broker 地址和端口(默认 1883)
关键术语 (Key Terms)
🎯 Project goal: smart temperature & humidity monitor
Read temperature and humidity from a DHT22, send it over WiFi to an MQTT server, and view it live on your phone.
Step 1: wire the hardware
Connect the DHT22 to the ESP32:
- DHT22 VCC → ESP32 3.3V
- DHT22 GND → ESP32 GND
- DHT22 DATA → ESP32 GPIO 4 (with a 10kΩ pull-up resistor)
Step 2: read sensor data
Use the Arduino DHT library to read temperature and humidity. Install it: Sketch → Include Library → Manage Libraries → search for "DHT sensor library".
Step 3: connect to WiFi
Use the ESP32's built-in WiFi library to connect to your home network. Put your WiFi SSID and password in the code.
Step 4: publish MQTT data
Use the PubSubClient library to connect to the MQTT broker and publish temperature and humidity to the topics home/living-room/temp and home/living-room/humidity.
Step 5: view the data
Install an MQTT Dashboard app on your phone (e.g. IoT MQTT Panel), subscribe to the same topics, and watch the data stream in.
Troubleshooting
- Sensor reads NaN — check wiring; confirm the pull-up resistor is connected
- WiFi won't connect — verify the password; ESP32 only supports 2.4GHz WiFi
- MQTT connection times out — check the broker address and port (default 1883)
Key Terms
ESP32 温湿度监控系统:DHT22 + MQTT + Node-RED 仪表盘完整项目教程
从零搭建 ESP32 温湿度监控系统:DHT22 传感器接线、Arduino IDE 代码、MQTT 通信协议配置、Node-RED 仪表盘可视化,一套完整的物联网实战项目。
阅读全文 →Arduino OLED 显示屏完全教程:SSD1306 I2C 接线、绘图与传感器数据实时显示(2026)
从零学会 Arduino 驱动 SSD1306 OLED 显示屏:I2C 接线方法、Adafruit_SSD1306 库使用、文字/图形绘制、温湿度传感器数据实时显示,附完整代码与接线图。
阅读全文 →2026 MQTT物联网实战:ESP32数据采集+Node-RED可视化
从零搭建完整MQTT物联网监控系统:Mosquitto服务器部署与配置、ESP32传感器数据采集上报、Node-RED实时仪表盘可视化展示。附完整源码、接线图和常见故障排查方案,涵盖QoS设置、断线重连等实战技巧,适合物联网初学者和开发者参考。
阅读全文 →🚀 下一步去哪
🚀 What's Next
恭喜你!你已经完成了 IoT 入门的基础知识,并成功构建了第一个物联网项目。接下来,你可以探索以下进阶方向:
进阶方向
- 边缘 AI (Edge AI / TinyML) — 在微控制器上运行机器学习模型,实现本地智能决策
- 智能家居 (Smart Home) — 使用 Matter 协议构建跨品牌智能家居系统
- 工业物联网 (Industrial IoT) — Modbus、CAN 总线等工业通信协议
- 低功耗设计 — 电池供电设备的深度睡眠和能耗优化
- PCB 设计 — 从面包板原型到定制电路板
Congratulations — you've covered the fundamentals of IoT and built your first IoT project. Here are some advanced directions to explore next:
Advanced paths
- Edge AI / TinyML — run machine learning models on microcontrollers for local intelligence
- Smart Home — build cross-brand smart home systems with the Matter protocol
- Industrial IoT — Modbus, CAN bus, and other industrial protocols
- Low-power design — deep sleep and energy optimization for battery-powered devices
- PCB design — go from breadboard prototypes to custom circuit boards
ESP32-S3 边缘 AI 入门:TinyML 图像识别实战
手把手教你用 ESP32-S3 + OV2640 摄像头跑 TinyML 图像分类模型,无需联网也能识别人脸、猫狗和物体,适合嵌入式开发者入门边缘 AI。
阅读全文 →ESP32-C6 实战:WiFi 6 + Matter 双协议智能家居节点
用 ESP32-C6 打造支持 WiFi 6 和 Matter 协议的智能家居节点,实现跨品牌设备互联。从硬件选型、固件编译到 HomeKit 接入,完整实战指南。
阅读全文 →2026 DIY智能门铃:人脸识别+微信推送(成本<¥300)
用树莓派+摄像头模块DIY智能门铃,集成AI人脸识别和微信消息推送功能。总成本不到300元,可自动识别家庭成员、陌生人按铃实时报警、快递到达即时通知。含完整硬件清单、Python代码和微信Server酱推送配置教程,周末即可完成的安防项目。
阅读全文 →TinyML 异常检测:工业设备预测性维护边缘方案
用 Arduino Nano 33 BLE Sense + Edge Impulse 在 MCU 上跑异常检测模型,提前发现电机、泵、风机故障,实现低延迟预测性维护。
阅读全文 →