当前位置:网站首页>光流传感器初步测试:GL9306
光流传感器初步测试:GL9306
2022-07-07 21:53:00 【卓晴】
§01GL9306光流传感器
一、背景介绍
根据全国大学生智能车竞赛, 智能视觉组同学询问, 是否可以使用光流传感器GL9306。 为了熟悉这款传感器的特性, 在淘宝上购买了一个传感器进行测试。 下面测试一下这个传感器的特性。
二、器件特性
1、器件接口
器件的接口比较简单; 三个接口管脚定义分别是: VDD、GND、以及UARG。 对于串口数据输出信号, 在网站页面给出了数据通讯格式。 通讯波特率为19200, 输出数据帧速为66H组, 数据表示模块移动距离。 当距离很小的时候,输出为0。
2、接口改造
为了能够在面包板上测试模块数据, 下面对于模块接口改造成100mil间距的接头。 焊接完之后增加热缩管。 这是接口改造完长之后的传感器。
三、器件测试
1、上电观察接口信号
下面将传感器接在面包板上, 对器件施加3.3V的工作电压。 器件稳态的工作电流大约20mA。 利用示波器观察UART输出管脚信号。 可以看到管脚有数据输出。 具体数据需要使用计算机来进行辨析。 这是测量每个数据帧之间的周期, 大约是38ms, 对应的数据帧速为26.3Hz。
2、读取数据
为了读取光流传感器输出数据, 这里使用了MM32F3277 MicroPython实验板。 使用其中的UART(1), 占用了PA3(RXD),PA2(TXD), 初始化波特率为19200, 将模块连接到光流传感器的数据输出端口。
周期读取UART接收到的数据, 并显示出来。 这是光流模块销售网站给出UART数据协议。 数据帧的开头和结束为0xfe,0xaa。 中间是数据内容。 这是模块网站给出的数据内部结构。 根据数据协议,编写处理代码。
下面是MicroPython代码,每个100ms输出检测到的数据。 可以看到当光流传感器模块移动时,输出的x,y数据发生变化。
※ 实验总结 ※
这里对于光流传感器GL9306进行了初步的测试。它的具体应用有待之后做进一步的测试。
from machine import Pin,UART
import time
uart = UART(1, baudrate=19200)
print(uart)
inbuf = bytes([0]*7)
recebuf = b''
mx = 0
my = 0
squal = 0
while True:
if uart.any() > 0:
inb = uart.read(uart.any())
recebuf = recebuf + inb
buflen = len(recebuf)
delflag = 1
if buflen > 0:
id = 0
for b in recebuf:
if b == 254:
if buflen >= id+9:
mx = recebuf[id+2]
mx = mx*256 + recebuf[id+1]
my = recebuf[id+4]
my = my*256 + recebuf[id+3]
squal = recebuf[id+6]
else:
recebuf = recebuf[id:]
delflag = 0
break
id += 1
if delflag > 0: recebuf = b''
print(mx, my, squal)
time.sleep_ms(100)
边栏推荐
猜你喜欢
MySQL架构
MP4文件格式解析之结合实例分析
C number of words, plus ¥, longest word, average value
Anxinco EC series modules are connected to the multi protocol access products of onenet Internet of things open platform
Chisel tutorial - 03 Combinatorial logic in chisel (chisel3 cheat sheet is attached at the end)
Svn relocation
BSS 7230 航空内饰材料阻燃性能测试
Chisel tutorial - 04 Control flow in chisel
SAP HR family member information
SAP HR reward and punishment information export
随机推荐
What if once again forgets the login password of raspberry pie? And you don't have a monitor yet! Today, I would like to introduce a method
企业应用需求导向开发之人力部门,员工考勤记录和实发工资业务程序案例
P2141 [noip2014 popularization group] abacus mental arithmetic test
SAP HR 劳动合同信息 0016
ASP. Net core middleware request processing pipeline
Chisel tutorial - 02 Chisel environment configuration and implementation and testing of the first chisel module
SQL 使用in关键字查询多个字段
Markdown
SAP HR social work experience 0023
[summary] some panels and videos seen
【LeetCode】20、有效的括号
关于CH32库函数与STM32库函数的区别
AITM3.0005 烟雾毒性测试
webflux - webclient Connect reset by peer Error
Come on, brother
SAP HR reward and punishment information export
Arbre binaire équilibré [Arbre AVL] - Insérer et supprimer
Open source hardware small project: anxinco esp-c3f control ws2812
go time包常用函数
MP4文件格式解析之结合实例分析