Skip to content

Commit 1b2b5a8

Browse files
committed
Initial upload
1 parent 13dc5de commit 1b2b5a8

File tree

7 files changed

+348
-0
lines changed

7 files changed

+348
-0
lines changed

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Deneyap ToF Range Finder Sensor VL53L0X Arduino Library
2+
[FOR TURKISH VERSION](docs/README_tr.md) ![trflag](https://github.com/deneyapkart/deneyapkart-arduino-core/blob/master/docs/tr.png)
3+
4+
***** Add photo ****
5+
6+
Arduino library for Deneyap ToF Range Finder Sensor VL53L0X
7+
8+
## :mag_right:Specifications
9+
- `Product ID` **M06**, **mpv1.0**
10+
- `MCU` VL53L0X, STM8S003F3
11+
- `Weight`
12+
- `Module Dimension`
13+
- `I2C address` 0x29
14+
15+
| Address | |
16+
| :--- | :--- |
17+
| 0x29 | default address |
18+
19+
## :closed_book:Documentation
20+
Deneyap ToF Range Finder Sensor VL53L0X
21+
22+
[VL53L0X](https://www.st.com/content/ccc/resource/technical/document/datasheet/group3/b2/1e/33/77/c6/92/47/6b/DM00279086/files/DM00279086.pdf/jcr:content/translations/en.DM00279086.pdf)
23+
24+
[How to install a Arduino Library](https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries)
25+
26+
## :pushpin:Deneyap ToF Range Finder Sensor VL53L0X
27+
This Arduino library allows you to use DDeneyap ToF Range Finder Sensor VL53L0X with I2C peripheral. You can use this library in your projects with any Arduino compatible board with I2C peripheral.
28+
29+
## :globe_with_meridians:Repository Contents
30+
- `/docs ` README_tr.md and product photos
31+
- `/examples ` Examples with .ino extension sketches
32+
- `/src ` Source files (.cpp .h)
33+
- `keywords.txt ` Keywords from this library that will be highlighted in the Arduino IDE
34+
- `library.properties ` General library properties for the Arduino package manager
35+
36+
## Version History
37+
1.0.0 - initial release
38+
39+
## :rocket:Hardware Connections
40+
- Deneyap ToF Range Finder Sensor VL53L0X and Board can be connected with I2C cable
41+
- or 3V3, GND, SDA and SCL pins can be connected with jumper cables
42+
43+
|ToF Range Finder| Function | Board pins |
44+
|:--- | :--- | :---|
45+
|3.3V | Power |3.3V |
46+
|GND | Ground | GND |
47+
|SDA | I2C Data | SDA pin |
48+
|SCL | I2C Clock | SCL pin |
49+
| XSHT | Shut Down | |
50+
| GPIO | Interrupt Output | |
51+
52+
## License Information
53+
Please review the [LICENSE](https://github.com/deneyapkart/deneyap-derinlik-olcer-arduino-library/blob/master/LICENSE) file for license information.

docs/README_tr.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Deneyap Derinlik Ölçer VL53L0X Arduino Kütüphanesi
2+
3+
***** Fotoğraf eklenecek ****
4+
5+
Deneyap Derinlik Ölçer VL53L0X için Arduino kütüphanesidir.
6+
7+
## :mag_right:Özellikler
8+
- `Ürün ID` **M06**, **mpv1.0**
9+
- `MCU` VL53L0X, STM8S003F3
10+
- `Ağırlık`
11+
- `Modul Boyutları`
12+
- `I2C Adres` 0x29
13+
14+
| Adres | |
15+
| :--- | :--- |
16+
| 0x29 | varsayılan adres |
17+
18+
## :closed_book:Dokümanlar
19+
Deneyap Derinlik Ölçer VL53L0X
20+
21+
[VL53L0X](https://www.st.com/content/ccc/resource/technical/document/datasheet/group3/b2/1e/33/77/c6/92/47/6b/DM00279086/files/DM00279086.pdf/jcr:content/translations/en.DM00279086.pdf)
22+
23+
24+
[Arduino Kütüphanesi Nasıl İndirilir](https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries)
25+
26+
## :pushpin:Deneyap Derinlik Ölçer VL53L0X
27+
Bu Arduino kütüphanesi Deneyap Derinlik Ölçer VL53L0X'nin I2C çevre birimi ile kullanılmasını sağlar. Arduino ile uyumlu, I2C çevre birimine sahip herhangi bir geliştirme kartı ile bu kütüphaneyi projelerinizde kullanabilirsiniz.
28+
29+
## :globe_with_meridians:Repo İçeriği
30+
- `/docs` README_tr.md ve ürün fotoğrafları
31+
- `/examples` .ino uzantılı örnek uygulamalar
32+
- `/src` kütüphane için .cpp ve .h uzantılı dosyalar
33+
- `keywords.txt` Arduino IDE'de vurgulanacak anahtar kelimeler
34+
- `library.properties` Arduino yöneticisi için genel kütüphane özellikleri
35+
36+
## Sürüm Geçmişi
37+
1.0.0 - ilk sürüm
38+
39+
## :rocket:Donanım Bağlantıları
40+
- Deneyap Derinlik Ölçer ile kullanılan geliştirme kartı I2C kablosu ile bağlanabilir
41+
- veya jumper kablolar ile ile 3V3, GND, SDA ve SCL bağlantıları yapılabilir.
42+
43+
| Derinlik Ölçer | Fonksiyon| Kart pinleri |
44+
| :--- | :--- | :--- |
45+
| 3.3V | Güç | 3.3V |
46+
| GND | Toprak |GND |
47+
| SDA | I2C Data | SDA pini |
48+
| SCL | I2C Clock | SCL pini|
49+
| XSHT | Shut Down | |
50+
| GPIO | Çıktı Kesmesi | |
51+
52+
## Lisans Bilgisi
53+
Lisans bilgileri için [LICENSE](https://github.com/deneyapkart/deneyap-derinlik-olcer-arduino-library/blob/master/LICENSE) dosyasını inceleyin.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Derinlik Ölçme örneği,
3+
*
4+
* Bu örnekte temel konfigürasyon ayarları yapılmaktadır.
5+
* Sensörden gelen mesafe verilerini okumaktadır. Mesafe verilerini seri terminale yazdırmaktadır.
6+
*
7+
* Bu algılayıcı I2C haberleşme protokolü ile çalışmaktadır.
8+
*
9+
* Bu örnek Deneyap Derinlik Ölçer için oluşturulmuştur
10+
* ------> www.....com <------ //docs
11+
* ------> https://github.com/deneyapkart/deneyap-derinlik-olcer-arduino-library <------
12+
*
13+
*/
14+
#include <Deneyap_DerinlikOlcer.h> // Deneyap_DerinlikOlcer.h kütüphanesi eklenmesi
15+
16+
TofRangeFinder Mesafe; // TofRangeFinder için class tanımlanması
17+
18+
void setup() {
19+
Serial.begin(115200); // Seri haberleşme başlatılması
20+
if (!Mesafe.begin(0x29)) { // begin(slaveAdress) fonksiyonu ile cihazların haberleşmesi başlatılması
21+
Serial.println("VL53L0X I2C bağlantısı başarısız "); // I2C bağlantısı başarısız olursa seri terminale yazdırılması
22+
while(1);
23+
}
24+
}
25+
26+
void loop() {
27+
Serial.print("Uzaklık: ");
28+
Serial.println(Mesafe.ReadDistance()); // Ölçüm yapılması ve Seri Terminale veri gönderilmesi
29+
delay(50);
30+
}

keywords.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#######################################
2+
# Syntax Coloring Map For Deneyap_DerinlikOlcer
3+
#######################################
4+
5+
#######################################
6+
# Library (KEYWORD1)
7+
#######################################
8+
9+
Deneyap_DerinlikOlcer KEYWORD1
10+
11+
####################################
12+
# Class (KEYWORD1)
13+
####################################
14+
15+
TofRangeFinder KEYWORD1
16+
17+
#######################################
18+
# Methods and Functions (KEYWORD2)
19+
#######################################
20+
begin KEYWORD2
21+
init KEYWORD2
22+
ReadDistance KEYWORD2
23+
24+
#######################################
25+
# Constants (LITERAL1)
26+
#######################################

library.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=Deneyap Derinlik Olcer
2+
version=1.0.0
3+
author=RFtek Electronics <[email protected]>
4+
maintainer=Turkish Technnology Team Foundation (T3)
5+
sentence=Arduino library for Deneyap ToF Range Finder Sensor VL53L0X
6+
paragraph=A simple and efficient library to use Deneyap ToF Range Finder Sensor VL53L0X via I2C peripheral.
7+
category=Sensors
8+
url=https://github.com/deneyapkart/deneyap-derinlik-olcer-arduino-library
9+
architectures=*

src/Deneyap_DerinlikOlcer.cpp

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/*
2+
***************************************************************************************
3+
@file Deneyap_DerinlikOlcer.cpp
4+
@mainpage Deneyap ToF Range Finder Sensor VL53L0X Arduino library source file
5+
@maintainer RFtek Electronics <[email protected]>
6+
@version v1.0.0
7+
@date June 23, 2022
8+
@brief Includes functions to control Deneyap ToF Range Finder Sensor VL53L0X
9+
Arduino library
10+
11+
Library includes:
12+
--> Configuration functions
13+
--> Data manipulation functions
14+
--> I2C communication functions
15+
**************************************************************************************
16+
*/
17+
18+
#include "Deneyap_DerinlikOlcer.h"
19+
20+
/**
21+
* @brief I2C initialization and read check
22+
* @param adress: Device adress
23+
* @retval None
24+
**/
25+
bool TofRangeFinder::begin(uint8_t address, TwoWire &wirePort) {
26+
_address = address;
27+
Wire.begin();
28+
Wire.beginTransmission(address);
29+
if (!Wire.endTransmission())
30+
return true;
31+
return false;
32+
}
33+
34+
/**
35+
* @brief
36+
* @param
37+
* @retval
38+
**/
39+
bool TofRangeFinder::init() {
40+
begin(_address);
41+
write8(0x88, 0x00);
42+
write8(0x80, 0x01);
43+
write8(0xFF, 0x01);
44+
write8(0x00, 0x00);
45+
read8(0x91);
46+
write8(0x91, 0x3c);
47+
write8(0x00, 0x01);
48+
write8(0xFF, 0x00);
49+
write8(0x80, 0x00);
50+
51+
write8(0x80, 0x01);
52+
write8(0xFF, 0x01);
53+
write8(0x00, 0x00);
54+
write8(0x91, 0x3c);
55+
write8(0x00, 0x01);
56+
write8(0xFF, 0x00);
57+
write8(0x80, 0x00);
58+
59+
write8(VL53L0X_REG_SYSRANGE_START, VL53L0X_REG_SYSRANGE_MODE_BACKTOBACK);
60+
return 1;
61+
}
62+
63+
/**
64+
* @brief
65+
* @param
66+
* @retval
67+
**/
68+
void TofRangeFinder::write8(unsigned char Reg, unsigned char byte) {
69+
Wire.beginTransmission(_address);
70+
Wire.write(Reg);
71+
Wire.write((uint8_t)byte);
72+
Wire.endTransmission();
73+
}
74+
75+
/**
76+
* @brief
77+
* @param
78+
* @retval
79+
**/
80+
void TofRangeFinder::readData(unsigned char Reg, unsigned char Num) {
81+
Wire.beginTransmission(_address);
82+
Wire.write((uint8_t)Reg);
83+
Wire.endTransmission();
84+
Wire.requestFrom((uint8_t)_address, (uint8_t)Num);
85+
86+
for (int i = 0; i < Num; i++) {
87+
Data[i] = Wire.read();
88+
delay(1);
89+
}
90+
}
91+
92+
/**
93+
* @brief
94+
* @param
95+
* @retval
96+
**/
97+
uint8_t TofRangeFinder::read8(unsigned char Reg) {
98+
Wire.beginTransmission(_address);
99+
Wire.write((uint8_t)Reg);
100+
Wire.endTransmission();
101+
Wire.requestFrom((uint8_t)_address, (uint8_t)1);
102+
return Wire.read();
103+
}
104+
105+
/**
106+
* @brief
107+
* @param
108+
* @retval
109+
**/
110+
float TofRangeFinder::ReadDistance() {
111+
readData(VL53L0X_REG_RESULT_RANGE_STATUS, 12);
112+
distance = ((Data[10] & 0xFF) << 8) |
113+
(Data[11] & 0xFF);
114+
write8(VL53L0X_REG_SYSTEM_RANGE_CONFIG, 1);
115+
if (distance == 20)
116+
distance = _distance;
117+
else
118+
_distance = distance;
119+
return distance / 40;
120+
}

src/Deneyap_DerinlikOlcer.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
***********************************************************************************
3+
@file Deneyap_DerinlikOlcer.h
4+
@mainpage Deneyap ToF Range Finder Sensor VL53L0X Arduino library header file
5+
@version v1.0.0
6+
@date June 23, 2022
7+
@brief This file contains all function prototypes and macros
8+
for Deneyap ToF Range Finder Sensor VL53L0X Arduino library
9+
***********************************************************************************
10+
*/
11+
12+
#ifndef _Deneyap_DerinlikOlcer_H
13+
#define _Deneyap_DerinlikOlcer_H
14+
15+
#include <Arduino.h>
16+
#include <Wire.h>
17+
18+
#define VL53L0X_REG_IDENTIFICATION_MODEL_ID 0x00c0
19+
#define VL53L0X_REG_IDENTIFICATION_REVISION_ID 0x00c2
20+
#define VL53L0X_REG_PRE_RANGE_CONFIG_VCSEL_PERIOD 0x0050
21+
#define VL53L0X_REG_FINAL_RANGE_CONFIG_VCSEL_PERIOD 0x0070
22+
#define VL53L0X_REG_SYSRANGE_START 0x0000
23+
#define VL53L0X_REG_RESULT_INTERRUPT_STATUS 0x0013
24+
#define VL53L0X_REG_RESULT_RANGE_STATUS 0x0014
25+
#define VL53L0X_REG_I2C_SLAVE_DEVICE_ADDRESS 0x008a
26+
#define VL53L0X_I2C_ADDR 0x0029
27+
#define VL53L0X_REG_SYSTEM_RANGE_CONFIG 0x0009
28+
#define VL53L0X_REG_VHV_CONFIG_PAD_SCL_SDA__EXTSUP_HV 0x0089
29+
#define VL53L0X_REG_SYSRANGE_MODE_SINGLESHOT 0x0000
30+
#define VL53L0X_REG_SYSRANGE_MODE_START_STOP 0x0001
31+
#define VL53L0X_REG_SYSRANGE_MODE_BACKTOBACK 0x0002
32+
#define VL53L0X_REG_SYSRANGE_MODE_TIMED 0x0004
33+
34+
#define VL53L0X_DEVICEMODE_SINGLE_RANGING ((uint8_t)0)
35+
#define VL53L0X_DEVICEMODE_CONTINUOUS_RANGING ((uint8_t)1)
36+
#define VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING ((uint8_t)3)
37+
#define VL53L0X_DEFAULT_MAX_LOOP 200
38+
39+
class TofRangeFinder {
40+
public:
41+
bool begin(uint8_t address, TwoWire &wirePort = Wire);
42+
bool init();
43+
float ReadDistance();
44+
45+
private:
46+
uint8_t _address;
47+
uint16_t _distance;
48+
void write8(unsigned char Reg, unsigned char byte);
49+
uint8_t read8(unsigned char Reg);
50+
void readData(unsigned char Reg, unsigned char Num);
51+
52+
unsigned char DevAddr;
53+
unsigned char Data[16];
54+
uint16_t distance;
55+
};
56+
57+
#endif

0 commit comments

Comments
 (0)