cancel
Showing results for 
Search instead for 
Did you mean: 

VL6180X INTERRUPT TO GPIO1

MSAMB.1
Associate III

Hello,

I am using a PNUCLEO VL6180X and I would like to drive my LED from the GPIO1 interrupt output only this output as shown in the diagrams above is always at 1 and it goes to 0 only for a few nanoseconds; I would like to have an interrupt signal only when I bring my hand closer to the sensor, I would like it to send a 1 to the LED when there is a target and a 0 when there is nothing.

Here are some images on the oscilloscope with the target and without the target

1 ACCEPTED SOLUTION

Accepted Solutions

0693W000004GLIYQA4.png0693W000004GLIJQA4.pngHello @Eleon BORLINI​ 

Yes I've found the solution thanks evryone for helping me.

I sent you an example of my main code and my interrupt code. I've just take another pin of the MCU to command the LED it was very simple when my MCU detect the interruption my LED blink but I've add another LED who should take on when no target is detected and off when target is detected. Sorry for my english i'm french.

In the bottom you will see the code. Thank you

View solution in original post

8 REPLIES 8
Julien NGUYEN
ST Employee

Hi,

I m not sure that the GPIO1 has enough current to drive a LED. I think that it is better to connect the GPIO1 pin to a MCU GPIO to detect the event then from the MCU send a current to drive a LED ?

Thanks,

Julien


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
MSAMB.1
Associate III

OK thank you Julien,

I've another questions :

In my main program, I'm calling the Sample_Ranging () functions to perform the measurement and the Sample_Interrupt () function to generate the interrupt but when I just call the sample_interrupt, I don't have a distance display in mm although with the new sample ready I have a show range.. How do you explain that ?

The other thing is if I want to add a new GPIO port from the mcu in which wait loop should I add the line of code to do it?

Thank you

Eleon BORLINI
ST Employee

Hi @MSAMB.1​ ,

my suggestion to you is to share at least a section of your code to get more help on this last question.

-Eleon

0693W000004GLIYQA4.png0693W000004GLIJQA4.pngHello @Eleon BORLINI​ 

Yes I've found the solution thanks evryone for helping me.

I sent you an example of my main code and my interrupt code. I've just take another pin of the MCU to command the LED it was very simple when my MCU detect the interruption my LED blink but I've add another LED who should take on when no target is detected and off when target is detected. Sorry for my english i'm french.

In the bottom you will see the code. Thank you

Good job @MSAMB.1​ !

-Eleon

Thanks @Eleon BORLINI​ ,

I want now to make the calibration of the sensor to correct errors like precision and others I want to do that with a protection support, should I call the xtalk calibrat or the offset calibrate to do that ? Thanks for your response

Hi @Julien NGUYEN​ , we never closed this post... could you help @MSAMB.1​  on this topic?

Thanks

-Eleon

Julien NGUYEN
ST Employee

​Hi MSAMB, there is two calibrations . One is the offset calibration and the second one is the xtalk calibration.

You only need to do the calibration if you are looking for high precision measurement. If you only want to check if something/someone is present. You won't need.

If you add a cover glass (you called it protection support), depending on the cover glass (thickness, air-gap(distance between the sensor and the cover glass)) you may need to calibrate the cover glass. You may check out the application note DT0032 on st.com to learn how to calibrate the crosstalk I hope it helps. Thanks, Julien


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.