Jump to content
  • 0

Setting Up Pmod ToF for Arduino uno


Thereddawn123

Question

So currently ive been setting up the Pmod ToF for an Arduino UNO using the Arduino IDE.  The code that im using is from: Add Time of Flight Sensor to Arduino Due (digikey.com) and I modified it so that A4 and A5 were assigned to the SDA and SCL lines. 

However when I run the code: My first issue is that I had to offset the distances recorded by 200 and wanted to know if its just an issue with my sensor in general or not?.

My 2nd issue is that when I set the calibration distance to a value and I then calibrate it with the steps given and lets say my calibration distance was 0.2m and my object is set to be at 0.2m. Is it that at that value its suppose to read 0 or 0.2m? Because for me when my object is at 0.2m and my  calibration distance is set to 0.2m it reads the objects distance as roughly 0m

Any help would be appreciated and thank you.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
On 2/13/2024 at 7:25 PM, Thereddawn123 said:

So currently ive been setting up the Pmod ToF for an Arduino UNO using the Arduino IDE.  The code that im using is from: Add Time of Flight Sensor to Arduino Due (digikey.com) and I modified it so that A4 and A5 were assigned to the SDA and SCL lines. 

However when I run the code: My first issue is that I had to offset the distances recorded by 200 and wanted to know if its just an issue with my sensor in general or not?.

My 2nd issue is that when I set the calibration distance to a value and I then calibrate it with the steps given and lets say my calibration distance was 0.2m and my object is set to be at 0.2m. Is it that at that value its suppose to read 0 or 0.2m? Because for me when my object is at 0.2m and my  calibration distance is set to 0.2m it reads the objects distance as roughly 0m

Any help about Uno Card Game would be appreciated and thank you.

The offset you're seeing in your Pmod ToF readings and the slight discrepancy after calibration could be due to a few factors. Here's a breakdown of your issues and some troubleshooting tips:

1. Offset in Distance Readings (200mm):

This offset might not necessarily be an issue with the sensor itself. It could be caused by:

Systematic Bias: There could be a slight bias introduced by the Arduino board, connections, or the sensor itself. This bias consistently adds or subtracts a value from the true distance measurement.

Background Light: Background light can interfere with the ToF sensor's readings. Make sure the environment is well-controlled with minimal background light during measurement.

Troubleshooting:

Calibration with Offset: You can account for the offset by incorporating it into your code. After performing the calibration steps, calculate the average offset by taking multiple readings at a known distance (e.g., 1 meter). Subtract this average offset value from subsequent distance readings in your code.

2. Calibration Discrepancy (0.2m Calibration, 0m Reading):

There could be a few reasons why the sensor isn't reading exactly 0.2m even after calibration at 0.2m:

Calibration Distance: While calibrating at the target measurement distance (0.2m) might seem ideal, it's recommended to calibrate at a slightly shorter distance (around 0.15m) for better accuracy at longer distances.

Sensor Tolerance: The Pmod ToF sensor has a certain tolerance in its measurements. Refer to the sensor's datasheet for the specified accuracy. Even after calibration, there might be a slight deviation from the exact distance.

Troubleshooting:

Calibrate at Shorter Distance: Try calibrating the sensor at a shorter distance (around 0.15m) and see if the readings improve at 0.2m.

Consider Sensor Tolerance: Account for the sensor's tolerance when interpreting the readings. If the measured value falls within the specified tolerance range of 0.2m (e.g., +/- 2cm), it can be considered accurate.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...