Application Guide for Foxconn FSTOF2003C0I Time of Flight Sensor Module - sharpsensoruser/sharp-sensor-demos GitHub Wiki
Application Guide for Foxconn FSTOF2003C0I Time of Flight Sensor Module
Foxconn FSTOF2003C0I Time of Flight Sensor Module Application Guide
Overview
FSTOF2003C0I is the new module version of Sharp's GP2AP03VT00F Time-of-Flight (TOF) sensor which is designed to measure absolute distances from 1cm to 30cm (white card). Sharp GP2AP03VT00F is a very compact I2C sensor designed for short distance ranging applications.
The TOF Module has an on-board MCU, includes a cover lens for the TOF sensor, and provides a digital I2C interface. The FSTOF2003C0I module can be used in a variety of distance ranging applications such as:
- Automatic faucets and dispensers
- Wall and floor detection for robot vacuums
The TOF Module is also available in a UART version instead of I2C. The following table summarizes the different versions of the TOF module that are available.
TOF Module | Distance Range | TOF Sensor | Connector | Interface |
---|---|---|---|---|
FSTOF2002C0U | 10cm to 240cm (white card) | Sharp GP2AP02VT00F | 4-pin | UART |
FSTOF2002C0I | 10cm to 240cm (white card) | Sharp GP2AP02VT00F | 4-pin | I2C |
FSTOF2002C0D | 10cm to 240cm (white card) | Sharp GP2AP02VT00F | 6-pin | UART / I2C |
FSTOF2003C0U | 1cm to 30cm (white card) | Sharp GP2AP03VT00F | 4-pin | UART |
FSTOF2003C0I | 1cm to 30cm (white card) | Sharp GP2AP03VT00F | 4-pin | I2C |
FSTOF2002C0D is a new model with mounting holes and 6-pin connector to support both UART and I2C interface.
TOF Sensor Eye Safety Considerations
The Sharp TOF sensor uses a Class 1 Laser which is safe under conditions of normal use. As per the specification for Sharp GP2AP03VT00F, the laser output from the TOF sensor is Class 1 laser safety under all reasonably foreseeable including single faults in compliance with IEC 60825-1:2014. The laser output will remain within Class 1 limits as long as the Sharp recommended device settings are used and the operating conditions specified in the Sharp GP2AP03VT00F specification are respected. The laser output power must not be increased by any means and no optics should be used with the intention of focusing the laser beam.
TOF Module Specifications
Module Appearance
The TOF Module is comprised of a PCBA board with MCU and a 4-pin connector. On the opposite side of the connector is the actual TOF sensor which is encased behind a rectangular cover and lens.
Module Connector
FSTOF2003C0I uses a 4-pin connector made by JCTC (Shenglan Technology Co. Ltd):
- Module-side connector: JCTC 11002W00-4P-S-HF
- Mating connector housing: JCTC 11002H00-4P-HF
- Mating connector terminal: JCTC 11002TOP-2E
Note that JCTC connectors may be difficult to source in North America. As an alternative, try the JST SH series 1.0mm pitch 4-pin connector which should be compatible with JCTC. JST connectors are easy to find on ebay and you can purchase a set of 10 JST cable assemblies for just a few dollars.
Field of View (FOV)
The FSTOF2003C0I cover lens gives it a standard Field-of-View (FOV) of 25 degrees, which is suitable for a wide range of applications such as user or object detection.
I2C Slave Address
The I2C slave address of the TOF module is 0x36 (54 decimal).
I2C Data Packet Format
Command codes and data bytes are received from the TOF module using the following data packet format.
Field Offset (bytes) | Field Length (bytes) | Field Type | Description |
---|---|---|---|
0 | 1 | uint8_t | Command Code |
1 | 1 | uint8_t | Data Length |
2 | N-2 | uint8_t | Raw Data: The data length is different for each command. The computational formula is N = Data Length + 2. |
I2C Command Codes
The following table shows the available I2C command codes which can be transmitted to the TOF module. For example, to request a distance measurement/reading, send the 0x81 command code. The TOF module will return a distance in units of MM = millimetres using the Data Packet Format described in the previous section.
Command Code | Description |
---|---|
0x81 | Measure distance in units of mm |
0x82 | Crosstalk calibration |
0x83 | Offset calibration |
0x84 | Reset TOF module |
0x85 | Read factory data |
0x86 | Read version information |
0x8A | Read debug parameter section 1 |
0x8B | Read debug parameter section 2 |
0x8C | Read debug parameter section 3 |
0x91 | Set the threshold of interrupt output |
0x92 | Set the ranging mode |
Here are some examples of sending various command codes, and the received data.
Command Description | Command Code | Receive Data |
---|---|---|
Measure a distance of 50cm | 0x81 | 0x81 0x03 0x01 0xF4 0x00 |
Read version info | 0x86 | 0x86 0x03 0x03 0x41 0x04 |
Using FSTOF2003C0I with Arduino
Arduino Circuit
Connect the TOF module to your Arduino board as shown in the figure below. This example uses Arduino Uno but it should work the same with Arduino Mega 2560. Note that the TOF module requires a power supply voltage between 3.0V and 3.6V. In addition, the SDA and SCL pins of the TOF module operate on 3.3V logic, so it is necessary to use a logic level converter to convert between 3.3V and the 5V that Arduino uses.
The demo source code shows how to request a distance measurement by sending the 0x81 command code to the TOF module, process the returned data from the module, and then display the distance in millimetre units on the Serial Monitor.
Example Serial Monitor Output
If you are switching between different Arduino boards, make sure you go to the Arduino IDE Tools menu and set Board and Port appropriately before compiling or uploading the code. The following screen capture shows example output from the TOF module as displayed on the Arduino Serial Monitor.