当前位置:网站首页>测试光流传感器速度特性
测试光流传感器速度特性
2022-07-15 17:52:00 【卓晴】

简 介:
关键词:光流传感器,输出范围
§01光流传感器
一、背景介绍
在光流传感器初步测试:GL9306中对于光流传感器进行了初步测试。有一个问题: 传感器输出与相对速度之间是否是线性? 最大的测量速度是否有上限?


二、测量方法
1、测试方法
为了测试光流传感器上述特性, 使用一个直流电机带动一个转盘转动。 放在光流传感器上面产生相对运动。



2、直流电机
直流电机接口, 具有磁编码器输出。 这里给出了6PIN接口功能定义。

给电机施加不同直流电压, 电机就会以不同的转速 运行。 这是点击后面的磁编码器的输出波形。 速度脉冲的频率可以通过万用表测量得到。




下面首先测量一下电机电压与磁编码器之间的关系。 这是测量结果, 可以看到电压与速度之间基本上是线性关系。 经过线性拟合,这个线性关系为:f=200*v-74.3


三、测量相对运动
将光流传感器放置在旋转红色隔热棉前面, 距离大约 5 个厘米。 应用 MicroPython 实验板读取光流传感器的输出。 编程显示光流传感器输出的x,y方向的移动速度。 由于转盘是圆周运动, 可以看到x,y两个方向上面的运动分量。





调整光流传感器与旋转盘的距离,可以看到光流传感器输出数值的变化。 虽然转盘转速没有变,但距离的变化使得相对运动速度发生了改变。


增加电机供电电压,提高转盘旋转速度,可以看到,光流传感器输出的最大值不超过28。特别是速度很高的时候,光流传感器输出的数值明显出现跳动。

※ 总结 ※
一、测量程序和数据
通过实验检查光流传感器输出数值特性。 可以看到它的输出有最大值显示, 不超过25, 由于直流电机转速在 低速下无法精确控制, 所以输出线性关系就没有进一步验证了。

1、测量电机转速与脉冲频率
#!/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、拟合电机与频率线性关系
#!/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、电机电压与频率测量数据

4、Python 程序
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)
■ 相关文献链接:
边栏推荐
- Li Mu hands on deep learning V2 anchor box and code implementation in target detection
- Matlab: usage of split dataset spliteachlabel()
- Unity IoTAR物联网增强现实教程
- 676.实现一个魔法字典·前缀树
- Blue whale configuration framework
- Matlab:搭建神经网络
- (shangsilicon Valley) JDBC general review
- Lifecycle: the foundation of lifecycle aware components - jetpack series (1)
- CTSI 基金会储备透明度报告——2022 年 7 月
- Opengauss cooperates with industry innovation to build a root community of open source databases
猜你喜欢

竞赛·6116·计算布尔二叉树的值·递归
![[detailed tutorial] a thorough article on mongodb aggregation query](/img/31/e0b7267edd4026ddb73773c9e1bbd0.png)
[detailed tutorial] a thorough article on mongodb aggregation query

软件架构与设计(四)-----数据流架构

Advanced testers must see: basic knowledge of automated testing

The space dream of billionaires is killing the earth

GeoServer complete tutorial

Blue whale configuration framework

Handwriting recognition in MATLAB deep learning practice (including detailed notes)

394.字符串解码·栈

One question per day · 1252 Number of odd cells · simulation optimization
随机推荐
What security risks need to be considered in cloud platforms and infrastructure
Today, another chip IPO came out of Shenzhen Huaqiangbei
307·区域和检索-数组可修改
Advanced testers must see: basic knowledge of automated testing
Difference between shape parameter and scale parameter in probability density function
347. The first k high-frequency elements Structure array sorting
【无标题】慢 SQL 分析与优化
Li Mu hands on deep learning V2 anchor box and code implementation in target detection
8254 定时/计数器应用实验
How to set the allure test report
Compétition · 6116 · calcul de la valeur de l'arbre binaire booléen · récursion
Des dizaines de milliards de données compressées à 600 go, tdengine est installé sur la plateforme mobile d'énergie de GCL
软件架构与设计(一)-----关键原则
347.前K个高频元素.结构体数组排序
fftshift有什么用?MATLAB做FFT后为什么还要fftshift?
Face beating
Opengauss cooperates with industry innovation to build a root community of open source databases
Matlab:图像增强 imageDataAugmenter() 的用法
Analysis of risks related to cloud infrastructure and corresponding defense measures
Matlab:交换矩阵的两行(列)