Raspberry Pi Pico
Gesture Sensor ADPS9960
The ADPS-9960 is a sensor that detects gestures, proximity and ambient light colour. You communicate with it over I2C. This is a simple project to use the sensor to allow me to move forward and backward in a presentation by swiping my hand over the sensor.
I already had the Sparkfun breakout for this chip,
This Fritzing diagram shows the Adafruit breakout for the same chip.
You need the following libraries for this.
Here is the program. I have left in the IFs for all 4 gestures in case the way you connect your board means that the gesture works better along another axis.
from time import sleep import board import busio import usb_hid from adafruit_apds9960.apds9960 import APDS9960 from adafruit_hid.keyboard import Keyboard from adafruit_hid.keycode import Keycode # specify I2C pins i2c = busio.I2C(board.GP17, board.GP16) apds = APDS9960(i2c) apds.enable_proximity = True apds.enable_gesture = True kbd = Keyboard(usb_hid.devices) while True: gesture = apds.gesture() if gesture == 0x01: kbd.send(Keycode.LEFT_ARROW) print("Up") sleep(1) elif gesture == 0x02: kbd.send(Keycode.RIGHT_ARROW) print("Down") sleep(1) elif gesture == 0x03: print("left") elif gesture == 0x04: print("right")
After a few goes, you can work out the best way to move your hand to trigger the sensor. You have to be reasonably close. It doesn't quite look as magical as you might have hoped. It does, however, work well enough that you can use it as your 'clicker' when presenting.