meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| sensor:paj [2026/02/10 13:57] – vamsan | sensor:paj [2026/02/10 18:52] (current) – vamsan | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== LamaPLC: Pixart gesture recognition sensors/ | ====== LamaPLC: Pixart gesture recognition sensors/ | ||
| - | {{ : | + | {{ : |
| - | The PAJ7620U2 is a sophisticated | + | The PAJ7620U2 is a highly integrated |
| - | The sensor module integrates an optical lens and an infrared (IR) LED, enabling effective operation | + | The sensor module integrates an optical lens and an infrared (IR) LED to function even in low-light or dark environments. |
| **Key Features** | **Key Features** | ||
| - | * **Supported Gestures: | + | * **Supported Gestures:** 9 basic gestures: Up, Down, Left, Right, Forward, Backward, Clockwise (CW) circle, Counter-clockwise (CCW) circle, and Wave. Some modules support up to 13 gestures in a slower mode. |
| - | * **Interface: | + | * **Interface: |
| - | * **Operating Voltage: | + | * **Operating Voltage:** Typically 2.8V to 3.6V (sensor chip); breakout boards often include |
| - | * **Detection Distance: | + | * **Detection Distance:** Effective range of 5 cm to 15 cm, with some setups reaching |
| * **Ambient Light Immunity: | * **Ambient Light Immunity: | ||
| * **Power Consumption: | * **Power Consumption: | ||
| Line 16: | Line 16: | ||
| * **Gesture speed:** 60~600°/s in Normal Mode and 60~1200°/s in Gaming Mode | * **Gesture speed:** 60~600°/s in Normal Mode and 60~1200°/s in Gaming Mode | ||
| - | ==== Pinout | + | ==== Arduino wiring |
| - | ^Pin^Name^Description| | + | * SCL: A5 |
| - | |1|VCC / VIN|Power supply typically 3.3V, but boards with a regulator support 3.3V–5V | + | * GND: GND |
| - | |2|GND|Ground| | + | |
| - | |3|SCL|I²C Serial Clock| | + | * Vdd: 5V |
| - | |4|SDA|I²C Serial Data| | + | ==== Arduino code ==== |
| - | |5|INT|Interrupt pin (Active Low): it goes low when a gesture is detected detected| | + | |
| - | //*: If using a module that specifies 5V compatibility (like the Waveshare or Gravity series), you can safely use either 3.3V or 5V.// | ||
| - | ==== Arduino code ==== | ||
| - | A popular and well-documented library for the PAJ7620U2 is the " | ||
| <code c> | <code c> | ||
| - | #include " | + | sample |
| - | + | ||
| - | RevEng_PAJ7620 sensor = RevEng_PAJ7620(); | + | |
| - | + | ||
| - | void setup() { | + | |
| - | Serial.begin(9600); | + | |
| - | while (!Serial); // Wait for Serial Monitor to open (especially for boards like ESP32) | + | |
| - | + | ||
| - | Serial.println(" | + | |
| - | + | ||
| - | if (!sensor.begin()) { // Initialize the sensor | + | |
| - | Serial.println(" | + | |
| - | while(1); // Stop program if initialization fails | + | |
| - | } | + | |
| - | Serial.println(" | + | |
| - | } | + | |
| - | + | ||
| - | void loop() { | + | |
| - | Gesture gesture = sensor.readGesture(); | + | |
| - | + | ||
| - | switch (gesture) { | + | |
| - | case GES_FORWARD: | + | |
| - | Serial.println(" | + | |
| - | break; | + | |
| - | case GES_BACKWARD: | + | |
| - | Serial.println(" | + | |
| - | break; | + | |
| - | case GES_LEFT: | + | |
| - | Serial.println(" | + | |
| - | break; | + | |
| - | case GES_RIGHT: | + | |
| - | Serial.println(" | + | |
| - | break; | + | |
| - | case GES_UP: | + | |
| - | Serial.println(" | + | |
| - | break; | + | |
| - | case GES_DOWN: | + | |
| - | Serial.println(" | + | |
| - | break; | + | |
| - | case GES_CLOCKWISE: | + | |
| - | Serial.println(" | + | |
| - | break; | + | |
| - | case GES_ANTICLOCKWISE: | + | |
| - | Serial.println(" | + | |
| - | break; | + | |
| - | case GES_WAVE: | + | |
| - | Serial.println(" | + | |
| - | break; | + | |
| - | case GES_NONE: | + | |
| - | // No gesture detected, do nothing or handle as needed | + | |
| - | break; | + | |
| - | } | + | |
| - | + | ||
| - | delay(100); // Small delay to prevent excessive serial output | + | |
| - | } | + | |
| </ | </ | ||