The Magic Wand Example
Introduction
The magic wand example shows how to detect gestures using an accelerometer. Different types of accelerometers are easily available:
Hardware
I mounted the accelerometer onto a WeMos D1 prototype board. With the triple base and the CPU this makes up for a stable assembly that can easily be moved without cable contact problems.
Hardware connections
The MPU6050 is connected to the WeMos D1 bus as follows:
XDA and XCL are foreseen to control an external I2C bus, These pins are currently not used. AD0 allows to modify the MPU6050 I2C address and is also not used.
The ADXL345 is connected as follows:
While the MPU6050 and the ADXL345 use the I2C bus, I connected the LIS3DH to be used with the Serial Peripheral Interface (SPI) as follows:
LIS3DH |
SPI pins |
WeMos D1 bus |
GPIO |
Vcc |
|
3.3V |
|
GND |
|
GND |
|
SCL |
SCK |
D5 |
GPIO 18 |
SDA |
MOSI |
D7 |
GPIO 23 |
SDO |
MISO |
D6 |
GPIO 19 |
CS |
CS |
D0 |
GPIO 26 |
INT1 |
|
D1 |
GPIO 22 |
INT2 |
|
D2 |
GPIO 21 |
ADC1 |
|
D3 |
GPIO 16 on ESP32 WROOM, GPIO 25 on ESP32 WROVER-B model T7 V1.5 |
ADC2 |
|
D4 |
GPIO 17 on ESP32 WROOM, GPIO 27 on ESP32 WROVER-B model T7 V1.5 |
ADC3 |
|
D8 |
GPIO 5 |
Providing a training data set
In order to provide a training data set we must be able to record gestures. We must therefore provide a program that recognizes the start and the end of a gesture (movement and inactivity detection) and which records the accelerometer data of the gesture onto a file. Gesture detection is of course also needed to be able to feed the accelerometer data into the trained model, which will then recognize the gesture.
--
Uli Raich - 2022-02-02
Comments