-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library for CircuitPython 5 may not be working, CLUE sensor issues #16
Comments
As suggested, tried the simpletest.py example from the APDS9960 repo. It's an improvement. With the simpletest.py example, CLUE is able to detect gestures from further away and has a higher detection rate, but still misses a lot of gestures. The CLUE sensor orientation relative to the example code is off by 90 degrees (up/down is actually left/right), which is no big deal. I filmed a demo which draws a circle on the TFT indicating the detected gesture (as described in previous paragraph, the orientation is off by 90 degrees). You can see the detection is a bit spotty. Link to video here: https://photos.app.goo.gl/UeAvNZfYXnDgnF4z7 Code running in demo is below: import board
import busio
import displayio
from adafruit_apds9960.apds9960 import APDS9960
from adafruit_display_shapes.circle import Circle
LEFT = 20
MIDDLE = 100
RIGHT = 160
TOP = 20
BOTTOM = 160
i2c = busio.I2C(board.SCL, board.SDA)
apds = APDS9960(i2c)
apds.enable_proximity = True
apds.enable_gesture = True
splash = displayio.Group(max_size=2)
display = board.DISPLAY
display.show(splash)
color_bitmap = displayio.Bitmap(display.width, display.height, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0xFFFFFF
bg_sprite = displayio.TileGrid(color_bitmap,x=0,y=0,pixel_shader=color_palette)
splash.append(bg_sprite)
circle = Circle(120, 120, 30, fill=0xFF0000, outline=0xFF00FF)
splash.append(circle)
fill_list = [0xFF0000, 0X00FF00]
fill_index = 0
while True:
gesture = apds.gesture()
if (gesture):
fill_index = (fill_index + 1) % 2
circle.fill = fill_list[fill_index]
if gesture == 0x01:
circle.x = MIDDLE
circle.y = TOP
#print("top")
elif gesture == 0x02:
circle.x = MIDDLE
circle.y = BOTTOM
#print("bottom")
elif gesture == 0x03:
circle.x = LEFT
circle.y = MIDDLE
#print("left")
elif gesture == 0x04:
circle.x = RIGHT
circle.y = MIDDLE
#print("right") |
OK! the detection is off by 90 degrees cause the sensor is rotated on the CLUE compared to a breakout |
Related: gestures being triggered (prox > gesture_proximity_threshold) freeze the returned proximity value. E.g. if the threshold is at the default 50, the returned proximity value to 'lock in' when it reaches 51. Setting teh threshold to 255 allows proximity to work property throughout it's full 0-255 range. |
FYI, If the RGBC values are of interest, the current defauls set the ADC Integration Time Register (0x81) register to I've also noticed |
I've created two new issues for the two related issues mentioned in this thread. |
@TheKitty @geekmomprojects The gesture sensor is not great. It requires a learning curve involving things like moving slowly etc. I'm closing this issue as the initial report is not something that can be resolved - it is how the sensor works. I will be creating a new issue to add rotation to this library to be able to implement in the CLUE library to handle the sensor rotation. |
As mentioned, looks like #25 dealt with this. |
Debra (@geekmomprojects on Twitter) has been trying to use the Light + Gesture + Proximity: APDS9960 on CLUE and it has been either returning no value (distance) or irregular values (gesture). This library is quite old (9/2017) and may not be entirely functional under CircuitPython 5. I also posted in the CLUE library.
The text was updated successfully, but these errors were encountered: