概述, M9 p( q) e6 d
VL6180X是基于ST FlightSense™专利技术的最新产品。这是一个突破性的技术,实现了独立于目标反射率的绝对距离测量。现有技术通过测量反射光的光量来估算距离,这种方法的最大缺点是被测物体的颜色和表面对测量精度影响很大,而VL6180X则精确测量光线从传感器照射到最近物体然后反射到传感器所用时间(飞行时间),以此计算两者之间的距离。# o/ z8 b' a3 v- ]9 p/ |, b$ C% D
VL6180X将一个红外发射器,一个红外传感器和一个环境光传感器整合于一个三合一即用型回流焊封装,易于集成,为终端产品制造商缩短了光学和机械设计优化过程并降低了相应的成本。9 i4 i; N4 E/ ]# |5 m, T
该模块为低功率操作设计。测距和ALS测量可在用户定义的时间间隔自动执行。支持多门限和中断方案以尽量减少主机操作。. _+ d. ~; a- f! w4 [, B0 w
主机控制和结果阅读通过使用I2C接口执行。可选的附加功能(如测量准备和门限中断)由两个可编程的GPIO引脚提供。2 {: p3 a1 ~0 m" D9 j# c
2 b& k8 b% @) q
+ H7 i) S1 C3 \0 @. R% R/ j
) h, v9 S+ f: q3 @7 e& _# k0 c# H( A
所有功能$ I3 N' ^# E5 ^% d) u; v4 W. H: \
三合一智能光学模块
; n8 H3 h6 ^: H5 e' r; f接近传感器
, ?* D0 R; { c: h% w9 U环境光传感器
+ ~+ n, q( d$ T6 F; I; s, JVCSEL光源" e4 D; h6 m0 h- \ y
快速,精确测距. a, A, p5 K; N# q
绝对测量范围从0到超过10 cm(10cm以上的测距取决于具体情况)' _. r+ g5 a; J& P: o
不受目标反射率影响- f( ]) t1 {0 y' {, t
环境光抑制5 l# M2 [; |5 j, A
盖片的串扰补偿
1 J, U$ n% b5 G8 w' `, c3 _( j. W$ {6 r% m7 S l1 ^
盖片的串扰补偿
W0 |# q; X% W( z1 ]+ |. L9 ^% g主机系统可以用距离和信号电平实现手势识别3 q- ~! T- f n$ _) f B. o
可用演示系统:P-NUCLEO-6180X1 评估板$ [( v5 u6 J7 W4 f2 j
8 `' @0 M' h( }" E4 G" n- m9 r环境光传感器0 k0 d, M1 T4 D
高动态范围
: P' c, s) a1 ]精确/超低光敏感5 H2 k9 N% z5 ^0 |! [
校准输出值(以勒克斯为单位)2 G: O. ? |7 g0 ?% \/ y1 @/ J
0 ?/ P% g6 O5 r方便集成
& ^# P5 N/ i: |# p" W! y单回流焊元件
$ n* Y& J* Q p9 j) o# [# @ B6 A无附加光学元件
/ n5 R$ Q5 x: ^( t/ J) N2 ^单电源
2 `/ u% a4 {5 f/ S: ^9 n$ R# p! G+ C用于器件控制和数据的I2C接口" K, C" ?7 L/ r1 W' \1 b4 i$ o
提供一个文档化的C可移植 API(应用程序接口)' r* W6 G9 N& r3 h, I/ |9 G
2 P' K1 s* Z+ Q. x
两个可编程GPIO
& Z# Z+ Q1 a# V测距和ALS的窗口和门限功能
2 b, i( j' e) R" W& \2 k
& M; V" o8 \( @7 j
) B) s4 a6 N: G) U' s! m# @ t
( k* a- R2 ?$ l/ Y8 x技术规范, I" z& M( V/ q2 x
注意供电为2.8V,IIC接口,最大支持快速模式速率,为400k,默认地址为0x29。
d/ U( v' H+ d2 V光照强度检测范围为 1 Lux -100 kLux。" h _* [2 {9 h* F( R
- z( T. j- ~! w t0 f
* c! e7 G) ]. [- d. D/ D
3 y& e' p3 O) o& ^: y }: [
1 B2 U. P5 g( u8 o& y+ I接口
7 m# ^3 i, B2 r6 o: Q, C1 P W3 [8 f4 P6 A6 e7 B
2 T3 W6 W- @) F, r* |4 K& r( g8 v, ^9 A7 a; J! D4 Y1 S% Q0 X
+ R+ T* ]$ {, f- ? t
接口说明
; R2 x/ l0 r. h# E& ^3 _' l/ k' K( l; Q8 z$ ]! a
b9 M4 L7 Y6 b2 F% V- r
( _5 l: Y( ?7 l# G* F, W. C' ~5 _2 @& J, x# t
最小系统图
. X2 Y: w; o) s" _
' I: x2 ]( `$ ?6 g0 S
+ C/ Z# Q2 U- m
$ s" B( C4 m! u3 l) D/ U# w
/ r* D7 e4 P) v! t4 P
初始化( n6 p/ Q( D ?: s" \
% s$ c4 s Y) n' p2 ~
) Q% a# R( f8 z8 g
2 @6 N; z! C2 q" V3 @5 F! H首先需要检查寄存器SYSTEM__FRESH_OUT_OF_RESET {0x16}是否为0x01.
; Z$ Q3 b3 |3 C$ y7 i# l之后进行6180初始化。
+ n, Y+ R+ `# c! i初始化如下所示。% K1 W2 X& ]3 l$ P% F& Y+ r
6 {7 C; X# g4 ?4 t2 R3 i
7 [4 @4 R( F! {7 f1 c! E6 d" e4 ], ` T
5 R/ q8 t }& X( ~, |9 ~' H8 m* ]+ a
5 W6 ?7 x+ [8 _2 R: w
- uint8_t ptp_offset;$ |1 v h; K4 G2 Q' I8 Q& e+ G
- uint8_t VL6180X_Init(uint8_t add)
0 p2 Y- n+ S2 b0 h - {
1 c" i" F) J3 d3 C* [7 C - ptp_offset=VL6180X_ReadByte(add,VL6180X_REG_SYSTEM_FRESH_OUT_OF_RESET);
7 O9 T. ]! B) \1 z, x - printf("ptp_offset=%d\n",ptp_offset);" F) W5 Z8 K# g" A6 D; ^
- // if(VL6180X_Read_ID(add) == VL6180X_DEFAULT_ID)1 m! m: J3 I. a7 q
- if(ptp_offset==0x01)
7 O1 W1 ?( q9 T# y9 @; B6 f - {
' E/ R+ ~: k7 N d, W - VL6180X_WriteByte(add,0x0207, 0x01);0 s4 q Z+ e4 m
- VL6180X_WriteByte(add,0x0208, 0x01);+ u; [# |( O2 n
- VL6180X_WriteByte(add,0x0096, 0x00);- {1 a, V3 [2 _6 A2 z, q) s+ n$ p
- VL6180X_WriteByte(add,0x0097, 0xfd);/ y) ?& S) {5 d
- VL6180X_WriteByte(add,0x00e3, 0x00);
! {1 f( a3 H0 d3 F$ v - VL6180X_WriteByte(add,0x00e4, 0x04);: o" e6 q. S6 H' t" Y
- VL6180X_WriteByte(add,0x00e5, 0x02);
2 k1 A( z3 O9 ]- Y4 w, t( y - VL6180X_WriteByte(add,0x00e6, 0x01);; i$ H3 S) G" ~- A# b$ t6 l, j2 q
- VL6180X_WriteByte(add,0x00e7, 0x03);2 j: R; m+ W b7 b6 I
- VL6180X_WriteByte(add,0x00f5, 0x02);) h4 b' v7 n' b' S
- VL6180X_WriteByte(add,0x00d9, 0x05);. m. [! C% W' R5 ?2 C9 _: J5 o( H7 N
- VL6180X_WriteByte(add,0x00db, 0xce);
5 \6 H4 P( T, t* m - VL6180X_WriteByte(add,0x00dc, 0x03);7 b& k0 r) j _$ W$ }6 H
- VL6180X_WriteByte(add,0x00dd, 0xf8);
% J# k. N1 g9 G/ A - VL6180X_WriteByte(add,0x009f, 0x00);. q# R; U1 f" o; |8 Z- A
- VL6180X_WriteByte(add,0x00a3, 0x3c);
* C0 S3 ~5 `/ f, Y$ S' W3 g1 r - VL6180X_WriteByte(add,0x00b7, 0x00);& U' i$ t5 ?6 u* k9 g
- VL6180X_WriteByte(add,0x00bb, 0x3c);
B# `: y. R1 L, v% J" k) d - VL6180X_WriteByte(add,0x00b2, 0x09);! B! V p! K3 Z$ k
- VL6180X_WriteByte(add,0x00ca, 0x09);# Y) M+ G* u% X* F
- VL6180X_WriteByte(add,0x0198, 0x01);
, w j; G1 `) p2 o& k* n3 E - VL6180X_WriteByte(add,0x01b0, 0x17); W4 @3 U+ y1 V" A5 {5 V
- VL6180X_WriteByte(add,0x01ad, 0x00);
" ^: e; t8 p; Z# d' j - VL6180X_WriteByte(add,0x00ff, 0x05);+ S) ^ t1 _9 j. S0 g5 z# r
- VL6180X_WriteByte(add,0x0100, 0x05);, R' _% R. M8 O& n- U' K
- VL6180X_WriteByte(add,0x0199, 0x05);
# |# t5 i. g, B - VL6180X_WriteByte(add,0x01a6, 0x1b);3 a" O0 l4 `. j- z9 O; c
- VL6180X_WriteByte(add,0x01ac, 0x3e);- p; `: R$ Z9 f/ k' h
- VL6180X_WriteByte(add,0x01a7, 0x1f);; I! E& R! E* N) Z d6 u3 O
- VL6180X_WriteByte(add,0x0030, 0x00);% h! e+ N0 M- E5 w3 G$ z
- 2 m1 Q4 Q l% |9 |$ o4 _& T
- // Recommended : Public registers - See data sheet for more detail0 W6 P9 _$ s4 A0 C" F |0 W. C
- VL6180X_WriteByte(add,0x0011, 0x10); // Enables polling for 'New Sample ready'# Y5 g" w3 p8 \# ?/ Z2 t, R/ N. N
- // when measurement completes
, ?" o& O, _* N) N: T - VL6180X_WriteByte(add,0x010a, 0x30); // Set the averaging sample period
- k4 p( Z. N! A! t9 m/ ~& P - // (compromise between lower noise and* p9 E) }( Y' ^" Q! n* r) x
- // increased execution time)
' B; @( ?, @5 a- X5 W - VL6180X_WriteByte(add,0x003f, 0x46); // Sets the light and dark gain (upper
3 ~" D( g& g, n9 {4 m! s - // nibble). Dark gain should not be5 g* V7 {& T2 L+ x: \
- // changed. !上半字节要写入0x4 默认增益是1.0
( H8 G! T8 d/ w7 c, j5 \7 ^4 y# d - VL6180X_WriteByte(add,0x0031, 0xFF); // sets the # of range measurements after
/ W& J7 V( k- C6 m# O - // which auto calibration of system is
; f0 G. o4 Z5 k$ T1 q$ X3 X - // performed# {, S3 n& T' F- X6 D/ E
- VL6180X_WriteByte(add,0x0041, 0x63); // Set ALS integration time to 100ms
c G) N. i- f5 @, Z; e - VL6180X_WriteByte(add,0x002e, 0x01); // perform a single temperature calibration
5 G. u- O9 e5 J$ r" ] - // of the ranging sensor
8 K8 z4 i3 b8 w9 n7 P' R9 c - + e2 _, Y0 e" m" u9 z: `
- // Optional: Public registers - See data sheet for more detail( H" |* Y3 M. T" X% N8 {3 N( |
- VL6180X_WriteByte(add,0x001b, 0x09); //测量间隔 轮询模式
6 s9 \8 Q% I6 T. d7 x1 G - // period to 100ms 每步10ms->0-10ms
7 N6 F) S7 e6 v' }6 r+ \( e( h+ q, | - VL6180X_WriteByte(add,0x003e, 0x31); //测量周期 ALS模式, Q) ]/ V4 \% D7 c7 d5 W
- // to 500ms
q5 a3 H# `0 d4 t+ h" }. R* U - VL6180X_WriteByte(add,0x0014, 0x24); // Configures interrupt on 'New Sample
" Q4 P4 d! Q# w. C9 c - // Ready threshold event'4 D3 `0 h$ C" |& v3 j0 P
1 y! n8 G3 R0 V1 N4 {4 M
. a% @7 U+ |1 u. E. s, Q- //VL6180X_WriteByte(add,VL6180X_REG_SYSTEM_FRESH_OUT_OF_RESET, 0x00); //不发送00那么读出来的数值就是01
' ^" } j; H4 i! ]
# B# n C1 A, G4 O( |; W" E# E- return 0;
: X1 v* x9 m$ B - }
3 o$ v) i6 p- D5 r2 i. w - else return 1;
- |8 J' \4 F! [; m - }2 D. G% z2 e' C- x
复制代码 % r* U8 D, Z$ |8 E- q
————————————————
& E o8 g4 R# M* \# Z版权声明:记帖
* E0 R+ @% @; g
& S5 \! W1 D1 m4 L- w# p9 ~- Q& P0 D& s: X3 T+ n
|