当前位置:网站首页>Test the speed characteristics of optical flow sensor
Test the speed characteristics of optical flow sensor
2022-07-18 08:34:00 【Zhuoqing】

Jane Medium :
key word: Optical flow sensor , Output range
§01 light Flow sensor
One 、 Background introduction
stay Preliminary test of optical flow sensor :GL9306 The optical flow sensor is preliminarily tested . There is a question : Whether the sensor output is linear with the relative speed ? Is there an upper limit on the maximum measurement speed ?


Two 、 measuring method
1、 The test method
In order to test the above characteristics of optical flow sensor , Use a DC motor to drive a rotary table to rotate . Put it on the optical flow sensor to generate relative motion .



2、 DC motor
DC motor interface , With magnetic encoder output . Here are 6PIN Interface function definition .

Apply different DC voltages to the motor , The motor will rotate at different speeds function . This is the output waveform of the magnetic encoder after clicking . The frequency of speed pulse can be measured by multimeter .




Next, first measure the relationship between the motor voltage and the magnetic encoder . This is the measurement result , It can be seen that the relationship between voltage and speed is basically linear . After linear fitting , This linear relationship is :f=200*v-74.3


3、 ... and 、 Measure relative motion
Place the optical flow sensor in front of the rotating red heat insulation cotton , Distance about 5 Centimeter . application MicroPython The experimental board reads the output of the optical flow sensor . Program to display the output of optical flow sensor x,y The speed of movement in the direction . Because the rotary table is in circular motion , You can see x,y The component of motion in both directions .





Adjust the distance between the optical flow sensor and the rotating disc , You can see the change of the output value of the optical flow sensor . Although the rotating speed of the rotary table has not changed , But the change of distance changes the relative speed .


Increase the motor supply voltage , Increase the rotating speed of the turntable , You can see , The maximum output value of optical flow sensor shall not exceed 28. Especially when the speed is very high , The output value of the optical flow sensor obviously jumps .

※ total junction ※
One 、 Measurement procedures and data
Check the output numerical characteristics of the optical flow sensor through experiments . You can see that its output has the maximum value display , No more than 25, Because the speed of DC motor is It cannot be controlled accurately at low speed , Therefore, the output linear relationship has not been further verified .

1、 Measure the motor speed and pulse frequency
#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# TEST1.PY -- by Dr. ZhuoQing 2022-07-15
#
# Note:
#============================================================
from headm import *
from tsmodule.tsvisa import *
from tsmodule.tsstm32 import *
vdim = linspace(2, 7, 50)
fdim = []
for v in vdim:
dh1766volt(v)
time.sleep(2)
meter = meterval()
fdim.append(meter[0])
printff(v, meter)
tspsave('measure', vdim=vdim, fdim=fdim)
dh1766volt(0)
plt.plot(vdim, fdim)
plt.xlabel("Voltage(V)")
plt.ylabel("Frequency(Hz)")
plt.grid(True)
plt.tight_layout()
plt.show()
#------------------------------------------------------------
# END OF FILE : TEST1.PY
#============================================================
2、 Fit the linear relationship between motor and frequency
#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# DRAW1.PY -- by Dr. ZhuoQing 2022-07-15
#
# Note:
#============================================================
from headm import *
from scipy.optimize import curve_fit
vdim, fdim = tspload('measure', 'vdim', 'fdim')
def linefun(x, a, b):
return a*x + b
param = (1, 0)
param, conv = curve_fit(linefun, vdim, fdim, p0=param)
printf(param)
plt.plot(vdim, fdim)
plt.xlabel("Voltage(V)")
plt.ylabel("Frequency(Hz)")
plt.grid(True)
plt.tight_layout()
plt.show()
#------------------------------------------------------------
# END OF FILE : DRAW1.PY
#============================================================
3、 Motor voltage and frequency measurement data

4、Python Program
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
printcount = 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 == 0xfe:
if buflen >= id+9:
mx = recebuf[id+3]
mx = mx*256 + recebuf[id+2]
my = recebuf[id+5]
my = my*256 + recebuf[id+4]
squal = recebuf[id+7]
else:
recebuf = recebuf[id:]
delflag = 0
break
id += 1
if delflag > 0: recebuf = b''
time.sleep_ms(10)
printcount += 1
if printcount >= 10:
printcount = 0
print(mx, my, squal)
■ Links to related literature :
边栏推荐
- SQL杂谈
- 【每日一题】558. 四叉树交集
- 木马病毒清除方式
- VxWorks environment construction and learning
- The space dream of billionaires is killing the earth
- 在 SQL Server 中查找活动的 SQL 连接
- Des dizaines de milliards de données compressées à 600 go, tdengine est installé sur la plateforme mobile d'énergie de GCL
- Software architecture and design (VII) -- interactive architecture
- 嵌入式开发:提示和技巧——满足实时期限的7个技巧
- Refute 'all management without assessment is nonsense'
猜你喜欢

Torch in pytoch Argmax() function parsing

Qt(二)UI控件简介与 可选树状控件演示

5 practices of ITSM to ensure the agility of IT service desk

Tens of billions of data were compressed to 600gb, and tdengine was launched on GCL energy mobile energy platform

Li Mu hands on deep learning V2 target detection data set

Today, another chip IPO came out of Shenzhen Huaqiangbei

在 SQL Server 中查找活动的 SQL 连接

一文搞懂Go整合captcha实现验证码功能

A hot pot restaurant has collected three IPOs

如何从HoloLens中拍摄出满意的照片/视频
随机推荐
#夏日挑战赛# HarmonyOS 实现一个手绘板
嵌入式开发:提示和技巧——满足实时期限的7个技巧
go 语言学习笔记(1)
clickhouse 20.x 分布式表测试与chproxy的部署(二)
i. Mx6ull driver development | 30 - use EC20 4G network card (migrate gobinet driver)
A hot pot restaurant has collected three IPOs
OpenCV 教程 01:简介与安装,图片与视频的基本操作
VxWorks环境搭建与学习
利用蜜罐反制蓝队
R语言使用reshape2包的melt函数进行dataframe变形将dataframe数据从宽表变换为长表、dcast函数把melt函数处理后的数据、基于一个自定义公式(formula)从长表到宽表
傅立叶变换的物理意义
5 practices of ITSM to ensure the agility of IT service desk
Is it safe for Huatai Securities to open an account? How to open an account?
Consumer start flash back
但斌投资峰会:论资产管理的重要性!
在 SQL Server 中查找活动的 SQL 连接
Face beating
驳'一切不谈考核的管理都是扯淡'
Common methods of golang net network package
Common differences between MySQL and Oracle (I)