{"id":9364,"date":"2020-11-03T20:14:22","date_gmt":"2020-11-03T20:14:22","guid":{"rendered":"https:\/\/wolles-elektronikkiste.de\/apds-9960-the-all-rounder"},"modified":"2024-08-11T13:33:07","modified_gmt":"2024-08-11T13:33:07","slug":"apds-9960-the-all-rounder","status":"publish","type":"post","link":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder","title":{"rendered":"APDS-9960 &#8211; the all-rounder"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">About the post<\/h2>\n\n<p>This post about the APDS-9960, more precisely the APDS-9960 module, is the first in a series about distance, motion, color and light sensors (a summary of the series can be found <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/sensor-comparison-ambient-light-proximity-motion?lang=en\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>). The APDS-9960 is the Swiss army knife among these sensors, because it offers:<\/p>\r\n<ul>\r\n<li>Gesture recognition<\/li>\r\n<li>Color Recognition (RGB)<\/li>\r\n<li>Proximity detection<\/li>\r\n<li>Ambient light sensoring<\/li>\r\n<\/ul>\r\n<p>The APDS-9960 can also be used as a motion sensor via proximity detection, but only within its limited working range of up to approx. 30 cm. The following video provides an overview of the various features. <\/p>\r\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\r\n<iframe loading=\"lazy\" title=\"APDS9960\" width=\"731\" height=\"411\" src=\"https:\/\/www.youtube.com\/embed\/VuqBVGs63NA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\r\n<\/div><\/figure>\r\n\n<p>The APDS-9960 has an amazing number of setting options and registers. Implementing this in a sketch is a significant effort. That&#8217;s why it&#8217;s a good idea to use a ready-made library that has already implemented a number of presets. I will use <a href=\"https:\/\/github.com\/sparkfun\/APDS-9960_RGB_and_Gesture_Sensor\" target=\"_blank\" rel=\"noopener noreferrer\">Sparkfun&#8217;s library<\/a> in this post. I also tried the <a href=\"https:\/\/github.com\/adafruit\/Adafruit_APDS9960\" target=\"_blank\" rel=\"noopener noreferrer\">library of Adafruit<\/a> and it works just as easily. However, more libraries are available on Github.<\/p>\r\n<p>Even if you use one of these libraries, I would still advise you to look a little into the <a href=\"https:\/\/www.mouser.de\/datasheet\/2\/678\/V02-4191EN_DS_APDS-9960_2015-11-13-909346.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">data sheet<\/a> of the APDS-9960 and to deal with the library itself, because not everything that this module is capable of is documented in the examples. In addition, it might make sense for one application or another not to simply adopt the presets but to look for better ones. <\/p>\r\n\n<h2 class=\"wp-block-heading\">Basics of the APDS-9960<\/h2>\n\n<h3 class=\"wp-block-heading\">The APDS-9960 sensor<\/h3>\n\n<p>The actual APDS-9960 sensor is the small rectangular, black block with the two lens-like openings. The data sheet is available <a href=\"https:\/\/www.mouser.de\/datasheet\/2\/678\/V02-4191EN_DS_APDS-9960_2015-11-13-909346.pdf\">here<\/a>, for example. From my point of view, it is definitely worth taking a look. <\/p>\r\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"688\" height=\"326\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/Sensor.png\" alt=\"The actual APDS-9960 sensor\" class=\"wp-image-2578\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/Sensor.png 688w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/Sensor-300x142.png 300w\" sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><figcaption class=\"wp-element-caption\">The APDS-9960 sensor<\/figcaption><\/figure>\n\n<p>The APDS-9960 has an IR LED whose reflected light is used for gesture and proximity detection. Since it has four directed photodiodes, it is able to detect simple gestures. These photodiodes are also used for proximity detection. Other photodiodes measure red, green, blue, and white light for color and ambient light detection. <\/p>\r\n<p>Communication with the APDS-9960 is via I2C with a clock rate of up to 400 kHz. The address is set to 0x39 and cannot be changed. Reading the I2C address is always a good first step to check if you have wired everything correctly. An <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/i2c-scanner?lang=en\" target=\"_blank\" rel=\"noopener noreferrer\">I2C Scanner<\/a> sketch can be used for this. <\/p>\r\n\n<h3 class=\"wp-block-heading\">The APDS-9960 module<\/h3>\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/APDS9960_Module.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"615\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/APDS9960_Module-1024x615.jpg\" alt=\"Two APDS-9960 modules\" class=\"wp-image-2588\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/APDS9960_Module-1024x615.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/APDS9960_Module-300x180.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/APDS9960_Module-768x461.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/APDS9960_Module-1320x793.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/APDS9960_Module.jpg 2001w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Two APDS-9960 modules<\/figcaption><\/figure>\n\n<p>Theoretically, of course, you can buy the bare sensor and add the electronics needed yourself. However, my skills are not sufficient for that and therefore I&#8217;m glad that the APDS-9960 is available as a module. <\/p>\r\n<p>Interestingly, such modules can be purchased from <a href=\"https:\/\/smile.amazon.de\/s?k=APDS-9960&amp;__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&amp;ref=nb_sb_noss_2\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a> in two price ranges. One is between three and ten euros and mainly includes manufacturers from China, the other is in the early-mid twenties, e.g. from Sparkfun. I can&#8217;t say whether the price difference is justified, as I have only tried some low-cost modules. However, I can at least confirm that the latter have problems with amplification (more on that later). This is also described in other posts, e.g. <a href=\"https:\/\/github.com\/arendst\/Sonoff-Tasmota\/wiki\/APDS-9960#known-issues\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>. <\/p>\r\n\n<p>Most APDS-9960 modules have the following pins:<\/p>\r\n<ul>\r\n<li><strong>GND<\/strong> &#8211; Ground<\/li>\r\n<li><strong>VCC<\/strong> &#8211; Power supply: 2.4 &#8211; 3.6 Volt<\/li>\r\n<li><strong>SDA\/SCL<\/strong> &#8211; I2C Connectors<\/li>\r\n<li><strong>INT<\/strong> &#8211; low active interrupt<\/li>\r\n<li><strong>VL<\/strong> &#8211; Power supply for IR LED: 3.0 &#8211; 4.5 volts<\/li>\r\n<\/ul>\r\n<p>You can supply the APDS-9960 via the 3.3 volt output of an Arduino UNO, but then you still have the problem that the I2C lines run at 5 volts. This can damage the APDS-9960. Therefore, one takes either a microcontroller that is operated with 3.3 volts, such as the <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module\" target=\"_blank\" rel=\"noopener noreferrer\">ESP-8266<\/a>, you use voltage dividers or you take level converters, such as this <a href=\"https:\/\/smile.amazon.de\/Cylewet-Konverter-bidirektional-Shifter-10-St%C3%BCck\/dp\/B076H5NSDX\/ref=sr_1_3_sspa?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&amp;keywords=Level+Konverter&amp;qid=1564137566&amp;s=gateway&amp;sr=8-3-spons&amp;psc=1\" target=\"_blank\" rel=\"noopener noreferrer\">one<\/a>.<\/p>\r\n\n<p>On most modules there are two jumpers, namely &#8220;PS&#8221; and &#8220;I2C PU&#8221;:<\/p>\r\n<ul>\r\n<li><strong>PS<\/strong> &#8211; if connected, the IR LED is supplied via the voltage to VCC. If not connected, the LED must be supplied separately via VL. It can make sense to leave PS unconnected and switch the LED via VL. According to the data sheet, the IR LED can influence the color and light measurement even though the sensors have an IR filter.<\/li>\r\n<li><strong>I2C PU<\/strong> &#8211; if connected, the I2C lines are connected to a pull-up resistor, which is quite convenient. <\/li>\r\n<\/ul>\r\n<p>As you can see at the top of the photo of the two APDS-9960 modules, one has closed the jumpers, the other they are open (I bought them like this). So check which version you have. <\/p>\r\n\n<h2 class=\"wp-block-heading\">Wiring: APDS-9960 module controlled by an Arduino UNO<\/h2>\n\n<p>The wiring is no surprise after the previous explanations.&nbsp;<\/p>\r\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/ADPS__9960.png\"><img loading=\"lazy\" decoding=\"async\" width=\"952\" height=\"951\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/ADPS__9960.png\" alt=\"APDS 9960 wiring with an Arduino UNO\" class=\"wp-image-2568\" style=\"width:476px;height:476px\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/ADPS__9960.png 952w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/ADPS__9960-150x150.png 150w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/ADPS__9960-300x300.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/ADPS__9960-768x767.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/ADPS__9960-600x600.png 600w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/ADPS__9960-542x542.png 542w\" sizes=\"auto, (max-width: 952px) 100vw, 952px\" \/><\/a><figcaption class=\"wp-element-caption\">Wiring: APDS 9960 controlled by an Arduino UNO<\/figcaption><\/figure>\n<\/div>\n<p>Whether VL &#8211; as shown &#8211; really needs to be connected to 3.3 V depends, as explained, on the setting of the jumper PS. The I2C lines do not have an external pull-up because the jumper I2C PU was connected. The LED on D13 is required for some example sketches. The same applies to the interrupt output connected to D2. The level converter needs a power supply at least on the 5 volt side. <\/p>\r\n\n<h4 class=\"wp-block-heading\">If it does not work<\/h4>\n\n<p>Der APDS9960 draws around 30 mA current. This can load the 3.3 volt output of an Arduino board to such an extent that the voltage falls below the 3 volts required for the IR_LED. In this case, you can either supply VL with a separate power source or try the 5 volt connection and measure how much voltage is actually provided under load. 3.0 to 4.5 volts is the recommended operating condition. Slightly exceeding 4.5 V should not be a problem. But of course, this is at your own risk. <\/p>\r\n\n<h2 class=\"wp-block-heading\">The Sparkfun library for the APDS-9960<\/h2>\n\n<p>The library is available <a href=\"https:\/\/github.com\/sparkfun\/APDS-9960_RGB_and_Gesture_Sensor\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> on Github. As usual, you download the Zip file and unzip it in the Arduino library folder. There you will also find the example sketches, which I present right away. <\/p>\r\n\n<h3 class=\"wp-block-heading\">Gesture detection<\/h3>\n\n<p>The library implemented the following gestures:<\/p>\r\n<ul>\r\n<li>Up\/Down<\/li>\r\n<li>Right\/Left<\/li>\r\n<li>Far\/Near<\/li>\r\n<li>None <\/li>\r\n<\/ul>\r\n<p>The first two pairs are self-explanatory. A &#8220;Far&#8221; is reported if you hold the hand very close to the sensor and then remove it vertically to the sensor until it is outside the detection range (approx. 30 cm). For a &#8220;Near&#8221; one approaches vertically and then pulls the hand to the side. The &#8220;Near&#8221; is not triggered until the hand has been pulled away. A &#8220;none&#8221; is reported for ambiguous movements.  <\/p>\r\n<p>In the library, the directions are referred to as DIR_UP, DIR_DOWN, DIR_RIGHT, etc. <\/p>\r\n\n<p>The included sample sketch for gesture detection is called GestureTest.ino. I have removed the general comments from the top of the sketchhere. Then I just added the important (!) line 34: <code>apds.setGestureGain(GGAIN_1X)<\/code>. More on that. Otherwise, the sketch is self-explanatory from my point of view. <\/p>\r\n\n<div class=\"scroll-paragraph-long\">\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"GestureTest.ino\" data-enlighter-title=\"GestureTest.ino\">#include &lt;Wire.h&gt;\r\n#include &lt;SparkFun_APDS9960.h&gt;\r\n\r\n\/\/ Pins\r\n#define APDS9960_INT    2 \/\/ Needs to be an interrupt pin\r\n\r\n\/\/ Constants\r\n\r\n\/\/ Global Variables\r\nSparkFun_APDS9960 apds = SparkFun_APDS9960();\r\nint isr_flag = 0;\r\n\r\nvoid setup() {\r\n\r\n  \/\/ Set interrupt pin as input\r\n  pinMode(APDS9960_INT, INPUT);\r\n\r\n  \/\/ Initialize Serial port\r\n  Serial.begin(9600);\r\n  Serial.println();\r\n  Serial.println(F(\"--------------------------------\"));\r\n  Serial.println(F(\"SparkFun APDS-9960 - GestureTest\"));\r\n  Serial.println(F(\"--------------------------------\"));\r\n  \r\n  \/\/ Initialize interrupt service routine\r\n  attachInterrupt(digitalPinToInterrupt(APDS9960_INT), interruptRoutine, FALLING);\r\n\r\n  \/\/ Initialize APDS-9960 (configure I2C and initial values)\r\n  if ( apds.init() ) {\r\n    Serial.println(F(\"APDS-9960 initialization complete\"));\r\n  } else {\r\n    Serial.println(F(\"Something went wrong during APDS-9960 init!\"));\r\n  }\r\n  apds.setGestureGain(GGAIN_1X); \/\/ ohne diese Zeile geht es nicht zuverl\u00e4ssig\r\n  \r\n  \/\/ Start running the APDS-9960 gesture sensor engine\r\n  if ( apds.enableGestureSensor(true) ) {\r\n    Serial.println(F(\"Gesture sensor is now running\"));\r\n  } else {\r\n    Serial.println(F(\"Something went wrong during gesture sensor init!\"));\r\n  }\r\n}\r\n\r\nvoid loop() {\r\n  if( isr_flag == 1 ) {\r\n    detachInterrupt(digitalPinToInterrupt(APDS9960_INT));\r\n    handleGesture();\r\n    isr_flag = 0;\r\n    attachInterrupt(digitalPinToInterrupt(APDS9960_INT), interruptRoutine, FALLING);\r\n  }\r\n}\r\n\r\nvoid interruptRoutine() {\r\n  isr_flag = 1;\r\n}\r\n\r\nvoid handleGesture() {\r\n    if ( apds.isGestureAvailable() ) {\r\n    switch ( apds.readGesture() ) {\r\n      case DIR_UP:\r\n        Serial.println(\"UP\");\r\n        break;\r\n      case DIR_DOWN:\r\n        Serial.println(\"DOWN\");\r\n        break;\r\n      case DIR_LEFT:\r\n        Serial.println(\"LEFT\");\r\n        break;\r\n      case DIR_RIGHT:\r\n        Serial.println(\"RIGHT\");\r\n        break;\r\n      case DIR_NEAR:\r\n        Serial.println(\"NEAR\");\r\n        break;\r\n      case DIR_FAR:\r\n        Serial.println(\"FAR\");\r\n        break;\r\n      default:\r\n        Serial.println(\"NONE\");\r\n    }\r\n  }\r\n}<\/pre>\r\n<p>\u00a0<\/p>\r\n<\/div>\r\n\n<h4 class=\"wp-block-heading\">The problem with amplification<\/h4>\n\n<p>The APDS-9960 offers for the detection of gestures the amplification factors 1, 2, 4 and 8, which control the sensitivity of the measurement. In the library, these are called GGAIN_1X, GGAIN_2X, etc. During initialization ( <code>apds.init()<\/code> ) DEFAULT_GAIN (= GGAIN_4x) is entered in the corresponding control register. Unfortunately, the modules do not cope with this gain factor. This applies at least to the cheap parts, I have obtained from three different Chinese sources. With eight- and four-fold gain it didn&#8217;t work at all, with double gain worked unreliably, but without gain (factor 1) it worked wonderfully. It is also not a mistake of the library, since the Adafruit library showed the same behavior. The whole issue took me a lot of time and nerves. <\/p>\r\n<p>By the way, if you set GGAIN only after <code>apds.enableGestureSensor()<\/code> and then you start the sketch, the gesture message &#8220;None&#8221; is triggered for no apparent reason. So better first adjust the gain and then turn on the gesture detection. <\/p>\r\n\n<h4 class=\"wp-block-heading\">Other gesture settings<\/h4>\n\n<p>As already mentioned, one is first overwhelmed by the setting options when looking at the data sheet. But apart from the GGAIN problem, the other presets chosen by the library work very well. Nevertheless, you might also want to &#8220;play around&#8221; with them. However, not all parameters are accessible through public functions. <\/p>\r\n<ul>\r\n<li> IR-LED current: <code>setGestureLEDDrive;<\/code>\r\n<ul>\r\n<li>the current controls the range of the gesture detection <\/li>\r\n<li> 12.5, 25, 50 and 100 mA are possible\r\n<ul>\r\n<li>LED_DRIVE_12_5MA, LED_DRIVE_25_MA, etc.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li> with 100 mA (default) you achieve a range of 30 cm and the maximum proximity value is at approx. 5 cm distance<\/li>\r\n<li>since the IR-LED pulses, the effective power consumption is much lower than the IR-LED current<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>IR_LED Boost: <code>setLEDBoost <\/code>\r\n<ul>\r\n<li>private function, not directly accessible<\/li>\r\n<li>to change the value, you would have to modify the function <code>enableGestureSensor<\/code> in Sparkfun_APDS9960.cpp and edit setLEDBoost or make a public function out of it<\/li>\r\n<li>Default value is 300, which is already the maximum<\/li>\r\n<li>for more details please look into the data sheet <\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>Pulse length\/pulse count of the IR LED:\r\n<ul>\r\n<li>not implemented as a function<\/li>\r\n<li>variable by changing DEFAULT_GESTURE_PPULSE in Sparkfun_APDS9960.h<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>Gesture waiting time: <code>setGestureWaitTime<\/code>\r\n<ul>\r\n<li>controls the time in low power mode between two gesture detection cycles<\/li>\r\n<li>8 values between 0 and 39.2 ms are possible; the parameters in the library are: GWTIME_0MS to GWTIME_39_2MS; default: 2.8 ms<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>plus a lot more &#8211; &gt; if you really want to know more: look into the library and the data sheet. <\/li>\r\n<\/ul>\r\n\n<h3 class=\"wp-block-heading\">Proximity detection<\/h3>\n\n<p>The proximity sensor does not provide distances in centimeters or millimeters, but a value between 0 and 255. The corresponding distance to this value depends, among other things, on the LED current and the gain. The included sample sketch is called ProximitySensor.ino. Here he is, but without the introductory comment lines and with a small change to which I will explain in a while: <\/p>\r\n\n<div class=\"scroll-paragraph-long\">\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"ProximitySensor.ino\" data-enlighter-title=\"ProximitySensor.ino\">#include\u00a0&lt;Wire.h&gt;\r\n#include\u00a0&lt;SparkFun_APDS9960.h&gt;\r\n\r\n\/\/\u00a0Global\u00a0Variables\r\nSparkFun_APDS9960\u00a0apds\u00a0=\u00a0SparkFun_APDS9960();\r\nuint8_t\u00a0proximity_data\u00a0=\u00a00;\r\n\r\nvoid\u00a0setup()\u00a0{\r\n\u00a0\u00a0\r\n\u00a0\u00a0\/\/\u00a0Initialize\u00a0Serial\u00a0port\r\n\u00a0\u00a0Serial.begin(9600);\r\n\u00a0\u00a0Serial.println();\r\n\u00a0\u00a0Serial.println(F(\"------------------------------------\"));\r\n\u00a0\u00a0Serial.println(F(\"SparkFun\u00a0APDS-9960\u00a0-\u00a0ProximitySensor\"));\r\n\u00a0\u00a0Serial.println(F(\"------------------------------------\"));\r\n\u00a0\u00a0\r\n\u00a0\u00a0\/\/\u00a0Initialize\u00a0APDS-9960\u00a0(configure\u00a0I2C\u00a0and\u00a0initial\u00a0values)\r\n\u00a0\u00a0if\u00a0(\u00a0apds.init()\u00a0)\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0Serial.println(F(\"APDS-9960\u00a0initialization\u00a0complete\"));\r\n\u00a0\u00a0}\u00a0else\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0Serial.println(F(\"Something\u00a0went\u00a0wrong\u00a0during\u00a0APDS-9960\u00a0init!\"));\r\n\u00a0\u00a0}\r\n\u00a0\u00a0\r\n\u00a0\u00a0\/\/\u00a0Start\u00a0running\u00a0the\u00a0APDS-9960\u00a0proximity\u00a0sensor\u00a0(no\u00a0interrupts)\r\n\u00a0\u00a0if\u00a0(\u00a0apds.enableProximitySensor(false)\u00a0)\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0Serial.println(F(\"Proximity\u00a0sensor\u00a0is\u00a0now\u00a0running\"));\r\n\u00a0\u00a0}\u00a0else\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0Serial.println(F(\"Something\u00a0went\u00a0wrong\u00a0during\u00a0sensor\u00a0init!\"));\r\n\u00a0\u00a0}\r\n\u00a0\u00a0\/\/\u00a0Adjust\u00a0the\u00a0Proximity\u00a0sensor\u00a0gain\r\n\u00a0\u00a0if\u00a0(\u00a0!apds.setProximityGain(PGAIN_2X)\u00a0)\u00a0{\u00a0\/\/\u00a0muss\u00a0nach\u00a0enableProximitySensor\u00a0aufgerufen\u00a0werden\r\n\u00a0\u00a0\u00a0\u00a0Serial.println(F(\"Something\u00a0went\u00a0wrong\u00a0trying\u00a0to\u00a0set\u00a0PGAIN\"));\r\n\u00a0\u00a0}\r\n}\r\n\r\n\r\nvoid\u00a0loop()\u00a0{\r\n\u00a0\u00a0\r\n\u00a0\u00a0\/\/\u00a0Read\u00a0the\u00a0proximity\u00a0value\r\n\u00a0\u00a0if\u00a0(\u00a0!apds.readProximity(proximity_data)\u00a0)\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0Serial.println(\"Error\u00a0reading\u00a0proximity\u00a0value\");\r\n\u00a0\u00a0}\u00a0else\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0Serial.print(\"Proximity:\u00a0\");\r\n\u00a0\u00a0\u00a0\u00a0Serial.println(proximity_data);\r\n\u00a0\u00a0}\r\n\u00a0\u00a0\r\n\u00a0\u00a0\/\/\u00a0Wait\u00a0250\u00a0ms\u00a0before\u00a0next\u00a0reading\r\n\u00a0\u00a0delay(250);\r\n}<\/pre>\r\n<p>&nbsp;<\/p>\r\n<\/div>\n\n<p>The change I made is swapping the order of the functions <code>apds.enableProximitySensor<\/code> and <code>apds.setProximityGain<\/code>. The latter sets the gain factor (PGAIN_1X, &#8230;_2X, &#8230; 4X, &#8230;_8X) for the proximity sensor. However, in the enable function, the default value is set, namely PGAIN_4X. If you want to change it, you have to do it <em>after<\/em> the enable function. I reported this little bug on Github as an &#8220;issue&#8221;, maybe it is already fixed when you install the library.<\/p>\r\n\n<h4 class=\"wp-block-heading\">Other proximity detection settings<\/h4>\n\n<p>The settings are very similar to the settings of the gesture detection:<\/p>\r\n<ul>\r\n<li>IR-LED current: <code>apds.LEDDrive;<\/code> \r\n<ul>\r\n<li>12.5, 25, 50 and 100 mA are selectable<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>IR-LED Boost: identical to IR-LED boost during gesture detection<\/li>\r\n<\/ul>\r\n<p>I don&#8217;t want to go more in the details &#8211; again I refer to the library and data sheet for those who want to go deeper.<\/p>\r\n\n<h3 class=\"wp-block-heading\">Proximity detection with interrupt<\/h3>\n\n<p>You can set an upper and lower threshold for the proximity value at which an interrupt is triggered. If you set the lower threshold (PROX_INT_LOW) to 0, then only a near-interrupt is triggered, because you never get a 0 due to the noise.<\/p>\r\n<p>The included example sketch is called ProximityInterrupt.ino. Again, I have moved the function for setting the PGAIN value behind the enable function, otherwise it would be ineffective. Otherwise, the sketch should be self-explanatory. <\/p>\r\n\n<div class=\"scroll-paragraph-long\">\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"ProximityInterrupt.ino\" data-enlighter-title=\"ProximityInterrupt.ino\">#include &lt;Wire.h&gt;\r\n#include &lt;SparkFun_APDS9960.h&gt;\r\n\r\n\/\/ Pins\r\n#define APDS9960_INT    2  \/\/ Needs to be an interrupt pin\r\n#define LED_PIN         13 \/\/ LED for showing interrupt\r\n\r\n\/\/ Constants\r\n#define PROX_INT_HIGH   200 \/\/ Proximity level for interrupt\r\n#define PROX_INT_LOW    0  \/\/ No far interrupt\r\n\r\n\/\/ Global variables\r\nSparkFun_APDS9960 apds = SparkFun_APDS9960();\r\nuint8_t proximity_data = 0;\r\nint isr_flag = 0;\r\n\r\nvoid setup() {\r\n  \r\n  \/\/ Set LED as output\r\n  pinMode(LED_PIN, OUTPUT);\r\n  pinMode(APDS9960_INT, INPUT);\r\n  \r\n  \/\/ Initialize Serial port\r\n  Serial.begin(9600);\r\n  Serial.println();\r\n  Serial.println(F(\"---------------------------------------\"));\r\n  Serial.println(F(\"SparkFun APDS-9960 - ProximityInterrupt\"));\r\n  Serial.println(F(\"---------------------------------------\"));\r\n  \r\n  \/\/ Initialize interrupt service routine\r\n  attachInterrupt(digitalPinToInterrupt(APDS9960_INT), interruptRoutine, FALLING);\r\n  \r\n  \/\/ Initialize APDS-9960 (configure I2C and initial values)\r\n  if ( apds.init() ) {\r\n    Serial.println(F(\"APDS-9960 initialization complete\"));\r\n  } else {\r\n    Serial.println(F(\"Something went wrong during APDS-9960 init!\"));\r\n  }\r\n  \r\n   \/\/ Set proximity interrupt thresholds\r\n  if ( !apds.setProximityIntLowThreshold(PROX_INT_LOW) ) {\r\n    Serial.println(F(\"Error writing low threshold\"));\r\n  }\r\n  if ( !apds.setProximityIntHighThreshold(PROX_INT_HIGH) ) {\r\n    Serial.println(F(\"Error writing high threshold\"));\r\n  }\r\n  \r\n  \/\/ Start running the APDS-9960 proximity sensor (interrupts)\r\n  if ( apds.enableProximitySensor(true) ) {\r\n    Serial.println(F(\"Proximity sensor is now running\"));\r\n  } else {\r\n    Serial.println(F(\"Something went wrong during sensor init!\"));\r\n  }\r\n   \/\/ Adjust the Proximity sensor gain\r\n  if ( !apds.setProximityGain(PGAIN_4X) ) {\r\n    Serial.println(F(\"Something went wrong trying to set PGAIN\"));\r\n  }\r\n}\r\n\r\nvoid loop() {\r\n  \r\n  \/\/ If interrupt occurs, print out the proximity level\r\n  if ( isr_flag == 1 ) {\r\n  \r\n    \/\/ Read proximity level and print it out\r\n    if ( !apds.readProximity(proximity_data) ) {\r\n      Serial.println(\"Error reading proximity value\");\r\n    } else {\r\n      Serial.print(\"Proximity detected! Level: \");\r\n      Serial.println(proximity_data);\r\n    }\r\n    \r\n    \/\/ Turn on LED for a half a second\r\n    digitalWrite(LED_PIN, HIGH);\r\n    delay(500);\r\n    digitalWrite(LED_PIN, LOW);\r\n    \r\n    \/\/ Reset flag and clear APDS-9960 interrupt (IMPORTANT!)\r\n    isr_flag = 0;\r\n    if ( !apds.clearProximityInt() ) {\r\n      Serial.println(\"Error clearing interrupt\");\r\n    }\r\n    \r\n  }\r\n}\r\n\r\nvoid interruptRoutine() {\r\n  isr_flag = 1;\r\n}<\/pre>\r\n<p>\u00a0<\/p>\r\n<\/div>\r\n\n<p>If you set PROX_INT_LOW to a value bigger than the basic noise, e.g. 50, then you have two thresholds at which an interrupt is triggered. <\/p>\r\n\n<h3 class=\"wp-block-heading\">Ambient light and color measurement<\/h3>\n\n<p>Ambient light and colour measurement can be explained both at a time. In fact, there is not much to explain. The AmbientLightInterrupt.ino sample sketch includes the relevant functions, including interrupts. The ambient light and color channels are reported as a dimensionless 16 bit number. There is no conversion to lux or similar. Two interrupt limits can be set for ambient light. <\/p>\r\n\n<div class=\"scroll-paragraph-long\">\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"AmbientLightInterrupt.ino\" data-enlighter-title=\"AmbientLightInterrupt.ino\">#include &lt;Wire.h&gt;\r\n#include &lt;SparkFun_APDS9960.h&gt;\r\n\r\n\/\/ Pins\r\n#define APDS9960_INT    2  \/\/ Needs to be an interrupt pin\r\n#define LED_PIN         13 \/\/ LED for showing interrupt\r\n\r\n\/\/ Constants\r\n#define LIGHT_INT_HIGH  800 \/\/ High light level for interrupt\r\n#define LIGHT_INT_LOW   100   \/\/ Low light level for interrupt\r\n\r\n\/\/ Global variables\r\nSparkFun_APDS9960 apds = SparkFun_APDS9960();\r\nuint16_t ambient_light = 0;\r\nuint16_t red_light = 0;\r\nuint16_t green_light = 0;\r\nuint16_t blue_light = 0;\r\nint isr_flag = 0;\r\nuint16_t threshold = 0;\r\n\r\nvoid setup() {\r\n  \r\n  \/\/ Set LED as output\r\n  pinMode(LED_PIN, OUTPUT);\r\n  pinMode(APDS9960_INT, INPUT);\r\n  \r\n  \/\/ Initialize Serial port\r\n  Serial.begin(9600);\r\n  Serial.println();\r\n  Serial.println(F(\"-------------------------------------\"));\r\n  Serial.println(F(\"SparkFun APDS-9960 - Light Interrupts\"));\r\n  Serial.println(F(\"-------------------------------------\"));\r\n  \r\n  \/\/ Initialize interrupt service routine\r\n  attachInterrupt(digitalPinToInterrupt(APDS9960_INT), interruptRoutine, FALLING);\r\n  \r\n  \/\/ Initialize APDS-9960 (configure I2C and initial values)\r\n  if ( apds.init() ) {\r\n    Serial.println(F(\"APDS-9960 initialization complete\"));\r\n  } else {\r\n    Serial.println(F(\"Something went wrong during APDS-9960 init!\"));\r\n  }\r\n  \r\n  \/\/ Set high and low interrupt thresholds\r\n  if ( !apds.setLightIntLowThreshold(LIGHT_INT_LOW) ) {\r\n    Serial.println(F(\"Error writing low threshold\"));\r\n  }\r\n  if ( !apds.setLightIntHighThreshold(LIGHT_INT_HIGH) ) {\r\n    Serial.println(F(\"Error writing high threshold\"));\r\n  }\r\n  \r\n  \/\/ Start running the APDS-9960 light sensor (no interrupts)\r\n  if ( apds.enableLightSensor(false) ) {\r\n    Serial.println(F(\"Light sensor is now running\"));\r\n  } else {\r\n    Serial.println(F(\"Something went wrong during light sensor init!\"));\r\n  }\r\n  \r\n  \/\/ Read high and low interrupt thresholds\r\n  if ( !apds.getLightIntLowThreshold(threshold) ) {\r\n    Serial.println(F(\"Error reading low threshold\"));\r\n  } else {\r\n    Serial.print(F(\"Low Threshold: \"));\r\n    Serial.println(threshold);\r\n  }\r\n  if ( !apds.getLightIntHighThreshold(threshold) ) {\r\n    Serial.println(F(\"Error reading high threshold\"));\r\n  } else {\r\n    Serial.print(F(\"High Threshold: \"));\r\n    Serial.println(threshold);\r\n  }\r\n  \r\n  \/\/ Enable interrupts\r\n  if ( !apds.setAmbientLightIntEnable(1) ) {\r\n    Serial.println(F(\"Error enabling interrupts\"));\r\n  }\r\n  \r\n  \/\/ Wait for initialization and calibration to finish\r\n  delay(500);\r\n}\r\n\r\nvoid loop() {\r\n  \r\n  \/\/ If interrupt occurs, print out the light levels\r\n  if ( isr_flag == 1 ) {\r\n    \r\n    \/\/ Read the light levels (ambient, red, green, blue) and print\r\n    if (  !apds.readAmbientLight(ambient_light) ||\r\n          !apds.readRedLight(red_light) ||\r\n          !apds.readGreenLight(green_light) ||\r\n          !apds.readBlueLight(blue_light) ) {\r\n      Serial.println(\"Error reading light values\");\r\n    } else {\r\n      Serial.print(\"Interrupt! Ambient: \");\r\n      Serial.print(ambient_light);\r\n      Serial.print(\" R: \");\r\n      Serial.print(red_light);\r\n      Serial.print(\" G: \");\r\n      Serial.print(green_light);\r\n      Serial.print(\" B: \");\r\n      Serial.println(blue_light);\r\n    }\r\n    \r\n    \/\/ Turn on LED for a half a second\r\n    digitalWrite(LED_PIN, HIGH);\r\n    delay(500);\r\n    digitalWrite(LED_PIN, LOW);\r\n    \r\n    \/\/ Reset flag and clear APDS-9960 interrupt (IMPORTANT!)\r\n    isr_flag = 0;\r\n    if ( !apds.clearAmbientLightInt() ) {\r\n      Serial.println(\"Error clearing interrupt\");\r\n    }\r\n    \r\n  }\r\n}\r\n\r\nvoid interruptRoutine() {\r\n  isr_flag = 1;\r\n}<\/pre>\r\n<p>\u00a0<\/p>\r\n<\/div>\r\n\n<p>Again, there are various setting options, especially the gain (AGAIN_YX with Y=1, 4, 16, 64), which you can set via the public <code><span class=\"pl-en\">setAmbientLightGain<\/span><\/code> function. <\/p>\r\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n<p>I find the APDS-9960 really impressive with its many features and options. Especially beautiful is the gesture function with which you can do nice things, e.g. turn the light on or off with certain gestures. Maybe you share my joy. Have fun! <\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>The APDS-9960 allows measuring gestures, distance, ambient light and color. The module and its functions are explained in this post. <\/p>\n","protected":false},"author":1,"featured_media":8150,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[573,572],"tags":[786,780,781,556,785,782,784,783],"class_list":["post-9364","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-distance-light-movement","category-sensors","tag-ambient-light-sensoring","tag-apds-9960-en","tag-apds-9960-module","tag-arduino-en-2","tag-color-measurement","tag-gesture-detection","tag-proximity-detection","tag-proximity-sensor-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>APDS-9960 - the all-rounder &#8226; Wolles Elektronikkiste<\/title>\n<meta name=\"description\" content=\"The APDS-9960 allows measuring gestures, distance, ambient light and color. The module and its functions are explained in this post.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"APDS-9960 - the all-rounder &#8226; Wolles Elektronikkiste\" \/>\n<meta property=\"og:description\" content=\"The APDS-9960 allows measuring gestures, distance, ambient light and color. The module and its functions are explained in this post.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder\" \/>\n<meta property=\"og:site_name\" content=\"Wolles Elektronikkiste\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-03T20:14:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-11T13:33:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/Beitragsbild.png\" \/>\n\t<meta property=\"og:image:width\" content=\"948\" \/>\n\t<meta property=\"og:image:height\" content=\"948\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Wolfgang Ewald\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Wolfgang Ewald\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder\"},\"author\":{\"name\":\"Wolfgang Ewald\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"headline\":\"APDS-9960 &#8211; the all-rounder\",\"datePublished\":\"2020-11-03T20:14:22+00:00\",\"dateModified\":\"2024-08-11T13:33:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder\"},\"wordCount\":1949,\"commentCount\":12,\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/Beitragsbild.png\",\"keywords\":[\"ambient light sensoring\",\"APDS-9960\",\"APDS-9960 module\",\"Arduino\",\"color measurement\",\"gesture detection\",\"proximity detection\",\"proximity sensor\"],\"articleSection\":[\"Distance, light, movement\",\"Sensors\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder\",\"name\":\"APDS-9960 - the all-rounder &#8226; Wolles Elektronikkiste\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/Beitragsbild.png\",\"datePublished\":\"2020-11-03T20:14:22+00:00\",\"dateModified\":\"2024-08-11T13:33:07+00:00\",\"description\":\"The APDS-9960 allows measuring gestures, distance, ambient light and color. The module and its functions are explained in this post.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder#primaryimage\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/Beitragsbild.png\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/Beitragsbild.png\",\"width\":948,\"height\":948},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/apds-9960-the-all-rounder#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"APDS-9960 &#8211; the all-rounder\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\",\"name\":\"Wolles Elektronikkiste\",\"description\":\"Die wunderbare Welt der Elektronik\",\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\",\"name\":\"Wolfgang Ewald\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"width\":512,\"height\":512,\"caption\":\"Wolfgang Ewald\"},\"logo\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"APDS-9960 - the all-rounder &#8226; Wolles Elektronikkiste","description":"The APDS-9960 allows measuring gestures, distance, ambient light and color. The module and its functions are explained in this post.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder","og_locale":"en_US","og_type":"article","og_title":"APDS-9960 - the all-rounder &#8226; Wolles Elektronikkiste","og_description":"The APDS-9960 allows measuring gestures, distance, ambient light and color. The module and its functions are explained in this post.","og_url":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder","og_site_name":"Wolles Elektronikkiste","article_published_time":"2020-11-03T20:14:22+00:00","article_modified_time":"2024-08-11T13:33:07+00:00","og_image":[{"width":948,"height":948,"url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/Beitragsbild.png","type":"image\/png"}],"author":"Wolfgang Ewald","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Wolfgang Ewald","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder#article","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder"},"author":{"name":"Wolfgang Ewald","@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"headline":"APDS-9960 &#8211; the all-rounder","datePublished":"2020-11-03T20:14:22+00:00","dateModified":"2024-08-11T13:33:07+00:00","mainEntityOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder"},"wordCount":1949,"commentCount":12,"publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/Beitragsbild.png","keywords":["ambient light sensoring","APDS-9960","APDS-9960 module","Arduino","color measurement","gesture detection","proximity detection","proximity sensor"],"articleSection":["Distance, light, movement","Sensors"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder","url":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder","name":"APDS-9960 - the all-rounder &#8226; Wolles Elektronikkiste","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#website"},"primaryImageOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder#primaryimage"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/Beitragsbild.png","datePublished":"2020-11-03T20:14:22+00:00","dateModified":"2024-08-11T13:33:07+00:00","description":"The APDS-9960 allows measuring gestures, distance, ambient light and color. The module and its functions are explained in this post.","breadcrumb":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder#primaryimage","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/Beitragsbild.png","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/07\/Beitragsbild.png","width":948,"height":948},{"@type":"BreadcrumbList","@id":"https:\/\/wolles-elektronikkiste.de\/en\/apds-9960-the-all-rounder#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/wolles-elektronikkiste.de\/en"},{"@type":"ListItem","position":2,"name":"APDS-9960 &#8211; the all-rounder"}]},{"@type":"WebSite","@id":"https:\/\/wolles-elektronikkiste.de\/en#website","url":"https:\/\/wolles-elektronikkiste.de\/en","name":"Wolles Elektronikkiste","description":"Die wunderbare Welt der Elektronik","publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wolles-elektronikkiste.de\/en?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46","name":"Wolfgang Ewald","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","width":512,"height":512,"caption":"Wolfgang Ewald"},"logo":{"@id":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png"}}]}},"_links":{"self":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/9364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/comments?post=9364"}],"version-history":[{"count":0,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/9364\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media\/8150"}],"wp:attachment":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media?parent=9364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/categories?post=9364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/tags?post=9364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}