当前位置:网站首页>Vl6180x distance and light sensor hands-on experience
Vl6180x distance and light sensor hands-on experience
2022-06-30 00:58:00 【Programmer base camp】
This paper mainly introduces VL6180X distance 、 Some basic features of the light sensor module 、 Parameters and simple to use Demo, Newbie on the road , Lao Si Beware of rear end collision .
The chapters of the article are compiled in the following order :
VL6180X Out of the box experience
Overview of basic functions
Function introduction and description
Demo Hands on test
Conclusion
Reference material
VL6180X Out of the box experience
VL6180X It is a mini sensor module , This is what happens when you get it , Pictured 1 Shown :

chart 1. Unpacking drawing
There are two in the package , One of them has been demolished by me , The outer packaging adopts ST The usual packaging design of the evaluation board , So there are still Cordial . Take out the module and compare it with a dime , It is very short , Pictured 2 Shown :

chart 2. Module size comparison diagram
Even so , The module can still be further reduced , Look at the back and you can see ,VL6180X The power supply requirements of the chip are 2.8v, because This upper body is 3.3v->2.8v Step down circuit , If voltage conversion is not required , It can be broken from the middle row of small holes , incorrect , Yes break ... Overview of basic functions
Said so much nonsense , The reader may still be confused B: this TM What is it? ? To borrow ST Officially :The VL6180X is a proximity, gesture and ambient light sensor based on ST’s patented FlightSense technology. ordinary That is to say : This is a sensor , It can detect distance and light intensity , There are even gestures .
So its basic characteristics are as follows :
1. Distance measurement , Three range options are available :
a. range :20CM, precision :1MM ;
b. range :40CM, precision :2MM;
c. range :60CM, precision :3MM;
2. Ambient light measurement , A variety of sampling gain and measurement range adjustment ;
3. Surround filter , Filter out measurement errors caused by strong reflection objects ;
4. Offset calibration , Ensure the accuracy of the equipment in different environments .
5. Crosstalk compensation , Use cover glass to further improve the accuracy of distance detection ;
6. Three sampling methods :
a. Single distance measurement under polling
b. Single distance measurement without polling
c. Continuous distance measurement under hardware interruption
Function introduction and description
Typical distance output characteristics
In theory ,VL6180X The output value of should be linear with the distance between the target objects , But in fact, it is not maozi . In the dark In the dark , test VL6180X Distance from objects with different reflectance , The output comparison relationship between the real distance and the actual measured distance is shown in the figure 3
Shown :

chart 3. Compare the original measured value with the actual value
From the picture 3 In the clear , There is an offset error in the actual output of the measured data , And the data jitter is severe , The offset error can be calibrated by offset To fix . In order to further improve VL6180X The output accuracy and stability , Officials recommend using cover glasses to increase crosstalk signals , And in it After that, crosstalk compensation is performed to correct the distance error caused by the cover glass . Pictured 4 Shown : After using cover glass and making crosstalk compensation correction , real The error between the distance and the actual measured distance is reduced, and the stability is further enhanced .

chart 4. The measured value after crosstalk compensation is compared with the actual distance
Capture convergence time
It should be noted that ,VL6180X The time required to calculate the distance from an object is not fixed , It is related to measuring distance and purpose The light reflectance of the target object . Pictured 5 Shown : stay 10MM Inside , The distance value measured by the module is meaningless , The conversion time is also Long ; And when the measuring distance gradually increases , The time spent is also increasing , The lower the reflectivity , The longer it takes .

chart 5. The relationship between convergence time and measurement distance and object reflectivity
Because the convergence time is related to the reflectivity of the object and the actual distance of the non-standard object , Therefore, a simple convergence estimate can be used (Early convergence estimate, ECE) To reduce the power consumption of the module . for example , Judge 0.5ms Inside VL6180X The feedback signal received by the module Count , When it is below an ideal threshold , It can be deemed to be within the set range , No valid objects are detected around , So you can stop taking To save power consumption , Pictured 6 Shown . conversely , When the number of feedback signals received is higher than the set ideal threshold , The system starts the test The amount , under these circumstances , Only highly reflective metal objects are close to VL6180X When the module , The system will start to work , The power consumption is reduced The effect of , Pictured 7 Shown .

chart 6. Threshold setting when there is no target in the range

chart 7. Threshold setting for detecting metal objects
Ambient light sensor mode
VL6180X The module can measure the received ambient light in a fairly wide range , The principle of measurement is to calculate the unit time (100ms) The amount of light received by the inner light hole , As for why 100ms, Because most apps are set up like this ( Um. , The manual says Of ). therefore , To measure different light intensities , It is recommended to set the measuring range of the module , Instead of modifying the sampling time .
In addition, the actual amount of light received by the module will be affected by the angle of the optical hole of the module , Pictured 8 Shown : The optimum range of the light quantity received by the module is Inside the cone , Beyond this cone , The measured actual value will also be greatly affected , The overall value also presents the effect of a normal distribution .

chart 8. Schematic diagram of optical hole position and receiving angle
For offset calibration and crosstalk compensation methods , I won't go into too much detail here , Always keep in mind that this is a measurement , This is the evaluation , It's not a tutorial , Stop .
Demo Hands on test
The test is VL6180X The actual measurement results , Use here STM32F0308-Discovery The development board drives the module , Pictured 9 Shown :

chart 9. Evaluation board test preparation
After selecting the board and connecting the line , First, we need to build a new project , So you need to ST Download from the official website STM32F0308-Discovery Soft Piece support package en.stm32cubef0.zip And VL6180X Software support package for modules ja.STSW-IMG003. To speed up the test efficiency , Can directly hold STM32F0308-Discovery Of I2C The routine is moved over and modified , This eliminates the need to configure the environment from scratch .
After the first step, you will VL6180X The relevant files in the software support package are imported into the project , The files we need to add here are shown in the figure 10 Shown :

chart 10. Engineering document structure
among vl6180x_app.x、vl6180x_i2c.x And vl6180x_gpio.x Is an extra new file created , These files are platform related , For different processors , Corresponding migration modification is required . After adding the corresponding file , Reconfigure the project header file path , After completion The project is shown in the figure xx Shown :
The next thing to do is transplant vl6180x To f0308 platform , This is also the main work in the test process , The process of describing code is always aware of It must be a painful thing , To put it simply , Namely :1. According to the routine, I modified it I2C The underlying driver code and pin configuration Set some code ;2. An extra... Has been added vl6180x_app.c file , Used to implement 4 Small demo Some printing information functions and modules in Block initialization function . Interested students can directly access my code base to get the project : test Demo URL
After finishing the above work , compile - burning - debugging - Print , The printed results of the distance test are as follows :

chart 11. Distance test print
In the figure 11 During the test , The sensor is covered by hand when the system is powered on , Returns an error 6, Indicates that no valid object has been detected ( too near ); Then take your hands away slowly , Return with error 11、13、16, It indicates that the module does not recognize valid objects or there are too many targets in the range ( too far ). More error details can be found in the module user manual .

chart 12. Light intensity test print
In the figure 12 From the test of , After the system is powered on, the ambient light intensity is detected , The detection value drops immediately after covering with hands , Modular The light intensity decreases .
Conclusion
VL6180X It's a professional 、 Precise sensor module , Whether it is distance detection or ambient light detection , It is stable 、 Reliability is far more Higher than ordinary ultrasonic module and optical sensor ). therefore , It is also more difficult than the general sensor module . interested , The reader does not Why don't you come back and study , Used in your own toy car 、 Aircraft and other intelligent hardware fields are also excellent .
Reference material
The compilation of this article mainly refers to the following relevant documents :
1. 《VL6180X-SATEL》: Product description
2. 《UM1983 User manual》: User's Manual
3. 《VL6180X》: Data manual
4. 《VL6180X API Integration Guide》:API Programming manual
And refer to the following software resources :
1. ja.STSW-IMG003 : VL6180X Software support package
2. en.stm32cubef0.zip:STM32F0308-Discovery Software support package
- STM32 SCM Chinese official website
- STM32 SCM official development tools
边栏推荐
- 外包干了三年,废的一踏糊涂...
- 在线文本数字识别列表求和工具
- 测试用例设计方法之等价类划分方法
- 练习副“产品”:自制七彩提示字符串展示工具(for循环、if条件判断)
- 如何在IDEA中自定义模板、快速生成完整的代码?
- Traffic, but no sales? 6 steps to increase website sales
- Good test / development programmers vs. average programmers
- 解决choice金融终端Excel/Wps插件修复visual basic异常
- [proteus simulation] 8-bit port detection 8 independent keys
- SFDP super form development platform v6.0.4 was officially released
猜你喜欢

Too voluminous ~ eight part essay, the strongest king of interview!

字节面试惨遭滑铁卢:一面就被吊打,幸得华为内推,三面拿到offer

快手伸手“供给侧”,找到直播电商的“源头活水”?

太卷了~ 八股文,面试最强王者!

【Games101】Transformation

岁月不饶人

Equivalence class partition method for test case design method

【云原生】容器场景下的内核安全

Practical application of information security

2022 6 月25 日交易总结
随机推荐
Text classification using huggingface
Shell spec date format
Mr. Hu Bo, CIO of weiduomei, a scientific innovator: digitalization is a bloodless revolution, and the correct answer lies in the field of business
I / o initial et son fonctionnement de base
Visual Studio 2017 无法打开包括文件: “QOpenGLFunctions_3_3_Core”: No such file or directory
Visual studio 2017 cannot open the include file: 'qopenglfunctions_3_3_core': no such file or directory
【Spark】scala基础操作(持续更新)
[concurrent programming] if you use channel to solve concurrency problems?
在线文本数字识别列表求和工具
A Si's mood swings
[spark] basic Scala operations (continuous update)
如何在IDEA中自定義模板、快速生成完整的代碼?
Distributed task scheduling elasticjob demo
数据中台咋就从“小甜甜”变成了“牛夫人”?
How to customize templates and quickly generate complete code in idea?
VIM editor common instructions
Good test / development programmers vs. average programmers
Netease cloud music beta music social app "mus" matches friends of the same frequency through music
Quick Pow: 如何快速求幂
PHP wechat merchant transfer to change initiating merchant transfer API