Rapidly Deploy Time-of-Flight Distance Sensing Using a Pre-Built Solution

Time-of-Flight (ToF) technology is increasingly used for distance measurement and proximity sensing in application areas ranging from consumer products to industrial equipment. The availability of single-chip ToF processing ICs helps simplify implementation of these solutions, but these still leave developers with critical tasks such as finding and optimizing suitable emitters and photodiodes, and integrating those devices with that ToF processor. A more integrated approach could greatly simplify the process and save time.

To address this, Digilent has developed a pre-built ToF add-on board, which when combined with a high-performance system board and associated software library, provides a complete hardware ToF solution. Now developers can immediately begin prototyping ToF applications or use this hardware and software as the foundation for designing custom ToF hardware and software.

This article briefly describes how ToF sensors operate. In then introduces Digilent’s Pmod ToF board and shows how it can be used in combination with the Digilent Zybo Z7-20 development board to evaluate ToF technology and rapidly deploy optical distance sensing in their own designs.

How ToF sensors work

ToF sensors play an important role in an increasingly broad array of applications. In vehicles and industrial equipment these sensors help warn operators of obstacles while parking or otherwise maneuvering in close quarters. In consumer applications, these devices provide proximity sensing in mobile products or home automation systems. In these and other applications, optical ToF systems calculate distance to an external object or obstacle using different methods that all rely on some difference between the light reflected by the external object and the light originally transmitted.

An advanced ToF device like the Renesas ISL29501 ToF-based signal processing IC calculates distance by measuring the phase shift between the light transmitted from an external LED or laser and the received light from a photodiode. When the ISL29501 transmits light (Tx) modulated by a square wave at a given frequency fm, the reflected optical signal (Rx) from an object returns to the ISL29501 at an attenuated amplitude R with some phase shift j (Figure 1).

Rapidly Deploy Time-of-Flight Distance Sensing Using a Pre-Built SolutionFigure 1: Advanced ToF devices such as the Renesas ISL29501 use their internal digital signal processing capabilities to calculate distance to objects based on the phase shift j between transmitted and reflected light. (Image source: Renesas)

By measuring this phase shift, the device can compute the distance D:

Rapidly Deploy Time-of-Flight Distance Sensing Using a Pre-Built Solution Equation 1


D = distance to target

c = speed of light

fm = modulation frequency

φ = phase angle (radians)

Since the modulated frequency signal fm and speed of light c are known, the distance can be calculated by finding the remaining factor, the phase angle φ. This factor can be computed with traditional quadrature signal processing techniques. Here, in-phase (I) and quadrature (Q) signal components are generated by separate I and Q signal paths comprising a demodulator, a low pass filter (LPF), and an analog-to-digital converter (ADC) (Figure 2).

Rapidly Deploy Time-of-Flight Distance Sensing Using a Pre-Built SolutionFigure 2: To calculate the phase angle φ required for its distance calculation, the Renesas ISL29501 demodulates, filters, and converts the in-phase (I) and quadrature (Q) signal components of the input signal (VIN). (Image source: Renesas)

Internally, the ISL29501 integrates a comprehensive signal path that precedes the demodulation pipeline with an analog front-end (AFE) signal conditioning stage comprising a transimpedance amplifier (TIA) and low noise amplifier (LNA). The ISL29501’s input signal path follows the AFE with a variable gain (Av), automatic gain control (AGC) loop that uses its built-in algorithms to optimize SNR.

On the output side, the ISL29501 integrates an on-chip emitter driver chain capable of delivering square wave pulses at a modulation frequency of 4.5 megahertz (MHz) and drive current up to 255 milliamps (mA) to a suitable emitter. Completing this functional architecture, an internal digital signal processor (DSP) handles the computations required to generate the distance result from phase, amplitude, and frequency data (Figure 3).

Rapidly Deploy Time-of-Flight Distance Sensing Using a Pre-Built SolutionFigure 3: The Renesas ISL29501 combines signal paths for driving an emitter and processing photodiode input along with an internal digital signal processor that executes algorithms used to compute distance from phase, amplitude, and frequency data. (Image source: Renesas)

Choosing emitters and photodiodes

By integrating photodiode input, emitter output, and processing capabilities, the ISL29501 provides a flexible hardware foundation for building ToF distance sensing solutions. Features such as the AFE and AGC loop on the input side and the programmable emitter driver on the output side are designed specifically to support a wide range of emitters and photodiodes. At the same time, the effectiveness of a complete ToF solution depends critically on the careful selection and configuration of the emitter and photodiode.

For the emitter, for example, the ISL29501’s flexibility lets developers select from a wide variety of infrared (IR) LEDs, vertical-cavity surface-emitting lasers (VCSELs), or other laser devices with compatible voltage, current, and frequency specifications. In fact, a typical ToF solution is relatively insensitive to emitter type. Nevertheless, the use of a near infrared (NIR) or medium wavelength infrared (MWIR) device is recommended to reduce interference from ambient light sources. After selecting the device, the developer will need to determine the optimum emitter pulse drive current as well as any DC current component that might be required. Next, the developer must program the device to deliver the pulse and optional DC current using the separate internal digital-to-analog converters (DACs) integrated in the emitter driver output chain.

Similarly, the ISL29501 can support a wide variety of photodiodes, but the application and choice of emitters will play a key role in determining the optimum choice. As with the emitter, a photodiode operating at NIR or MWIR wavelengths helps reduce ambient light interference. Ideally, the photodiode’s spectral response curve should be as narrow as possible with a peak centered on the emitter’s peak wavelength to optimize the signal to noise ratio (SNR). Although the photodiode needs to maximize the amount of light it is able to collect, increasing the photodiode area also introduces higher capacitance (both junction and stray capacitances), which can compromise the photodiode’s response time and its ability to track the rise and fall times of the emitter. As a result, developers need to find the optimal balance of photodiode area and internal capacitance needed to maximize signal amplitude without compromising performance.

Integrated ToF solution

Designed to accelerate development of ToF applications, the Digilent Pmod ToF board provides an off-the-shelf ToF solution that combines the Renesas ISL29501 ToF IC, a Microchip Technology AT24C04D EEPROM, an IR LED, and a photodiode in a small format board with six-pin Pmod host and pass-through connectors for adding additional Pmod expansion boards (Figure 4).

Rapidly Deploy Time-of-Flight Distance Sensing Using a Pre-Built SolutionFigure 4: The Digilent Pmod ToF board provides a complete ToF sensor solution designed to connect to system boards with Pmod connectors. (Image source: Digilent)

For light source and detector, the board pairs an OSRAM Opto Semiconductors high power SFH 4550 860 nanometer (nm) LED with an OSRAM SFH 213 FA photodiode which has a fast switching time, spectral sensitivity from 750 to 1100 nm, and a peak sensitivity at 900 nm.

Although the Renesas ISL29501 does not require additional components for the associated LED and photodiode devices, it does require a suitable 2.7 volt to 3.3 volt source for each of its three power domains supplied by separate pins for its analog voltage source (AVCC), digital voltage source (DVCC), and emitter driver voltage (EVCC). Although these can be supplied from the same source, Renesas recommends isolating these three supplies. As shown in the Digilent Pmod ToF schematic, Digilent achieves this isolation for the ToF board using Murata Electronics’ BLM15BD471SN1D ferrite beads and capacitors for each supply (Figure 5).

Rapidly Deploy Time-of-Flight Distance Sensing Using a Pre-Built SolutionFigure 5: The Digilent Pmod ToF board offers both an immediate hardware solution for rapid prototyping as well as a reference design for custom ToF systems. (Image source: Digilent)

Development environment

Digilent further helps accelerate implementation of ToF applications with a development environment based on the Digilent Zybo Z7-20 board. The board provides a high performance operating environment built around the Xilinx Zynq XC7Z020 all programmable SoC (APSoC). This APSoC integrates a dual-core Arm® Cortex®-A9 processor with an extensive programmable fabric including support for 53,200 look up tables (LUTs), 106,400 flip-flops, and 630 kilobytes (Kbytes) of block random access memory (RAM). Along with the Xilinx Zynq XC7Z020 APSoC, the Zybo Z7-20 board includes 1 gigabyte (Gbyte) of RAM, 16 megabytes (Mbytes) of quad SPI flash, multiple interfaces, connectors, and six Pmod expansion ports.

Designed to run on the Zybo Z7-20 board, Digilent’s ZyboZ7-20 PmodToF-Demo software distribution includes the software development kit (SDK) for its Pmod ToF hierarchical block software library. This library provides developers with an intuitive application programming interface (API) for building applications based on drivers and support modules in the Xilinx SDK, or provided by Digilent for the Pmod ToF board (Figure 6).

Rapidly Deploy Time-of-Flight Distance Sensing Using a Pre-Built SolutionFigure 6: Digilent’s Pmod ToF hierarchical block software library augments low-level interface drivers in the Xilinx SDK with modules for the Renesas ISL29501 sensor, EEPROM, and Pmod ToF services. (Image source: Digilent)

The Digilent library combines low-level drivers for I2C, GPIO, and UART communications from the Xilinx SDK with modules that implement register level operations for the Digilent Pmod ToF Board EEPROM and the Renesas ISL29501 device. For example, the ISL29501 module provides a function to execute a distance measurement with the ISL29501. Because the ISL29501 internally implements the detailed sequence of operations required to perform that measurement, execution of distance measurement only requires some initial setup and a series of register reads and writes. The Digilent library’s ISL29501 module provides the functions to implement specific ISL29501 operations including one to perform a distance measurement (Listing 1).

Copy double PmodToF_perform_distance_measurement() {     /* WRITE REG */     u8 reg0x13_data = 0x7D;     u8 reg0x60_data = 0x01;     /* READ REG */     u8 unused;     u8 DistanceMSB;     u8 DistanceLSB;       double distance = 1;     ISL29501_WriteIIC(&myToFDevice, 0x13, &reg0x13_data, 1);     ISL29501_WriteIIC(&myToFDevice, 0x60, &reg0x60_data, 1);     ISL29501_ReadIIC(&myToFDevice, 0x69, &unused, 1);     CALIB_initiate_calibration_measurement();        //waits for IRQ     while((XGpio_DiscreteRead(&gpio, GPIO_CHANNEL) & GPIO_DATA_RDY_MSK) != 0 );     ISL29501_ReadIIC(&myToFDevice, 0xD1, &DistanceMSB, 1);     ISL29501_ReadIIC(&myToFDevice, 0xD2, &DistanceLSB, 1);     distance =(((double)DistanceMSB * 256 + (double)DistanceLSB)/65536) * 33.31;     return  distance; } 

Listing 1: Software functions included in the Digilent library’s ISL29501 module implement register-level operations such as performing a distance measurement as shown here. (Code source: Digilent)

The Digilent library’s PmodToF module provides higher-level services built on those lower-level modules. For example, to execute and display a measurement, the PmodToF module’s PmodToFCMD_MeasureCmd() function calls the ISL29501 module’s register-level PmodToF_perform_distance_measurement() function repeatedly and displays the average of the results (Listing 2).

Copy /***   PmodToFCMD_MeasureCmd ** **     Parameters: **     none ** **     Return Value: **          ERRVAL_SUCCESS              0       // success ** **     Description: **            This function displays over UART the distance measured by the device. **            Before calling this function, it is important that a manual calibration was made or the calibration **            was imported(calibration stored by the user in EEPROM user area )/restored from EEPROM(factory calibration). */ void PmodToFCMD_MeasureCmd() {        int N = 100, sum = 0;        int distance_val, distance_val_avg;        // 100 distance values that are measure will be averaged into a final distance value        for(int j=0;j<N;j++)        {               distance_val = 1000 * PmodToF_perform_distance_measurement(); // the distance value is in millimeters               sum = sum + distance_val;        }        distance_val_avg = sum/N;     sprintf(szMsg, "Distance measured D = %d mm.", distance_val_avg);     ERRORS_GetPrefixedMessageString(ERRVAL_SUCCESS, "", szMsg);     UART_PutString(szMsg); } 

Listing 2: Software functions included in the Digilent library’s PmodToF module provide application level services such as displaying the average of multiple distance measurements as shown here. (Code source: Digilent)

Developers can use the complete set of modules in the Digilent Pmod ToF hierarchical block software library or use just the minimal set of modules required for their application. For every application, however, developers will need to perform magnitude, crosstalk, and distance calibrations to ensure accuracy. Although the magnitude is an internal calibration, the other two require some amount of setup. For the crosstalk calibration, developers simply block the optical devices with a piece of foam included with the board and run the calibration. For distance calibration, developers place the ToF board with optics positioned some known distance from a target with high IR reflectivity and run the calibration. Although the ISL29501 does not include nonvolatile memory, developers can save new calibration values in the Pmod ToF board’s EEPROM and load those values during software initialization procedures.

This combination of off–the-shelf hardware and software provide a ready-to-use foundation for creating optical ToF applications. For rapid prototyping, developers can immediately run the library distribution’s sample software using the Digilent Pmod ToF and Zybo Z7-20 board. For custom development, developers can build on the hardware reference design represented by the Pmod ToF board and on the software code provided in the Digilent library distribution.


While single-chip ToF processing ICs help simplify implementation of ToF solutions for many applications, they still leave developers needing to find suitable emitters and photodiodes for integration. As shown, a more accessible solution is provided by a pre-built ToF add-on board in combination with a high-performance system board, which together deliver a complete hardware ToF solution. By combining this hardware solution with an associated software library, developers can immediately begin prototyping ToF applications, or use this hardware and software as the foundation for designing custom ToF hardware and software.