使用蓝牙模块、Arduino 设备和 4 通道继电器模块控制家用灯的物联网项目

2025年4月25日 | 3 分钟阅读

在这个项目中,我们将使用蓝牙网络构建一个家用灯光控制系统。在这个项目中,我们使用蓝牙模块 HC-05、Arduino 设备、4 通道继电器模块等。

硬件要求

  1. Arduino UNO 开发板
  2. 用于连接 Arduino UNO 的 USB 数据线
  3. 蓝牙模块 HC-05
  4. 4 通道继电器模块 (5V)
  5. 跳线,公对母
  6. 家用灯(灯泡)
  7. 灯泡座
  8. Wire
  9. 交流 220v/120v 家用电器或 9v 高瓦特电池

软件要求

  1. Arduino 软件

Arduino-蓝牙模块的工作原理

在这个项目中,使用了四个主要组件:Android 智能手机蓝牙应用程序、蓝牙收发器、Arduino 设备和 4 通道继电器模块。

IoT project of controlling home light using Bluetooth module, Arduino device, and 4 Channel relay module

Android 应用程序通过点击 ON 按钮将串行数据发送到已连接的蓝牙模块 HC-05。蓝牙设备从应用程序接收数据,并通过蓝牙模块的 TX 引脚将其发送到 Arduino 的 RX 引脚。Arduino 设备读取输入数据并根据上传到其中的程序进行处理,并将输出发送到 4 通道继电器模块。

当蓝牙应用程序的按钮变为 ON 时,它会将家用灯设置为 ON,当蓝牙应用程序的按钮变为 OFF 时,它会将家用灯设置为 OFF。

编写一个 Arduino 程序,使用蓝牙模块、4 通道继电器模块和 Android 应用程序控制家用灯。

使用 Arduino USB 数据线将您的代码编译并上传到 Arduino 设备。 上传代码时,请勿将其他设备连接到 Arduino。

数字电路图

蓝牙模块 HC-05           Arduino UNO
RX  -------------------------------->    TX
TX  -------------------------------->    RX
GND  ----------------------------->    GND
5V  -------------------------------->    3.3V

4 通道继电器模块           Arduino UNO
GND   ------------------------------>   GND
IN1  -------------------------------->    引脚 9
IN2  -------------------------------->    引脚 8
IN3  -------------------------------->    引脚 7
IN4  -------------------------------->    引脚 6
VCC  -------------------------------->    5V

继电器模块、灯泡和输入电源之间的连接

  1. 将继电器模块的公共端 (com) 连接到家用灯。
  2. 将继电器模块的常闭端 (nc) 连接到电源。
  3. 将剩余的一根家用灯线连接到电源。

下载并安装 Arduino Bluetooth Controller.apk 文件的 Android 应用程序。 点击此处下载

IoT project of controlling home light using Bluetooth module, Arduino device, and 4 Channel relay module IoT project of controlling home light using Bluetooth module, Arduino device, and 4 Channel relay module
IoT project of controlling home light using Bluetooth module, Arduino device, and 4 Channel relay module IoT project of controlling home light using Bluetooth module, Arduino device, and 4 Channel relay module

项目输出

IoT project of controlling home light using Bluetooth module, Arduino device, and 4 Channel relay module IoT project of controlling home light using Bluetooth module, Arduino device, and 4 Channel relay module