Giter Club home page Giter Club logo

apds-9960_rgb_and_gesture_sensor's People

Contributors

adamsilva avatar andyengland521 avatar loricrotser avatar marshalltaylorsfe avatar merdok avatar nseidle avatar per1234 avatar robert-hunke avatar shawnhymel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apds-9960_rgb_and_gesture_sensor's Issues

Arduino uno with apds-9960

Hi, When I connect APDS-9960 to my arduino uno and run GestureTest example, In init process, I always get 0x9F, when read value from APDS9960_ID register, what's wrong with it

Delete issue

Please delete this issue. I cannot do it by myself.

Sensor code running but sensor not detecting gesture

I have downloaded the files from, here, the code seems to be running, on uploading the sketch to the arduino the code shows running but the gesture sensor is not detecting any gesture, on the other hand the proximity detection and ambiance light color detection works perfectly fine. Kindly help!

Arduino uno with apds-9960

I connect vcc to 3.3V, SDA to A4, SCL to A5. BUt when i try to run proximitysensor.ino in my serial monitor i have only this:

SparkFun APDS-9960 - ProximitySensor

and nothing else... how i can fix it ??

Usage of Wire library.

In the file "APDS-9960_RGB_and_Gesture_Sensor/Libraries/Arduino/APDS-9960_RGB_and_Gesture_Sensor_Arduino_Library/src/SparkFun_APDS9960.cpp", the function "wireWriteDataBlock()" is not used, but it contains a bug.

The sequence should be: beginTransmission - write - write -write - endTransmission
However, instead of writing data, a Wire.beginTransmission() is called (multiple) times.
At the moment it is at line 2152.

Sensor not working with a glass cover above it

I'm using a glass cover (90% IR transmittance) on top of the sensor. Because of this there's always data in the FIFO and it's stuck in this if statement -

if( (gstatus & APDS9960_GVALID) == APDS9960_GVALID ) {
.......}

From what I understood, the FIFO becomes empty after the gesture is completed and then it enters this else statement -

else {
    
            /* Determine best guessed gesture and clean up */
            delay(FIFO_PAUSE_TIME);
            decodeGesture();
            motion = gesture_motion_;
#if DEBUG
            Serial.print("END: ");
            Serial.println(gesture_motion_);
#endif
            resetGestureParameters();
            return motion;
        }

and the final gesture is determined. So the gesture is not being detected because it never enters this else statement. How can I solve this problem? Thanks!

ADSP9960 Interrupt is issuing interrupt. Weired isn't it?

Hi,
I am facing a weird kind of problem. Int pin is not issuing interrupt some times. I have tried with almost 5 to 6 modules. what could be cause of error?
Here is snippet of code

// Initialize APDS-9960 (configure I2C and initial values)
    if (apds.init()) {
        printf("APDS-9960 initialization complete\n");
    } else {
        printf("Something went wrong during APDS-9960 init!\n");
    }

// Adjust the Proximity sensor gain
    if (!apds.setProximityGain(PGAIN_8X)) {
        printf("Something went wrong trying to set PGAIN\n");
    }

// Set proximity interrupt thresholds
    if (!apds.setProximityIntLowThreshold(PROX_INT_LOW)) {
        printf("Error writing low threshold\n");
    }
    if (!apds.setProximityIntHighThreshold(PROX_INT_HIGH)) {
        printf("Error writing high threshold\n");
    }

// Start running the APDS-9960 proximity sensor (with interrupts)
    if (apds.enableProximitySensor(true)) {
        printf("Proximity sensor is now running in Interrupt mode\n");
    } else {
        printf("Something went wrong during sensor init!\n");
    }

while (1) {   // Read the proximity value
        if (!apds.readProximity(proximity_data)) {
            printf("Error reading proximity value\n");
        } else {
            printf("Proximity: %u\n", proximity_data);
        }
        if(!apds.clearProximityInt()){
            printf("Error in clearing Interrupt \n");
        }
    }

Copy a color to RGB LED (KY09 RGB LED SMD Tri Color Module) using APDS9960 RGB color sensor

i am using the following sketch to copy color to RGB LED using APDS9960 RGB sensor.

the sketch was uploaded successfully, but the LED is not working when color is put in front of the sensor!

#include <Wire.h>
#include "Adafruit_APDS9960.h"
Adafruit_APDS9960 apds;

#define redpin 3
#define greenpin 5
#define bluepin 6

#define commonAnode false

byte gammatable[256];

void setup() {
Serial.begin(9600);
Serial.println("Color View Test!");

if (apds.begin()) {
Serial.println("Found sensor");
} else {
Serial.println("No TCS34725 found ... check your connections");
while (1); // halt!
}

pinMode(redpin, OUTPUT);
pinMode(greenpin, OUTPUT);
pinMode(bluepin, OUTPUT);

for (int i=0; i<256; i++) {
float x = i;
x /= 255;
x = pow(x, 2.5);
x *= 255;

if (commonAnode) {
  gammatable[i] = 255 - x;
} else {
  gammatable[i] = x;      
}
//Serial.println(gammatable[i]);

}
}

void loop() {
//create some variables to store the color data in
uint16_t clear, red, green, blue;

//wait for color data to be ready
while(!apds.colorDataReady()){
delay(5);
}

//get the data and print the different channels
apds.getColorData(&red, &green, &blue, &clear);
Serial.print("red: ");
Serial.print(red);

Serial.print(" green: ");
Serial.print(green);

Serial.print(" blue: ");
Serial.print(blue);

Serial.print(" clear: ");
Serial.println(clear);
Serial.println();

delay(1000);
// Figure out some basic hex code for visualization
uint32_t sum = clear;
float r, g, b;
r = red; r /= sum;
g = green; g /= sum;
b = blue; b /= sum;
red *= 256; green *= 256; blue *= 256;
Serial.print("\t");
Serial.print((int)r, HEX); Serial.print((int)g, HEX); Serial.print((int)b, HEX);
Serial.println();

analogWrite(redpin, gammatable[(int)r]);
analogWrite(greenpin, gammatable[(int)g]);
analogWrite(bluepin, gammatable[(int)b]);
}

Use all sensors

Hi,
How can I use in same time all sensors: color sensor, gesture senor and proximity sensor?

setProximityGain has no effect in ProximitySensor.ino example

Changing the PGAIN value in line 61 in the example ProximitySensor.ino has no effect. This is because the enableProximitySensor function (line 66) sets the DEFAULT_PGAIN. Therefore PGAIN changes through setProximityGain needs to be done after enabling the sensor.

Esp8266 GestureTest

I tried to use the library on esp8266, but it was constantly rebooting....

Gesture Sensor Interrupt Frozen on 8266?

On a wemos mini I think I am getting INT lockups for the gesture sensor.
I am still getting brightness readings over i2c ok.

It seems like the swipe works good for the first 15-30 swipes but then will stop working, or if I leave it running overnight in the morning the gesture sensor no longer activates.

I put a 2 second timeout in the apds.readGesture() function to try an avoid lockups if an object gets placed in front of the sensor but that didnt help.

Init not working

Everything is hooked up ok to my Arduino Uno, but then when the program is run it seems to freeze at the following statement (breakpoint B isn't executed). What could be the problem?

--from init method--
/* Read ID register and check against known values for APDS-9960 */
if( !wireReadDataByte(APDS9960_ID, id) ) {
Serial.println("breakpoint B");
return false;
}

Gesture and proximity don't work well together

I have this in my setup():

 // Initialize interrupt service routine
 attachInterrupt(0, interruptRoutine, FALLING);

 // Initialize APDS-9960 (configure I2C and initial values)
 if ( apds.init() ) {
   Serial.println(F("APDS-9960 initialization complete"));
 } else {
   Serial.println(F("Something went wrong during APDS-9960 init!"));
 }
 
 // Adjust the Proximity sensor gain
 if ( !apds.setProximityGain(PGAIN_2X) ) {
   Serial.println(F("Something went wrong trying to set PGAIN"));
 }
 
 // Start running the APDS-9960 proximity sensor (no interrupts)
 if ( apds.enableProximitySensor(false) ) {
   Serial.println(F("Proximity sensor is now running"));
 } else {
   Serial.println(F("Something went wrong during sensor init!"));
 }

   // Start running the APDS-9960 gesture sensor engine
 if ( apds.enableGestureSensor(true) ) {
   Serial.println(F("Gesture sensor is now running"));
 } else {
   Serial.println(F("Something went wrong during gesture sensor init!"));
 }

And the values from the proximity are either 41 or below 10, but if I remove the if ( apds.enableGestureSensor(true) ) {... then it works well with values between 0 and 255.

How can I make both of those features to work well together?

Error with last commit in "GestureTest"

Hi,

The example "GestureTest" doesn't work (For hardware compatibility ) :
because interrupt management is not correct :

attachInterrupt(0, interruptRoutine, FALLING);
must be
attachInterrupt(APDS9960_INT, interruptRoutine, FALLING);

and loop() must be :
void loop() {
if( isr_flag == 1 ) {
detachInterrupt(APDS9960_INT);
handleGesture();
isr_flag = 0;
attachInterrupt(APDS9960_INT, interruptRoutine, FALLING);
}
}

Sensor will NOT work if logiclevel converter used

Very strange, i bought such a sensor and also a bidirectional converter. But if i use this, the demo gesture sketch tells me that the sensor could not be initialized. I measured the voltages and can confirm the levelconverter works correct. On APDS-Side it uses 3.3V for SCA,SCL and also INT (i know it's not necessary, but so what the board has 4 converters on it) and on the Arduino Uno side 5V for logic level.

Now, after playing around for a while a decided to test the signals (! NOT Vcc, for shure!) without the converter, hence i know it possible kill my sensor... But for some reason it then works! I'm confused. Checked everything double, test again, but it is that way: using a converter -> no chance. without it -> all right.

Can somebody clearify this? The sensor is the simple one, without any extra logic on board. Just the cap and the pullups.

Color Sensing

Can you please give me a hint, what the color sense (RGB feature) does?
I tried it but somehow the results aren't consistent
It always shows almost equal amounts of R G and B about 1/3 of the total ambient light
I tried to put the sensor in front of something Blue or Green or Red, but nothing changed too drasticaly.

Is this the feature or does it do something else ?

Function "disableProximitySensor()" is unimplemented.

bool disableProximitySensor() function is not implemented, calling it results in compile error. See line 342 of SparkFun_APDS9960.cpp.

The following function definition should give it the proper functionality.

/**

  • @brief Ends the Proximity sensor on the APDS-9960
    *

  • @return True if sensor disabled correctly. False on error.
    */
    bool SparkFun_APDS9960::disableProximitySensor()
    {
    if (!setProximityIntEnable(0)) {
    return false;
    }
    if (!setMode(PROXIMITY, 0)) {
    return false;
    }

    return true;
    }

Multiple troubles with the readings

I have bought an apds9960 sensor and attached it to my MKR1000 board. The library is saying initialization complete but then proximity readings are always 0. the Color Sensor and Ambient light examples are working but the readings of green and blue are wrong (-1, 0). What could be the problem? thanks.
I was thinking is a problem with the IR led.

Easier code - comparison is always true

Hello,
I have translated the file "SparkFun_APDS9960.cpp" with a very niggling compiler and found some little warnings "comparison is always true" and "comparison is always false":

First warning:

bool SparkFun_APDS9960::setMode(uint8_t mode, uint8_t enable)
..  /* Change bit(s) in ENABLE register */
    enable = enable & 0x01;
    if( mode >= 0 && mode <= 6 ) {

-> My suggestion:

bool SparkFun_APDS9960::setMode(uint8_t mode, uint8_t enable)
..  /* Change bit(s) in ENABLE register */
    enable = enable & 0x01;
    if(mode <= 6 ) {

Second warning:

int SparkFun_APDS9960::readGesture()
{
    uint8_t fifo_level = 0;
    uint8_t bytes_read = 0; 
...
if( bytes_read == -1 ) {
                    return ERROR;
                }

-> My suggestion:

int SparkFun_APDS9960::readGesture()
{
    uint8_t fifo_level = 0;
    int8_t  bytes_read = 0; //not uint8_t

With my changes the code is a little bit easier.

Why U,D,L,R registers sometimes give out of range values like 255?

I've set GFIFOTH to trigger an interrupt when the fifolevel is greater than 8 datasets. In the interrupt handler I read the U,L,D,R registers until GFLVL is zero within a while loop and stored the values into an array, so that I can compare the initial and final values to decode my gesture. But I have been getting values such as 255 in the registers. Following are the values I obtained while debugging, the first time it went to the interrupt handler when I waved my hand from left to right.

U int[100] [19, 35, 65, 125, 216, 255, 255, 255, 255, 255, 255, 255, 255, 244, 34, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...]
D int[100] [20, 38, 70, 122, 197, 255, 255, 255, 255, 255, 255, 255, 255, 168, 27, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...]
L int[100] [7, 9, 19, 34, 70, 138, 255, 255, 255, 255, 255, 255, 255, 255, 39, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...]
R int[100] [39, 63, 117, 200, 255, 255, 255, 255, 255, 255, 255, 255, 255, 53, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...]

With values such as this I'm totally out of range and I can't properly decode the gestures. Any ideas why this is happening?

Gesture recognition fails if one diode pair is deactivated

Hi,
there is a problem in the gestur recognition if you deactivate one pair of the photodiodes via the
"Gesture Configuration Three Register (0xAA)" register.
If one gesture dimension is switched off the complete recognition does not work anymore. It always returns NONE.
A quick fix seems to be by commenting out the lines 816-820 and changing the AND (&&) in line 803 and 836 into a OR (||).

ESP8266 NA_STATE Issue

I seem to be getting the following error when compiling on ESP8266 (NodeMCU 1.0).
What's also weird is that the ESP8266WiFi "-" error only appears when I utilize your library. If I'm using the Adafruit one, everything works properly (but I'd like to use yours).
The errors appear even when the sketch is completely empty (only utilizing your library), so even though I hope it's an issue on my side, I doubt it is.

`/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/ESP8266WiFi/src/include/wl_definitions.h:46:18: error: expected identifier before '-' token
 #define NA_STATE -1
                  ^
/Users/user/Documents/Arduino/libraries/SparkFun_APDS9960_RGB_and_Gesture_Sensor/src/SparkFun_APDS9960.h:198:3: note: in expansion of macro 'NA_STATE'
   NA_STATE,
   ^
/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/ESP8266WiFi/src/include/wl_definitions.h:46:18: error: expected '}' before '-' token
 #define NA_STATE -1
                  ^
/Users/user/Documents/Arduino/libraries/SparkFun_APDS9960_RGB_and_Gesture_Sensor/src/SparkFun_APDS9960.h:198:3: note: in expansion of macro 'NA_STATE'
   NA_STATE,
   ^

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.