Skip to content

05 ‐ Hardware Setup and Sensor Placement

Resinchem edited this page Dec 14, 2024 · 2 revisions

While final placement of a number of components is somewhat arbritrary based on your particular project, the placement of the start and finish line sensors is not and proper operation of the system relies on the sensors being positioned properly.

02 Overall Concept_v2

The controller, timer display and even the LED strips can be placed wherever desired. However if the controller is located somewhere near the center of the course or track, it will minimize the maximum length of the wiring run to the sensors. Using the shortest wiring runs possible help to eliminate any noise or trigger issues that can be caused by voltage drop and/or EM interference.

Wiring information and options on how to connect the components together is covered in the build instructions, found in the blog article A Robot Car Timing System. The blog also contains similar information on alignment of the sensors.

Aligning the Sensors

Before attempting to align the sensors, it is recommended to place the VL53L0x into some sort of enclosure or other mounting system that will hold the sensor in position, while still allowing minor horizontal and vertical adjustments.

05b_SensorMount

I used a 3D printed enclosure (copies of my 3D design files can be found in the /stl folder of this repo). The enclosure is attached to a small wood platform with a screw and washer. The screw is tightened just enough to hold the sensor in position, but just loose enough to allow the sensor to be turned left and right for horizontal alignment. The enclosure itself consists of mounting pins that allow vertical adjustment but will hold its position. You do not need to have a 3D printer... you can use any sort of mounting system you can come up with to hold the sensor in position.

Start with vertical alignment. Vertical alignment is important here, especially if the sensor is to mounted on the ground or near track level. Why? Well, the sensor has a field-of-view of approximately 25°... and this is vertically as well as horizontally.

05c_VerticalAlign

If the sensor is placed level and perpendicular to the track, the surface of the track will be within the F.O.V. of the sensor and it will continuously report back the distance from the sensor to the track surface and not an object on the track that is crossing the start/finish line. If the timer starts immediately as soon as the system is placed in ready mode and there aren't any objects on the track, you likely need to adjust the vertical alignment. For the initial adjustment, just aim it high enough that the timer does not automatically start as soon as placed in ready mode. You'll fine-tune this later.

Horizontally, the alignment is similar.

05d_HorizontalAlign

There's a lot to digest in that diagram, so let's start with the horizontal distance between the sensor and near edge of the track. The VL53L0x sensors has a minimum distance range of 5 cm (~2"). Inside of this range, it may not detect objects or give inaccurate readings. So first position the sensors approximately 2-6" from the edge of the track or detection area.

Next, similar to vertical alignment, turn the sensors left or right to align the edge of the F.O.V. cone to be parallel and as closely aligned as possible to the leading edges of the start and finish lines. This will take a little trial-and-error. Initially, just shoot for something close. You want the start sensor to start the timer as soon as an object touches or crosses the start line and the time to stop as soon as the object touches/crosses the finish line.

While the minimum range of the VL53L0x is 5 cm, the maximum range is around 1.2M (almost 4 feet!). This means that it will detect/return measurement values for objects well beyond the 16" width of my track. This means that people or other objects could enter the area near the opposite side of the track and trigger the sensors to start or stop the time. Not good!

if your course is wider than about 1M (3.25 feet), then you may not be able to use the VL53L0x sensor. You might be able to use an ultrasonic sensor or something like a TF-Mini LIDAR sensor (a much better choice, but also much more expensive). Changing sensor types will also require firmware code changes to work with a different sensor. That is beyond the scope of this project, but the source code is available in the /src folder if you wish to give it a shot.

To fix the range issue issue for narrower courses, we'll use the web settings for the controller. The web settings has a sensor distance setting for each sensor (see Web Settings):

05e_MaxSensorSettings

This will limit the maximum distance (always entered in millimeters) that the sensor will use for triggering the timer. In my example, I have these distances set to 395mm and 405mm for the start and finish sensors, respectively. With these values set, objects, motion or movement outside the track area (as indicated by the green dashed box in the previous image) will no longer be detected.

05f_BreakBeams

In effect, we are creating 'break beams' across the start and finish lines. Anytime an object approaches and touches/crosses the start or finish line from the 'race direction', the timer will be automatically started or stopped accordingly.

Due to the cone-shaped field-of-view, it is not possible to run the course "backwards" or in the reverse direction. This is because the object will enter the field-of-view cone from the opposite direction before reaching the line.

You will likely need to continue making small adjustments to the vertical and horizontal alignment, along with max sensor distances until the sensors are precisely positioned so that the timer starts/stops just as an object touches the start/finish lines and isn't triggered by objects or movement outside of the track area. In my testing, it took about 10 minutes to align the sensors and from that point forward, the system worked perfectly every time with no further adjustments.