HOW IT WORKS IN DETAILS?

1. The MCU configure the sensors to wait for any move. If some move occure, MCU will wake-up and cofigure the sensors to wait for two events:
 

-when you want to check the current status, you just need to look at the device. The MEMS sends a notification to the processor that the position was changed to horizontal relating to the ground or was quickly rotated, indicated locked or unlocked.

-once you put in your key in the lock, the MEMS sensor wakes up the processor to analyze movement

2. Algorithms:

Movement recognition:
- data from internal FIFO of the accelerometer are converted to degress (3 axis - Z,X,Y).

- we sum a whole distance (in degress) of the key. If the last readings indicate more than 160 deg (from the start point when the key was put in; can be customized) we can assume that the lock was locked or unlocked. We can also direction of the move. X axis should not change too much (small threshold) for a whole move.

- we compare the results with calibration data from the first usage (lock the door on the outdoor side) - we need to know type of the lock: horizontal/vertical, numer of rotations to lock, magnetic position

Door or lock recognition(version 2; optional):
- in the specific points of the key movement we register magnetic field in 3D
- then we compare it with stored in the calibration results
- now we can asses whether the door is door/lock A,B,C...
- sometimes we need to use magnetic sticker to change magnetic field
- it can be used in the single door recognition

3. A whole electronics needs to be placed on the key to track the key movement.

That's all. Easy and efficient :)