Comments: APDS-9960 RGB and Gesture Sensor Hookup Guide

Pages

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • dkadish / about 9 years ago / 2

    For the Leonardo, there are a few changes that you need to make.

    1. Use the level-shifter as they suggest.
    2. Use pin 0 as the interrupt, and set the interrupt number to 2. This is because interrupts are attached to different pins on the Leonardo and pins 2/3 (which are also interrupts 1/0) are connected to SDA/SCL.
    3. Add a delay after Serial.begin (10 ms should do, though I used 100).

  • Member #514055 / about 6 years ago / 1

    I'm trying to use the APDS-9960 with a Teensy 3.2 board. Everything worked great using the default interrupt of pin 2, but I want to use interrupt on pin 0. Teensy can configure any digital pin for interrupt. However, I am wondering if the sensor itself can accept something besides pin 2. Is there anything "hardwired" in the APDS-9960 in this regard? I have had no luck changing the interrupt so far.

    • There should not be anything hardwired in the APDS-9960. You just need to wire the INT pin to pin 0 of the Teensy and change #define APDS9960_INT 2 to #define APDS9960_INT 0 in the code. Hope that helps!

  • Member #803816 / about 6 years ago / 1

    i am having massive issues with this sensor, i have tried it on an uno and mega and keep getting this error on the the serial log when i try to use the code , and then nothing after that

    ===================================

    SparkFun APDS-9960 - GestureTest

    Something went wrong during APDS-9960 init

    Gesture sensor is now running

    • "Something went wrong during APDS-9960 init" usually indicates that your Arduino can't communicate with the sensor over I2C. I recommend checking your wiring again and making sure you're giving the sensor no more than 3.3V (it's not rated for 5V). If that's still not working, I recommend reaching out to our Technical Support staff, who should be able to help you out.

  • Member #1259389 / about 6 years ago / 1

    I'm having an issue with a design using the SparkFun 9960 library...... Not sure if its a library thing or an Arduino thing or what.... I've got gesture sensing and ambient light sensing all working great.... At first I was polling for gestures however I later added an interrupt handler that does nothing but set a boolean that is then polled upon. I also use that boolean to exit out of some longer tasks that don't need to complete if a gesture occurs....

    However in the end I'm having an issue with the ISR. I have it set to fire on a falling edge as such attachInterrupt(digitalPinToInterrupt(GESTURE_INT),isrGesture, FALLING);

    However it seems that if something is held in front of the sensor the system seems to head into the ISR and just hang there. I'm not currently using the proximity sensor but I even tried enabling it and setting the interrupt for it to false which didn't help. I also trie detaching the interrupt from within the ISR and re-attaching it in the main loop to no avail as well. At the moment things work quite well but its a bit annoying that the whole thing hangs up if something remains within its detection zone... Any one else have a similar issue?

    • If I remember correctly, the gesture engine in the APDS-9960 actually triggers the interrupt pin as soon as it thinks a gesture is starting (not when it's ended). If you look at the gesture example, you'll see that apds.isGestureAvailable() is called in the ISR to see if the gesture is actually ready and to prevent the code from just sitting in the ISR.

  • Member #1265742 / about 6 years ago / 1

    Hello, I´m using an Arduino Uno and without the level-shifter the gesture sketch is working...

    I want to use it with a Leonardo and/or a Micro which I tried with no succes, but because I didn´t use de I2C pins which are not located at the same pins as the Uno. But now I´m reading you I need the level-shifter for the Uno even for the Leonardo and Micro... So, although the Arduino board has a 3.3V supply, the I2C works with 5V, and the sensor needs those signals to be 3.3V?

    Could you please let me know what I have to do in order to make it work with them without risk of damage the sensor?

    Thank you

    • I2C is open drain, which means the highest voltage SCL and SDA will go to is whatever you pull them up to. There are pull-up resistors on the APDS-9960, which pull up the SCL and SDA lines to whatever voltage you provide on the VCC pin.

      So, if you connect the breakout board to your UNO and use 3.3V, you should be OK so long as you use the I2C pins on the UNO (and tell them to be I2C in code, which the library should do). Does that help?

  • Member #546807 / about 6 years ago / 1

    Hi all,

    I have to say what a brilliant company Sparkfun is! excellent documentation!

    Normally everything works 1st time, however now I'm trying to get the APDS-9960 to work with an Arduino Due. Now I have to say; this is one of the first times I've worked with a Due so don't shoot me if I missed something obvious, but how would this sketch have to be modified to work with an arduino Due?

    I've verified that the I2C part of things works with an I2C scanner (yes, I removed the jumper for pull ups on the BOB). Also I've found that all pins on the Due can be used as a external interrupt, so I went ahead and connected it to digital pin 22 and changed the 5 instances in the sketch to assign the pin number to 22 (int pin, pinmode, attachinterrupt (2x) and detachinterrupt), however during startup the sketch shows "Something went wrong during APDS-9960 init!" and then the confusing part "Gesture sensor is now running", with no further result whatsoever (if only people saw me through my window... LOL).

    Can someone tell me what i'm missing?

    regards,

    Richard

    • Sorry for the delayed response. Were you able to get this working?

      Having the init() fail likely means something went wrong in the I2C communication. Are you able to get it working on another Arduino, such as an UNO?

      • Member #1258894 / about 6 years ago / 1

        Took your advice and plugged the board into my MEGA with the same issue. I'm not entirely sure what's happening here...

        • Do you have an UNO or some other Arduino that uses a 328p you can try? The interrupt pins on the MEGA and DUE are different than the 328p, so I want to see if the problem is with the board or the code (and the 328p is a known good controller with the APDS-9960).

          • Member #1258894 / about 6 years ago / 1

            I don't believe I have an UNO so I'll poke around and check.

            • Which pins are you using on the MEGA? The I2C pins are 20 and 21 for that board. Can you get any of the examples without interrupts to work?

  • Member #1158172 / about 7 years ago / 1

    I am trying to use this sensor with the Leonardo Pro Micro and I cannot get it to work. The connections are as follows: pins 2 and 3 are used as SDA/SCL through a level shifter, pin 0 as the interrrupt also with a level shifter, and i set the interrupt number to 2 in the GestureTest.ino. I'm guessing i need to make some changes to SparkFun_APDS9960.h or SparkFun_APDS9960.cpp. Can someone help?

    • Member #1158172 / about 7 years ago / 1

      Oh and just to add to this, i set the delay(100) after Serial.begin() like dkadish suggested, and the ProximitySensor.ino sketch works. The problem I'm having with the GestureTest.ino is that I'm not getting any prints on the Serial monitor.

      • Member #1158172 / about 7 years ago / 1

        Ok well this is really embarrassing, I solved it. I just had to be patient and wait a few minutes with for the Serial monitor to start displaying values, I have no idea why this is the case, and no i did not set any delays except the one mentioned in the last comment and I'm sure it's set to 100 milliseconds.

        • Glad to hear it worked out! The delay might be something to do with the Leonardo (or other 32u4-based boards). See this post on checking for Serial comms with the Leonardo.

  • Member #917217 / about 7 years ago / 1

    I'm using the starter kit above and IDE 1.8.2. I added the library following guide. The name of the library folder in Documenti/ARDUINO/libraries is APDS9960RGB. But at the startup IDE says me that the library is invalid, so I can't find and use your example. Is it possibile to fix it?

    Thanks!

  • Jargo / about 7 years ago / 1

    I think setting AGAIN does not work? Changes to it has no effect to any of the ambient readings R, G, B, or A. apds.setAmbientLightGain(AGAIN_1X); makes no difference to measuring values when it is apds.setAmbientLightGain(AGAIN_64X); Changing the value directly to library init() function or setting it after init, no difference. Anyone else have tried this?

  • Member #803023 / about 8 years ago / 1

    I’d like to use this with my Netduino Plus 2. I am coding in Visual Studio 2015 in C#. Are there any References available for this? If not, then what is the best way of making this device easily accessible in C# using the Micro Framework?

  • Member #728774 / about 9 years ago / 1

    how to use for Edison_intel? in my Edison, it isn't work....

  • ME heat o nator / about 9 years ago / 1

    Can the APDS-9960 board be added to the parts list? It seems like a good item to include.

  • Member #921772 / about 5 years ago / 0

    Where can I see the approximate consumption?

    • santaimpersonator / about 5 years ago / 1

      Hi there, it sounds like you are looking for technical assistance. Please use the link in the banner above, to get started with posting a topic in our forums. Our technical support team will do their best to assist you.

      Otherwise, here is the datasheet for the sensor. As listed by the datasheet, the supply current will vary depending on how the sensor is being utilized.


If you've found an issue with this tutorial content, please send us your feedback!