配置树莓派环境
sudo systemctl stop serial-getty@ttyAMA0.service
sudo systemctl disable serial-getty@ttyAMA0.servicesudo systemctl stop serial-getty@ttyS0.service
sudo systemctl disable serial-getty@ttyS0.servicesudo vi /boot/cmdline.txt
# Remove the line: console=serial0,115200sudo vi /boot/config.txt
# Add a line:
enable_uart=1sudo reboot
参考
写程序驱动
运行此脚本以得到结果。参考
后期可用此工具集成到个人网站中,定时任务中等。
和检测站对比
从空气质量查询网站 查找,单看 PM2.5数据 和 我本机测试的基本没区别,至于转换成AQI的数值,可能因为国内外的标准区别而不同。
参考:
配置 Raspberry Pi 3 的参数 — Configuring The GPIO Serial Port On Raspbian Jessie and Stretch Including Pi 3
程序 — Raspberry Pi 读取攀藤G3 PM2.5