当前位置:网站首页>光流传感器初步测试: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)
边栏推荐
- webflux - webclient Connect reset by peer Error
- C simple question one
- Progress broadcast | all 29 shield machines of Guangzhou Metro Line 7 have been launched
- [summary] some panels and videos seen
- Reverse output three digit and arithmetic sequence
- Installing gradle
- redis缓存工具类,值得拥有~
- [stm32+esp8266 connect Tencent cloud IOT development platform 2] stm32+esp8266-01s connect Tencent cloud
- C - linear table
- 正畸注意事项(持续更新中)
猜你喜欢

Right click the idea file to create new. There is no solution to create new servlet

保证接口数据安全的10种方案

How did a fake offer steal $540million from "axie infinity"?

C cat and dog

Chisel tutorial - 03 Combinatorial logic in chisel (chisel3 cheat sheet is attached at the end)

Svn relocation

DataGuard active / standby cleanup archive settings

Benchmarking Detection Transfer Learning with Vision Transformers(2021-11)

SAP HR 社会工作经历 0023

SAP HR奖罚信息导出
随机推荐
@Configuration注解的详细介绍
C # exchange number, judge to pass the exam
The file format and extension of XLS do not match
Anxinco esp32-a1s development board is adapted to Baidu dueros routine to realize online voice function
postgis学习
C number of words, plus ¥, longest word, average value
Chisel tutorial - 01 Introduction to Scala
【7.4】25. K 个一组翻转链表
postgres timestamp转人眼时间字符串或者毫秒值
go time包常用函数
SAP 内存参数调优过程
Pycharm essential plug-in, change the background (self use, continuous update) | CSDN creation punch in
mysql8.0 ubuntu20.4
2022 certified surveyors are still at a loss when preparing for the exam? Teach you how to take the exam hand in hand?
Extract the file name under the folder under win
C - linear table
An example analysis of MP4 file format parsing
C language greedy snake
2022.7.7-----leetcode.648
c—线性表