Lab 3: TOF sensors

1. Prelab

1.1 I2C sensor address and 2 TOF sensors

After connecting the TOF sensor, it shows that the sensor address is 0x29. It is a problem as two TOF sensors have the same address. Therefore, we need to pin low the "XSHUT" pin using the GPIO pin on the artemis board to turn off one sensor and allocate a new address. After giving a new address, turn on that sensor. Now, one sensor has a new address while the other use the original address.

1.2 Placement of sensors

As the robot need to detect the distance from the side and the front, I need to use two long QWIIC connectors and place two TOF sensors on the left and front side of the robot. However, if there is an obstacle on the right, there might be some problems

1.3 Sketch of wiring diagram

Here is a sketch of the wiring diagram with some notations on it.

lab2/3-13

2. Lab Tasks

2.1 Picture of TOF sensor connected to QWIIC breakout board

Here is the picture of both TOF sensors connected to QWIIC breakout board.

lab2/3-14

2.2 Scanning for I2C device

After running "Example1_wire_I2C", the address of thw TOF sensor is shown below.

lab2/3-15

The 0x29 address which is used for TOF sensor can be seen.

2.3 Sensor data with chosen mode

In order to detect the obstacle earlier to plan the motion, I use "setDistanceModeLong()". It will lose some accuracy but I believe the range of detection is more important. Here is the collected data.

lab2/3-16

2.4 Two TOF sensors

Follow the idea in the first part, I can now get the data from two TOF sensors. Here is part of the code

lab2/3-17

Here is the result. I just keep the result in millimeter(mm) to make it simple and clear.

lab2/3-18

2.5 Tof sensor speed

Follow the instructions, I write a program to check the time consumed in each step. Here is the code and result

lab2/3-19
lab2/3-20

It can be observed that the time is mainly consumed in waiting for data from TOF sensor. This is the main limit factor.

2.6 Time and Distance sent over bluetooth

Just like what I did in Lab 2, I write a method to read and store the data from TOF sensors first. Then, I add a new case to transmit the data through bluetooth to my computer. Here is part of the code and the result in jupyter lab.

lab2/3-21
lab2/3-22

I get 10 data points from Artemis board. I plot them use python.

lab2/3-23

2.7 5000+ level tasks

There are several different sensors which are based on infrared transmission such as triangulation based IR distance sensor and TOF sensor. The first one is less sensitive to color and texture but has some limitations on range and accuracy. The TOF sensor has long range and high accuracy but it is more sensitive to color and texture.

Although the TOF sensor should have worse performance when facing dark objects, it does have a quite accurate result in my test. The coarse surface sometimes can affect the result, the TOF sensor will return wrong data.

Back to the main page