当前位置:网站首页>[small object velocimeter] only principle, no code
[small object velocimeter] only principle, no code
2022-07-24 06:39:00 【Like warm know cold】
Project source :Arduino ESP8266 Electromagnetic gun velocimeter &OLED Monitor

There are several problems in this project .
I don't know why the author quoted Adafruit_ssd1306syp This library .
- Not in the Arduino This library is found in the management Library .
- stay GitHub It seems that this library was found on , But it didn't say :ssd1306syp
- The introduction of this library locally led to byte is ambiguous error
- take Adafruit_ssd1306syp Change library to Adafruit_ssd1306 There is no error after the Library .
so , This project was not reproduced successfully according to the author's code , Don't do too much code analysis here .
principle

Have you ever played smart car ? There is a speed measurement module ! It's that thing . I found a picture of the speed measurement module ( Here's the picture )

When there is no object in the groove to block the light , The receiving pipe is connected ,G14\G13 Low level detected . When objects block the light , The receiving pipe is not conductive . here , I hope the single chip microcomputer can read the high level . so G14\G13 It should be set to Pull up input . Under this logic , Only when there is no light blocking object detected as low level , It is detected as high level when there is a light blocking object . That such , Transparent objects are not easy to detect .
How to judge the speed ? Because the object passes through two photoelectric switches in turn , Then there will be time delay . The speed can be obtained by the distance between the two photoelectric switches .
Set the distance between two photoelectric switches ( Center to center distance ) by L , The delay time is T , So speed V = L÷T .
because ESP32 for Arduino There is a function that can read subtle units of time :micros() . The relative time of two photoelectric switches can be recorded to calculate the speed .
To calculate more accurately , It is best to use interrupt function , And it should be set to trigger on the rising edge !
Because there are objects blocking G14/G13 The port will detect a high level , The instantaneous recording from low level to high level is more accurate .
It is also very simple to calculate the kinetic energy of an object , Just input the mass of the object . It's used anyway ESP8266 , Direct web input .
Kinetic energy : E = m×V×V×0.5
Then there is the specified specific kinetic energy 1.8 Joules per square centimeter ! Just divide the area ~
Code
Write a pseudo code to operate , Just write the calculation time 、 The speed part
ICACHE_RAM_ATTR void G13_InterFunction() // Interrupt function
{
G13time = micros();
G13flag = 1;
}
ICACHE_RAM_ATTR void G14_InterFunction()
{
G14time = micros();
G14flag = 1;
}
void setup()
{
attachInterrupt(G13, G13_InterFunction, RISING); // Rising edge trigger
attachInterrupt(G14, G14_InterFunction, RISING); // Rising edge trigger
}
void loop()
{
if(G13flag == 1 && G14flag == 1)
{
if(G13time>G14time)
time = G13time - G14time;
else
time = G14time - G13time;
G13flag = 0;
G14flag = 0;
}
} summary
According to the original author ESP8266 It's still frustrating to hear that the project code of version has not been reproduced ! But changing the code can be done .
I don't know what's wrong for the time being , See later !
Project information
Let's release the code later , Make sure why there is a problem .
Ah ah ah ! It's so sad to encounter setbacks !!!

边栏推荐
猜你喜欢

JSP tag

带你深入了解MySQL数据库扣减库存原理

Common commands and package management of go language

Login page + summary

Restful API introduction

深入了解MySQL 两把锁啥时候用(表锁,行锁)

Transition effect

Data set and pre training model

Explain the event cycle mechanism and differences between browser and node in detail

Sword finger offer jz10 Fibonacci sequence
随机推荐
DHCP principle and configuration
Disk management and file system
rsync(一):基本命令和用法
go语言的快速上手
Leetcode sword finger offer jz25 merges two sorted linked lists
Visibility:hidden and display:none
[award issuance] the results of the first essay solicitation activity in oneos zone were announced
API流程和代码结构
File system and log analysis
MySQL批量修改数据表编码及字符集为utf8mb4
FTP服务与实验
Experiment: disk quota operation
Leetcode sword finger offer jz23: the entry node of the link in the linked list
Process and planned task management
history命令历史记录中加时间
使用自定义zabbix包(4.0.5版本)安装agent和proxy
OpenSSL version upgrade
Restful API introduction
Write blog at leisure ~ briefly talk about let, VaR and Const
深入了解MySQL 两把锁啥时候用(表锁,行锁)