当前位置:网站首页>Preliminary test of optical flow sensor: gl9306
Preliminary test of optical flow sensor: gl9306
2022-07-07 23:51:00 【Zhuoqing】
§01GL9306 Optical flow sensor
One 、 Background introduction
According to the national college student smart car competition , Intelligent vision group students ask , Whether optical flow sensor can be used GL9306. In order to get familiar with the characteristics of this sensor , Bought a sensor on Taobao for testing . Now let's test the characteristics of this sensor .
Two 、 Device characteristics
1、 Device interface
The interface of the device is relatively simple ; The three interface pins are defined as : VDD、GND、 as well as UARG. For serial port data output signal , The data communication format is given on the website page . The baud rate of communication is 19200, The frame rate of output data is 66H Group , The data represents the moving distance of the module . When the distance is very small , Output is 0.
2、 Interface modification
In order to test the module data on the bread board , Next, the module interface is transformed into 100mil Spacing joints . Add heat shrinkable tubes after welding . This is the sensor after the interface modification .
3、 ... and 、 Device test
1、 Power on and observe the interface signal
Next, connect the sensor to the bread board , Apply 3.3V Working voltage of . The steady-state working current of the device is about 20mA. Use an oscilloscope to observe UART Output pin signal . You can see that the pin has data output . Specific data need to be discriminated by computer . This is the period between each data frame , It's about 38ms, The corresponding data frame rate is 26.3Hz.
2、 Reading data
In order to read the output data of the optical flow sensor , It's used here MM32F3277 MicroPython Experiment board . Use one of the UART(1), Occupied PA3(RXD),PA2(TXD), The initialization baud rate is 19200, Connect the module to the data output port of the optical flow sensor .
Cycle read UART Received data , And show it . This is the optical flow module sales website UART Data protocol . The beginning and end of the data frame are 0xfe,0xaa. In the middle is the data content . This is the data internal structure given by the module website . According to the data protocol , Write processing code .
Here is MicroPython Code , Every 100ms Output the detected data . It can be seen that when the optical flow sensor module moves , Output x,y Data changes .
※ real Test summary ※
this For optical flow sensor GL9306 A preliminary test was carried out . Its specific application needs to be further tested later .
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)
边栏推荐
- 光流传感器初步测试:GL9306
- BSS 7230 flame retardant performance test of aviation interior materials
- 2022.7.7-----leetcode.648
- 蓝桥ROS中使用fishros一键安装
- @Detailed introduction of configuration annotation
- 关于CH32库函数与STM32库函数的区别
- ASP. Net query implementation
- DataGuard active / standby cleanup archive settings
- 数据库面试题+解析
- P1055 [noip2008 popularization group] ISBN number
猜你喜欢
Uic564-2 Appendix 4 - flame retardant fire test: flame diffusion
Binary sort tree [BST] - create, find, delete, output
SAP HR labor contract information 0016
At the age of 35, I made a decision to face unemployment
C - linear table
蓝桥ROS中使用fishros一键安装
数据湖(十五):Spark与Iceberg整合写操作
PostGIS learning
MP4文件格式解析之结合实例分析
【路径规划】使用垂距限值法与贝塞尔优化A星路径
随机推荐
自动化测试:Robot FrameWork框架90%的人都想知道的实用技巧
gorm 关联关系小结
95.(cesium篇)cesium动态单体化-3D建筑物(楼栋)
Basic learning of SQL Server -- creating databases and tables with the mouse
Balanced binary tree [AVL tree] - insert, delete
Data Lake (XV): spark and iceberg integrate write operations
保证接口数据安全的10种方案
Navicat connects Oracle
Chisel tutorial - 03 Combinatorial logic in chisel (chisel3 cheat sheet is attached at the end)
Pigsty: out of the box database distribution
go time包常用函数
受限线性表
c—线性表
P5594 [xr-4] simulation match
ASP. Net query implementation
Come on, brother
Codeworks 5 questions per day (average 1500) - day 8
串联二极管,提高耐压
数据库面试题+解析
关于CH32库函数与STM32库函数的区别