ToF (Time of Flight) Sensor
Simple sensor that uses a laser distance sensor for distances under 2m. Features the simplest stm32 chip for sensor reading & logic/distance output modes.
Created by
Lingfeng Wang
Tier 4
4 views
0 followers
Iamalive 🚀
requested changes for ToF (Time of Flight) Sensor ago
Great work! However can you try looking for the parts you are getting off of digikey on lcsc instead? Digikey usually has much more expensive parts. Thanks!
Lingfeng Wang
submitted ToF (Time of Flight) Sensor for review ago
Lingfeng Wang
added to the journal ago
Wrote Theoretical Code

I wrote a short script that should convert the i2c output of the sensor to a pwm output. Hopefully it works as a simple way to test if the circuit works or not.
Lingfeng Wang
added to the journal ago
Added potentiometer
I want the distances to be adjustable without requiring a firmware update, and I forgot to account for this so I need to add a potentiometer to the pcb.



Lingfeng Wang
added to the journal ago
Routed the PCB

Having all this space to route the pcb has been such a nice thing to do, compared to my other designs. The top and bottom layers are ground and power panes, and the components have been put on top.

The pcb looks very proper (ignore the crystal and headers, they are going to be different.
Lingfeng Wang
added to the journal ago
Finished Footprint
I wanted the pcb to be able to be soldered by myself(stencil), so I made all the components in easy places to solder on.

I went through a couple different versions:



The size of the pcb is 2cm by 4cm, which is a little big, but I think it will be fine.
Lingfeng Wang
added to the journal ago
Finished Schematic
The schematic did not take very long, as I have quite some experience with this now. It uses the stm32 with a 8hmz crystal, and 3 debugging leds. I also used a 3v3 ldo, since the sensor will be powered through 5v. I chose a stm32, because I wanted this ic to be able to change from a digital output(0/1) to pwm since we might need both output versions.

I added a debug header for programming the stm32 too.
Lingfeng Wang
added to the journal ago
Chose Components
For the ToF sensor, I chose the VL53L0X module. I chose this because this ic is already being used by rev, so I know it is legal and it works for FRC.

Next, I chose the 20-pin stm32F030F4. This was the simplest and small chip I could find that should still be pretty simple to solder on. Despite having a low amount of pins, it should still have enough for my purposes.

The various other peripheral components like crystals and ldos will be found later, since it does not really matter right now.
Lingfeng Wang
started ToF (Time of Flight) Sensor ago
1/26/2026 3:04 PM - Chose Components
For the ToF sensor, I chose the VL53L0X module. I chose this because this ic is already being used by rev, so I know it is legal and it works for FRC.

Next, I chose the 20-pin stm32F030F4. This was the simplest and small chip I could find that should still be pretty simple to solder on. Despite having a low amount of pins, it should still have enough for my purposes.

The various other peripheral components like crystals and ldos will be found later, since it does not really matter right now.
1/26/2026 3:05 PM - Finished Schematic
The schematic did not take very long, as I have quite some experience with this now. It uses the stm32 with a 8hmz crystal, and 3 debugging leds. I also used a 3v3 ldo, since the sensor will be powered through 5v. I chose a stm32, because I wanted this ic to be able to change from a digital output(0/1) to pwm since we might need both output versions.

I added a debug header for programming the stm32 too.
1/26/2026 3:52 PM - Finished Footprint
I wanted the pcb to be able to be soldered by myself(stencil), so I made all the components in easy places to solder on.

I went through a couple different versions:



The size of the pcb is 2cm by 4cm, which is a little big, but I think it will be fine.
1/26/2026 4:06 PM - Routed the PCB

Having all this space to route the pcb has been such a nice thing to do, compared to my other designs. The top and bottom layers are ground and power panes, and the components have been put on top.

The pcb looks very proper (ignore the crystal and headers, they are going to be different.
1/26/2026 4:26 PM - Added potentiometer
I want the distances to be adjustable without requiring a firmware update, and I forgot to account for this so I need to add a potentiometer to the pcb.



1/26/2026 4:29 PM - Wrote Theoretical Code

I wrote a short script that should convert the i2c output of the sensor to a pwm output. Hopefully it works as a simple way to test if the circuit works or not.