当前位置:网站首页>光流传感器初步测试: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)
边栏推荐
- The for loop realizes 1-100 addition and eliminates the 4-digit tail number
- An example analysis of MP4 file format parsing
- 神奇快速幂
- Come on, brother
- Pycharm basic settings latest version 2022
- P1308 [noip2011 popularity group] count the number of words
- SAP HR 社会工作经历 0023
- 【7.4】25. K 个一组翻转链表
- C inheritance and interface design polymorphism
- Codeworks 5 questions per day (average 1500) - day 8
猜你喜欢

FFA与ICGA造影

C number of words, plus ¥, longest word, average value

MySQL架构

C simple question one

UIC564-2 附录4 –阻燃防火测试:火焰的扩散
![Arbre binaire équilibré [Arbre AVL] - Insérer et supprimer](/img/1f/cd38b7c6f00f2b3e85d4560181a9d2.png)
Arbre binaire équilibré [Arbre AVL] - Insérer et supprimer

Chisel tutorial - 04 Control flow in chisel

Get started with mongodb

平衡二叉树【AVL树】——插入、删除
![P1067 [noip2009 popularity group] polynomial output (difficult, pit)](/img/1f/a798879a0d65eccefa339b288f2102.jpg)
P1067 [noip2009 popularity group] polynomial output (difficult, pit)
随机推荐
【7.4】25. K 个一组翻转链表
Wechat applet development beginner 1
aws-aws help报错
2022 certified surveyors are still at a loss when preparing for the exam? Teach you how to take the exam hand in hand?
MySQL架构
redis缓存工具类,值得拥有~
Possible SQL for Oracle table lookup information
0-1 knapsack problem
【7.5】15. 三数之和
An example analysis of MP4 file format parsing
Idea automatically generates serialVersionUID
SQL 使用in关键字查询多个字段
Stringutils tool class
[untitled]
Anxinco EC series modules are connected to the multi protocol access products of onenet Internet of things open platform
MP4文件格式解析之结合实例分析
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
507 field D - extraterrestrial relics
0-1背包问题
Class C design questions