This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OPT3101EVM: Code example - capture distance with OPT3101evm

Part Number: OPT3101EVM

Hello everyone,


I'm trying to build my own functions.
One of them is to capture distance.

I have 3 questions:

1) do anyone have a code example to capture a distance with opt3101evm?

2) do anyone have a C code and not C++ as in the SDK? i want to use ST MCU with C code

3) Which function in the SDK return the distance in mm? im not finding, im just see calibration function...



it hard for me to understand all the SDK,if someone please can help me to understand how to control/capture data using build functions (and not the GUI) of the OPT3101evm it will be perfect.


Thanks for help, I'm appreciate it!

  • Hi Ephraim,

    I'm looking into this.

    Thank you,

    Brent Elliott

  • Thanks you Brent!

    i'm appreciate it. 

  • Hi Ephraim,

    The SDK includes a function dev.resetInitAndViewData which loads the device and calls dev.liveDataView which will output the distance measurement in mm along with phase, amplitude, etc. The SDK is designed in C++ and there is not one in C. The OPT3101SDK Documentation FAQ (included with the software) has some information about the methods in the code along with some information about backwards compatibility with C.

    Thank you,

    Brent Elliott

  • Hi Brent,
    Thanks you for answer.
    I see the function resetInitAndViewData which it actually call the function liveDataView.
    I played with this function, it receives the number of frames that i want to capture and a bool variable which define if i want to load the calibration parameteres.

    I use resetInitAndViewData, and manual control the number of frames.
    when i open my tera term, i receive data and number of frame that i wrote, but the distanceMM variable is not close to the distance which  should i need to receive.
    its important to say that my opt3101evm isn't calibrated.

    im actually located a target in 500mm and i receive information in the tera term  ~ 4500mm... 
    Should i use more function (any mandatory) in order to capture correct distance?

    why all the three channels are works? i want to use only one channel...

    Again, Thanks you Brent! you really help me.

     

  • Hi Ephraim,

    Without any calibration, the device will not give any accurate data. The following document contains information about the device level and system-level calibrations required to get accurate distance measurements: https://www.ti.com/lit/ug/slau791/slau791.pdf

    The SDK user's guide also contains detailed information about calibration using the methods included in the SDK.

    Thank you,

    Brent Elliott