Proximity Trinkey: factory program much more sensitive than

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mjmare
 
Posts: 2
Joined: Sun Jun 07, 2015 9:50 am

Proximity Trinkey: factory program much more sensitive than

Post by mjmare »

It seems that the program installed from factory is much more sensitive (detects at bigger distance) than the Circuitpython sample program (https://learn.adafruit.com/adafruit-pro ... brightness). Would be nice to have some info on how to change the settings.

Since I don't know how to restore the default program I cannot give actual numbers. I would say 30 cm (factory) vs 5 cm (CPY) for start of detection.


Using CPY 8 alpha.

User avatar
adafruit_support_carter
 
Posts: 29161
Joined: Tue Nov 29, 2016 2:45 pm

Re: Proximity Trinkey: factory program much more sensitive t

Post by adafruit_support_carter »

The shipped demo is actually an Arduino sketch. The code for it is here:
https://github.com/adafruit/Adafruit_Le ... o_Demo.ino

Here's a summary of the initialization done to the APDS:

Code: Select all

  apds.enableProximity(true);
  apds.setProxGain(APDS9960_PGAIN_8X);
  apds.setLED(APDS9960_LEDDRIVE_100MA, APDS9960_LEDBOOST_300PCNT);
  apds.setProxPulse(APDS9960_PPULSELEN_16US, 1);

  //set the interrupt threshold to fire when proximity reading goes above 2
  apds.setProximityInterruptThreshold(0, 2);
  apds.enableProximityInterrupt();
The APDS9960 CircuitPython library is here:
https://github.com/adafruit/Adafruit_Ci ... n_APDS9960
documentation here:
https://docs.circuitpython.org/projects ... en/latest/

User avatar
mjmare
 
Posts: 2
Joined: Sun Jun 07, 2015 9:50 am

Re: Proximity Trinkey: factory program much more sensitive t

Post by mjmare »

Thx Carter, your answer suggested some gain factor, which I managed to find in the CPY source code: APDS9960.proximity_gain.

When set to 3 (=8x=max) I noticed a definite improvement: the detection distances improves from about 5cm to about 20cm.

PS proximity_gain is not documented ASAICT.

Thanks for the help.

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”