当前位置:网站首页>【飞控开发基础教程7】疯壳·开源编队无人机-SPI(气压计数据获取)
【飞控开发基础教程7】疯壳·开源编队无人机-SPI(气压计数据获取)
2022-07-28 12:49:00 【efans_Mike】
COCOFLY教程
——疯壳·无人机·系列
SPI(气压计数据获取)
图1
一、SPL06 简介
SPL06 是歌尔公司最新推出新款气压传感器,最新推出新款气压传感器SPL06-001,歌尔是全球领先的 MEMS 厂家,SPL06 利用歌尔多年积累的 MEMS 开发技术,通过搭载高精度的检测用 MEMS(MicroElectroMechanicalSystems)即微机电系统和低功耗的集成电路,实现了业界最高级别别的精度±5cm,SPL06 是一种具有高精度和低电流消耗的小型化的数字式气压传感器,兼具压力和温度测量两种特点。压力传感器元件基于电容传感器原理,保证温度变化过程中的高精度测量。小型封装结构适合移动应用和可穿戴设备等。SPL06 的内部信号处理器将压力和温度传感器元件的输出转换为 24 位数据。每个压力传感器已被单独校准并包含校准系数。在应用中使用系数将测量结果转换成真实的压力和温度值。
SPL06 的实物图如下所示。
图2
二、气压计数据获取实验
气压计数据获取实验使用 STM32 的硬件 SPI 与气压计 SPL06 相连接,串口1 即 UART1,通过 USB 转串口模块连接电脑,把 SPI 获取到的 SPL06 的原始压力值以及原始温度值数据通过串口 1 传输到电脑端的串口调试助手显示出来。做该实验的时候需要把视觉模组暂时取下,并且把 USB 转串口的线接到视觉模组接口处。气压计 SPL06 在无人机顶部的白色 RGB 彩灯盒里,通过软排把 SPI 及供电口接出,如下图所示。
图3
根据原理图,可以看到 SPL06 的的 SPI 接口分别是:PB15、PA5、PA6、PA7, 如下图所示。
图4
串口 1 的配置可以参考《串口(基础收发),配置代码(通过调用官方库)。获取 SPL06 的数据代码编写的思路如下:
表1
SPI 初始化代码如下:

图5
SPI 的读写代码如下。
图6
SPL06 的初始化代码如下。
图7
SPL06 的读写代码如下。
图8
查看手册发现压力、温度的 24 位原始值在地址 0x00~0x05 上。
图9
读取该寄存器数据,并发送到串口上。代码如下所示。
图10
这里注意要把串口的发送也配置好,这样才能把数据发送到电脑。串口 1 通过 USB 转串口模块接到电脑,保存、编译、下载代码,可以看到 USB 转串口模块在不断地打印 SPL06 的 3 个字节原始压力值数据以及 3 个字节的原始温度数据,数据如下图所示:
图11
更多完整学习资料和对应开源套件,请登陆官网:“疯壳”
如需定制开发,请通过官网“疯壳”网页底部的“联系我们”进行联系
边栏推荐
- Facial expression recognition based on pytorch convolution - graduation project "suggestions collection"
- 30天刷题计划(四)
- 数据库系统原理与应用教程(061)—— MySQL 练习题:操作题 21-31(五)
- What if the server cannot be connected (the original server cannot find the target resource)
- Countdown 2 days! 2022 China Computing Conference: Mobile cloud invites you to meet with computing network for innovative development
- My friend sent me some interview questions
- Excellent performance! Oxford, Shanghai, AI Lab, Hong Kong University, Shangtang, and Tsinghua have joined forces to propose a language aware visual transformer for reference image segmentation! Open
- Tutorial on the principle and application of database system (059) -- MySQL exercise questions: operation questions 1-10 (III)
- Dojnoip201708 cheese solution
- [apue] 文件中的空洞
猜你喜欢

How to check if the interface cannot be adjusted? I didn't expect that the old bird of the 10-year test was planted on this interview question

30天刷题计划(四)

Denial of service DDoS Attacks

Product Manager: job responsibility table

You have to apologize if you get involved in the funny shop?

No swagger, what do I use?

最强分布式锁工具:Redisson

The domestic API management tool eolink is very easy to use, creating an efficient research and development tool

30天刷题计划(三)

国产API管理工具Eolink太好用了,打造高效的研发利器
随机推荐
R language uses LM function to build linear regression model and subset function to specify subset of data set to build regression model (use floor function and length function to select the former pa
R language Visual scatter diagram, geom using ggrep package_ text_ The repl function avoids overlapping labels between data points (add labels to specific areas of the visual image using the parameter
Beyond istio OSS -- current situation and future of istio Service Grid
Product Manager: job responsibility table
Debezium系列之:2.0.0.Beta1的重大变化和新特性
数据库系统原理与应用教程(060)—— MySQL 练习题:操作题 11-20(四)
数据库系统原理与应用教程(061)—— MySQL 练习题:操作题 21-31(五)
Poj3275 ranking the cows
30 day question brushing plan (II)
数据库系统原理与应用教程(062)—— MySQL 练习题:操作题 32-38(六)
[Architecture] reading notes of three micro service books with high scores
SAP ui5 fileuploader control realizes local file upload, and trial version of cross domain access error encountered when receiving server-side response
【安全】 阅读 RFC6749 及理解 Oauth2.0 下的授权码模式
数据库系统原理与应用教程(059)—— MySQL 练习题:操作题 1-10(三)
Volcanic stone investment Zhang Suyang: hard technology, the relatively certain answer in the next 10 years
DOJNOIP201708奶酪题解
国产API管理工具Eolink太好用了,打造高效的研发利器
Uva11175 digraph D and E from D to e and back
Li Kou sword finger offer 51. reverse order pairs in the array
朋友发来几个面试题