PAJ7620 edits

blakadder 2019-11-02 00:52:08 +01:00
parent 79cae57430
commit 99d7c144be
2 changed files with 54 additions and 46 deletions

@ -267,6 +267,7 @@ Sensor20<a id="Sensor20"></a>|[Nova Fitness SDS011](Wemos-D1-Mini-and-Nova-Fitne
Sensor27<a id="Sensor27"></a>|[APDS-9960](APDS-9960) sensor commands<BR>`0` = enable light level and proximity sensor / disable gestures *(default)* <BR> `1` = enable gesture mode/ disable light level and proximity sensor<BR> `2` = enable gestures with half gain / disable light and proximity sensor<BR>`3..255` = Set [ATIME register](APDS-9960#known-issues) for different integration times
Sensor29<a id="Sensor29"></a>|MCP23008 / MCP23017 I<sup>2</sup>C GPIO Expander configuration ([additional details](MCP23008-MCP23017))<BR>`Reset<x>` = reset all pins<BR>x = `1..6`<BR>`1` = INPUT mode, no reporting, no pull-up<BR>`2` = INPUT mode, report on CHANGE, pull-up enabled<BR>`3` = INPUT mode, report on LOW, pull-up enabled<BR>`4` = INPUT mode, report on HIGH, pull-up enabled<BR>`5` = OUTPUT mode (if enabled by `#define USE_MCP230xx_OUTPUT`)<BR>`6` = inverted OUTPUT mode (if enabled by `#define USE_MCP230xx_OUTPUT`)<BR><BR>`pin,pinmode{,intpullup\|outstate{,repmode}}`<br>[Continue reading...](MCP23008-MCP23017#device-configuration)
Sensor34<a id="Sensor34"></a>|&emsp; »6.6.0<BR>[HX711 load cell](https://github.com/bogde/HX711) sensor calibration<BR>`1` = reset display to 0<BR>`2` = start calibration<BR>`2` `<value>` = set reference weight in grams and start calibration<BR>`3` = show reference weight in grams<BR>`3` `<value>` = set reference weight in grams<BR>`4` = show calibrated scale value<BR>`4` `<value>` = set calibrated scale value<BR>`5` = show max weight in gram<BR>`5` `<value>` = set max weight in grams<BR>`6` = show single item weight in grams<BR>`6` `<value>` = set single item weight in grams. Once the item weight is set, when items are added to the scale, the telemetry message will report `Count` as the number of items on the scale<BR>`7` = save current weight to be used as start weight on restart<BR>`8` `0/1` &emsp; »6.6.0.13<BR>&emsp;`0` = disable JSON message on weight change over 4 grams<BR>&emsp;`1` = enable JSON message on weight change over 4 grams
Sensor50<a id="Sensor50"></a>|[PAJ7620](PAJ7620) gesture sensor<BR>`0` = sensor muted, no readings in Tasmota<BR>`1`= gesture mode<BR>`2` = proximity mode<BR>`3` = corner mode<br>`4` = PIN mode<br>`5` = cursor mode
Sensor53<a id="Sensor53"></a>|[Smart Meter Interface](Smart-Meter-Interface)<BR>`r` = reset the driver with a new descriptor specified with the Tasmota [Scripting](Scripting-Language) language.<BR>`c<x> <value>` = preset counter (x = `1..5`) to `value` when the driver is set to counter mode<BR>`d<x>` = disable data decoding and dump meter (x = `1..5`) data to the Console. This is used to decipher the meter's data format to define the variable encoding in the meter's descriptor.<BR>`d0` = disable data dump mode and revert to decoding mode.
TempRes<a id="TempRes"></a>|Temperature sensor resolution<BR>`0..3` = maximum number of decimal places
VoltRes<a id="VoltRes"></a>|Voltage sensor resolution<BR>`0..3` = maximum number of decimal places

@ -1,11 +1,15 @@
PAJ7620U2 is an integrated gesture recognition sensor from PixArt-Imaging Inc. based on infrared. It also has a built-in proximity detection and can sense various properties like position (x,y,z) and speed.
Compared to the APDS-9960 this sensor is roughly 3-4 times the price, but delivers its data without the need for expensive computations on the ESP8266. Gestures are read from one single I2C-register und only light post-processing is applied.
**This feature is not included in precompiled binaries.** To use it you must [compile your build](compile-your-build). Add the following to `user_config_override.h`:
```
#ifndef USE_PAJ7620
#define USE_PAJ7620 // PAJ7620 gesture sensor (I2C address 0x73) (+2.5k code)
#endif
```
----
PAJ7620U2 is an integrated gesture recognition sensor from PixArt-Imaging Inc. based on infrared. It also has built-in proximity detection and can sense various properties like position (x,y,z) and speed.
Gesture recognition seems to be more stable than with the [APDS-9960](APDS-9960), which on the other hand is a lot cheaper.
## Usage:
Simple I2C-connection with the usual configuration in Tasmota.
## Wiring breakout boards
### Wiring breakout boards
| Breakout | ESP8266 |
|----------|-----------|
| VCC/VIN | +3.3VDC |
@ -14,60 +18,63 @@ Simple I2C-connection with the usual configuration in Tasmota.
| SDA | GPIO I<sup>2</sup>C SDA |
| INT | NC |
### Tasmota configuration
Compile Tasmota with `#define USE_PAJ7620` uncommented in `user_config_override.h`
After configuring the GPIO's the driver will detect the PAJ7620 automatically.
> After restart Tasmota needs some time to completely configure its state. In this time frame it is likely to miss some gestures. This should stabilize after a few moments.
***
### Commands
To use the sensor you need to switch to the desired mode of operation with
`Sensor50 <x>` where \<x> = `0…5`. It will not appear in the webUI but it can be observed via MQTT messages in console.
## Commands:
## **Sensor50 0…5:**
#### `0` - Off
Sensor muted, no readings in Tasmota.
#### `1` - Gesture Mode
Reports gesture movement with:
&emsp;`Up`
&emsp;`Down`
&emsp;`Left`
&emsp;`Right`
&emsp;`Near`
&emsp;`Far`
&emsp;`CW` _(clockwise rotation)_
&emsp;`CCW` _(counter-clockwise rotation)_
>As expected, "Near" and "Far" gestures are tricky and you have to train your movements to catch them. Sometimes the sensor reports "Near" and "Far" at once (which will be discarded).
There is some postprocessing to allow the object (hand or finger) to move into the sensing area and delay the initial direction report (up, down, left, right) to give the chance to trigger (the intended) "Near" or "Far" movement. Especially "Far" is a bit harder to achieve.
### 0 - No readings / muted sensor
### 1 - Gesture Mode:
gesture names: Up, Down, Left, Right, Near, Far, CW (clockwise rotation), CCW (counter-clockwise rotation)
TELE-message:
…{Up:1}
…{Left:3} -> 3 times „Left“ in a row, without any other gesture in between
example:
`…{Up:1}` = up gesture once
`…{Left:3}` = left gesture 3 times in a row, without any other gesture in between
### 2 - Proximity Mode:
Arbitrary values between 0 (far away) and 255 (very near) are given. Exit from the sensor field will always give at least one „zero message“. TELE is only triggered, when the value has changed
TELE-message:
…{Proximity:255} - virtually touching the sensor in close proximity
…{Proximity:0} - object has left the sensing volume
#### `2` - Proximity Mode
Arbitrary values between 0 (far away) and 255 (very near) are given. Exit from the sensor field will always give at least one "zero message". `tele` is only triggered, when the value has changed.
### 3 - Corner Mode:
Quarters of the sensing volume(area) are organised like this:
example:
`…{Proximity:255}` = close proximity, almost touching the sensor
`…{Proximity:0}` = object has left the sensing area
| 1 | 2 |
|----------|-----------|
| 3 | 4 |
#### `3` - Corner Mode
Sensing area is organised in quarters. An object in one of the corners will trigger the corresponding number.
| 1 | 2 |
|:-:|:-:|
| 3 | 4 |
An object in one of the corners will trigger the corresponding number, a bit like a pie menu in a GUI.
TELE-message:
…{Corner:2} - upper right corner
example:
`…{Corner:2}` = object in upper right corner
### 4- PIN mode:
Based on the corner mode a fluent movement of an object through a given sequence of corners (e.g. 1,2,3,4 -> begin upper left, move right, move diagonally down left, move right) will trigger a valid „PIN“. The next corner must be reached in about 0.7 seconds.
TELE-message:
…{PIN:1} - valid PIN
#### `4` - PIN Mode:
A fluent movement of an object through a given sequence of corners (similar to unlocking a smartphone) will trigger a valid "PIN". The next corner must be reached in about 0.7 seconds.
### 5- Cursor mode:
Shows x- and y-coordinates, mainly intended for debugging and „seeing“ the sensing area. This reads only the upper 5-bit-values, which automatically removes much of the jitter, giving values between 0 and 15.
TELE-message:
…{x:1, y:15} - upper left corner
example:
`…{PIN:1}` = valid PIN
#### `5` - Cursor Mode:
Shows x- and y-coordinates. Mainly intended for debugging and "seeing" the sensing area. This reads only the upper 5-bit-values, which automatically removes much of the jitter, giving values between 0 and 15.
***
Gesture recognition seems to be more stable than with the APDS-9960, which on the other hand is a lot cheaper.
As expected NEAR and FAR gestures are tricky and you have to train your movements to catch them. Sometimes the sensor reports NEAR and FAR at once (which will be discarded).
There is some postprocessing to allow the object (hand or finger) to move into the sensing area and delay the initial direction report (up, down, left, right) to give the chance to trigger (the intended) NEAR or FAR movement. Especially FAR is a bit harder to achieve.
After restart TASMOTA needs some time to completely configure its state. In this time frame it is likely to miss some gestures. This should stabilize after a few moments.
example:
`…{x:1, y:15}` = upper left corner
The sensor provides some more goodies, like velocity of an object, so if someone has a fancy use case for this, feel free to open a feature request.
Of course it would be possible to mix the modes, but this can produce a lot of TELE-messages. This could be added later upon user request (based on real world use cases).
Of course it would be possible to mix the modes, but this can produce a lot of examples. This could be added later upon user request (based on real world use cases).