2024-06-06 09:43:33 +08:00
|
|
|
|
# 基于 Raspberry Pico / Pico W (RP2040 FreeRTOS) 的厨房危险(火灾)报警 (Pico W WiFi传输暂时不玩)
|
2024-06-03 16:27:41 +08:00
|
|
|
|
|
2024-06-04 09:54:09 +08:00
|
|
|
|
* 使用 DS18B20温度传感器
|
|
|
|
|
* 使用 CH4 N55A甲烷气体传感器(进口) (弃用)
|
|
|
|
|
* 使用 PASCO2V01 CO2二氧化碳传感器模块(进口模块暂时买不到!)
|
|
|
|
|
* 使用 MH-Z14B CO2二氧化碳传感器模块(国产)(0 - 5000ppm)
|
|
|
|
|
* 使用 ZE07-CO CO一氧化碳传感器模块(国产)
|
|
|
|
|
* 使用 HC-12 433MHZ传感器模块(国产)
|
|
|
|
|
* 使用 ZC05/ZC13 可燃气体(天然气 CH4)传感器模块(国产)
|
|
|
|
|
|
|
|
|
|
## 源码构建
|
|
|
|
|
|
|
|
|
|
```bash
|
2024-09-08 18:39:35 +08:00
|
|
|
|
# 使用WSL Debian GNU/Linux 12 (bookworm) 构建,或者 Operating System: Ubuntu 23.10
|
2024-06-03 16:27:41 +08:00
|
|
|
|
# 确保Pico-SDK环境变量
|
2024-09-08 18:39:35 +08:00
|
|
|
|
# 使用官方工具 https://github.com/raspberrypi/pico-setup 下载并设置 SDK 环境变量
|
|
|
|
|
export PICO_SDK_PATH=/mnt/c/Users/niuyuling/Desktop/raspberry/pico-setup/pico/pico-sdk
|
|
|
|
|
export PICO_EXAMPLES_PATH=/mnt/c/Users/niuyuling/Desktop/raspberry/pico-setup/pico/pico-examples
|
|
|
|
|
export PICO_EXTRAS_PATH=/mnt/c/Users/niuyuling/Desktop/raspberry/pico-setup/pico/pico-extras
|
|
|
|
|
export PICO_PLAYGROUND_PATH=/mnt/c/Users/niuyuling/Desktop/raspberry/pico-setup/pico/pico-playground
|
|
|
|
|
export PICOTOOL_FETCH_FROM_GIT_PATH=/mnt/c/Users/niuyuling/Desktop/raspberry/pico-setup/pico/picotool
|
2024-06-03 16:27:41 +08:00
|
|
|
|
|
|
|
|
|
apt install cmake gcc-arm-none-eabi gcc g++
|
|
|
|
|
apt install gdb-multiarch automake autoconf build-essential texinfo libtool libftdi-dev libusb-1.0-0-dev
|
|
|
|
|
|
2024-08-23 08:08:37 +08:00
|
|
|
|
# RP2040 SDK 版本构建
|
|
|
|
|
cd ~
|
2024-06-03 16:27:41 +08:00
|
|
|
|
git clone https://git.aixiao.me/aixiao/Danger-alarm.git
|
|
|
|
|
cd Danger-alarm
|
|
|
|
|
git submodule init
|
|
|
|
|
git submodule update
|
|
|
|
|
mkdir -p SOFTWARE/build
|
|
|
|
|
cd SOFTWARE/build
|
|
|
|
|
#cmake ..
|
|
|
|
|
cmake -DPICO_BOARD=pico_w ..
|
|
|
|
|
make
|
|
|
|
|
|
2024-08-23 08:08:37 +08:00
|
|
|
|
# FreeRTOS 版本构建
|
|
|
|
|
cd ~/Danger-alarm/SOFTWARE-FreeRTOS
|
|
|
|
|
mkdir build
|
2024-09-08 18:39:35 +08:00
|
|
|
|
cd build
|
2024-08-23 08:08:37 +08:00
|
|
|
|
cmake -DPICO_BOARD=pico_w .. && make -j4
|
|
|
|
|
|
2024-06-03 16:27:41 +08:00
|
|
|
|
|
2024-09-08 18:39:35 +08:00
|
|
|
|
# 树莓派Zero W 433MHZ HC-12接收服务端构建(需要自己开启 Raspberry Pi 串口, 并连接好硬件 HC-12)
|
2024-06-04 09:54:09 +08:00
|
|
|
|
apt install libmysqlclient-dev
|
2024-06-03 16:27:41 +08:00
|
|
|
|
cd ~
|
|
|
|
|
git clone https://github.com/WiringPi/WiringPi.git
|
|
|
|
|
cd WiringPi
|
|
|
|
|
./build
|
2024-06-06 10:05:52 +08:00
|
|
|
|
cd ~/Danger-alarm/SERVER/libconf && make clean; make
|
|
|
|
|
cd ~/Danger-alarm/SERVER/hc-12 && make clean; make
|
2024-06-03 16:27:41 +08:00
|
|
|
|
./hc-12
|
|
|
|
|
|
|
|
|
|
```
|
2024-06-04 09:54:09 +08:00
|
|
|
|
|
|
|
|
|
## 展示
|
|
|
|
|
|
2024-06-04 16:06:30 +08:00
|
|
|
|
电路图:
|
|
|
|
|
[ProProject_Danger-alarm_2024-03-21.epro](https://git.aixiao.me/aixiao/Danger-alarm/src/branch/main/HARDWARE/ProProject_Danger-alarm_2024-03-21.epro)
|
|
|
|
|
![brief](HARDWARE/IMG/SHC.png)
|
|
|
|
|
|
|
|
|
|
硬件:
|
|
|
|
|
![brief](HARDWARE/IMG/HW.jpg)
|
|
|
|
|
|
|
|
|
|
同步到Mysql:
|
2024-06-03 16:27:41 +08:00
|
|
|
|
![brief](HARDWARE/IMG/db.jpg)
|
2024-06-04 16:06:30 +08:00
|
|
|
|
|
|
|
|
|
433MHZ通信:
|
2024-06-03 16:27:41 +08:00
|
|
|
|
![brief](HARDWARE/IMG/display.png)
|