当前位置:网站首页>光流传感器初步测试: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)
边栏推荐
- BSS 7230 flame retardant performance test of aviation interior materials
- 网上买基金安全么?
- 【7.5】15. Sum of three numbers
- c—线性表
- C method question 2
- 受限线性表
- Right click the idea file to create new. There is no solution to create new servlet
- 【汇总】看过的一些Panel与视频
- codeforces每日5题(均1500)-第八天
- 507 field D - extraterrestrial relics
猜你喜欢
![[stm32+esp8266 connect Tencent cloud IOT development platform 2] stm32+esp8266-01s connect Tencent cloud](/img/78/3cc67a28872ff4d465484cbaee2f6e.jpg)
[stm32+esp8266 connect Tencent cloud IOT development platform 2] stm32+esp8266-01s connect Tencent cloud

Chisel tutorial - 04 Control flow in chisel

Pycharm basic settings latest version 2022
![[experiment sharing] log in to Cisco devices through the console port](/img/e4/fc72ed57de74a0dd51c484a1c2f348.png)
[experiment sharing] log in to Cisco devices through the console port

SAP HR social work experience 0023

Anxinco EC series modules are connected to the multi protocol access products of onenet Internet of things open platform

Map operation execution process

HB 5469 combustion test method for non-metallic materials in civil aircraft cabin

The file format and extension of XLS do not match

Wechat applet development beginner 1
随机推荐
Pycharm basic settings latest version 2022
Ora-01741 and ora-01704
数据库面试题+解析
SAP HR family member information
[stm32+esp8266 connect Tencent cloud IOT development platform 2] stm32+esp8266-01s connect Tencent cloud
C - Fibonacci sequence again
Boost regex library source code compilation
P5594 [xr-4] simulation match
ASP. Net query implementation
Gorm Association summary
ESP at installation esp8266 and esp32 versions
The file format and extension of XLS do not match
BSS 7230 航空内饰材料阻燃性能测试
Wechat applet development beginner 1
通达信买基金安全吗?
Anxin vb01 offline voice module access intelligent curtain guidance
Anxin can internally test offline voice module vb-01 to communicate with esp-c3-12f
Interface
一键免费翻译300多页的pdf文档
MongoDB快速入门