# Pmod ToF Reference Manual

The Digilent Pmod ToF (Time of Flight) is a sensor that enables optical distance sensing at low power. The on-chip digital signal processor of the ISL29501 calculates the time it takes for light emitted by the ToF to fly to the target and back, which is proportional to the distance to the target. The Pmod ToF can measure distances of up to five meters.

## Features

• Optimized low-power modes
• Enables proximity detection and distance measurement
• 16-bit resolution
• Onboard EEPROM to save the calibrations
• 6-pin Pmod connector with I²C interface
• Pass-through Pmod host port for daisy chaining

## Functional Description

The Pmod ToF is designed to digitally report the distance measured by the Time of Flight based signal processing integrated circuit. It has up to 16-bits of resolution.
It operates using the principle of Square Wave Modulated Indirect Time of Flight (SWM-ITOF) in the frequency domain and obtains distance measurements from the phase shift. The sensing is done by an external emitter (LED) and detector (Photodiode)

## Specifications

Parameter Min Typical Max Units
Power Supply Voltage 2.7 3.3 V
Serial Clock Frequency 10 100 400 kHz
Parameter Value Units
Maximum Current Consumed 55 mA
Wavelength 860 nm
Emission angle +/-3°

## Interfacing with the Pmod

The Pmod ToF communicates with the host board via the I²C protocol. By first sending the 7-bit I²C address of 01010111 (0x57) and then a read/write bit (high/low logic level, respectively), followed by the register address of interest at a maximum clock frequency of 400 kHz, users can read and write Pmod ToF registers, thus implementing configuration of, calibration of, and reading of measurements from, the Pmod ToF. Header J2 on the Pmod ToF is a pass-through for all of the signals present on the main Header J1 to allow for the daisy chaining of multiple I²C compatible modules.

### Application Register Map

All the registers used in the measurement and/or calibration process are described in the ISL29501 datasheet.

There is a set of registers used at every chip initialization.

These values (see table below) are set by Digilent and the user must be very careful changing them. In this situation the user must modify these values before performing manual calibration.

NOTE: Prior to restoring the factory calibration, if the user modified these register values, they must be restored to the values specified below, otherwise the measurements won't be correct.

0x10 0x04
0x11 0x6E
0x13 0x71
0x18 0x22
0x19 0x22
0x60 0x01
0x90 0x0F
0x91 0xFF

### Calibration and Measurements

In order to perform an accurate distance measurement, the Pmod ToF needs to be calibrated. It contains an EEPROM where the calibration can be stored. At the factory, the EEPROM was programmed with a default calibration profile that helps in performing measurements in a range of 30cm-3m. To obtain the best accuracy, a calibration must be performed.

#### EEPROM

The Pmod is equipped with a non-volatile EEPROM memory chip from Atmel: AT24C04D (datasheet available on Microchip website) which has 4-Kbits of available space. The memory can be accessed over the I2C protocol at the address: 0x50h.

The EEPROM stores two sets of calibration values. The factory calibration set contains the values for the generic calibration performed when the device was manufactured, and cannot be altered. The user calibration set contains the values generated when the user performs their own calibration. Initially the user calibration set is loaded with the factory calibration vales. It can always be restored by copying the factory calibration set.

Section Content Section Base Address Size
Serial Number 0x00 16 bytes
User calibration data 0x10 16 bytes
Factory calibration data 0x20 16 bytes
Free Memory 464 bytes

Please consult the Pmod ToF Library User Guide for more information about usage of and communication with the EEPROM module. For more details about the calibration process, read more in the Calibration Procedure section below.

#### Calibrations

There are three types of calibrations required for Pmod ToF:

1. Magnitude calibration: compensates for the emitter current.

2. Crosstalk calibration: compensates for electrical crosstalk observed by the photodiode. At close range a large return signal values for crosstalk has a minor impact on distance measurements. At the far end of the distance range, the crosstalk might exceed the signal, adding significant error to measurements. In order to perform this calibration, the receiver or both optics need to be covered with the foam included in the package to make sure there is no return path for the IR signal emitted by the LED. If the optics are not correctly covered, it will result in large errors when measurements are taken.
NOTE: The foam included in the package might have some deformities due to the cutting process. In order to insure the best calibration please use the flat side of the foam.

3. Distance calibration: compensates for variation in delay of the emitter, photodiode, and the ISL29501 that will change the signal path delay. It will create a coefficient that will be subtracted in each measurement. For this calibration the user must set a predefined distance for which the calibration is performed. A good calibration at 1.5m can result in the ability of the Pmod ToF to measure up to 5 meters with an error of only a few centimeters. The calibrations should be performed at smaller distances (below 1.5m) to avoid distortion and noise that can affect the calibration. In order to perform the distance calibration, a white target (a target with high IR reflective capacity) should be placed at the desired distance from the Pmod ToF. The Pmod should be also placed at least 40cm above the ground or table and no objects should be within the +/-3° area of the optics. The farther the measurement is taken from the ToF, the bigger the area should be.

For more details about the calibration process, see the ISL29501's Calibration Guide.

#### Measurements

A measurement cycle of Pmod ToF is triggered by a falling edge on the sample start (SS) pin, or by the host board issuing a soft_start to the ISL29501's command register via I2C. When performing a measurement, the chip emitter driver transmits a modulated square wave (Tx) at a given frequency optical signal ($f{mod}$) through the emitter. The received optical signal (Rx) returns with a phase shift and attenuation depending on the distance and reflectivity of the object it bounced off of. The distance from the object is calculated by determining the phase shift of the return signal as shown below:

$$D=\frac {C}{4*π*f{mod}}*Δ{φ}\label{1}\tag{1}$$ Where:
D is the distance of the object from the sensor.
$f{mod}$ is the modulation frequency.
$Δ{φ}$ is the phase difference between the emitted and return signals.
C is the speed of light.

### Pinout Table Diagram

Pin Signal Description Pin Signal Description Jumper State Description
1 IRQ Interrupt 1 IRQ Interrupt JP3 Enabled communication enabled on IRQ line
2 SS Sample Start 2 SS Sample Start JP4 Enabled communication enabled on SS line
3 SCL Serial Clock 3 SCL Serial Clock JP1 Enabled 2.2 kΩ resistors enabled on the SCL line
4 SDA Serial Data 4 SDA Serial Data JP2 Enabled 2.2 kΩ resistors enabled on the SDA line
5 GND Power Supply Ground 5 GND Power Supply Ground
6 VCC Power Supply (3.3V) 6 VCC Power Supply (3.3V)

The jumper settings when using the demos are JP1: Enabled, JP2: Enabled, JP3: Enabled, JP4: Enabled.

Any external power applied to the Pmod ToF must be within 2.7 V and 3.3 V to ensure that the on-board chips operate correctly; however, it is recommended that Pmod is operated at 3.3 V. The Pmod ToF does not draw more than 225 mA of current.

### Timing Diagram

A sample timing diagram for writing to and reading from the Pmod ToF taken from the ISL29501 datasheet are provided below:

Example single-byte write sequence to the Pmod ToF

Example multi-byte read sequence from the Pmod ToF

## Physical Dimensions

The pins on the pin header are spaced 100 mil apart. The PCB is 1.6 inches long on the sides parallel to the pins on the pin header and 0.8 inches long on the sides perpendicular to the pin header.

# Software Libraries

Digilent provides a Library to access Pmod ToF functionality with Digilent FPGA development boards. The Library can be found in the Vivado Hierarchies GitHub repository.

A demo that allows communication with the Pmod ToF through UART is available in this GitHub Repository. Functions such as calibration and measure can be accessed by issuing commands to the demo via a serial terminal application. Check the Zybo Z7-20 Pmod ToF Demo User Guide for more details.