MMM-Switch
is a MagicMirror addon module.
This module uses just one HC-SR04 ultrasonic sensors to determine hand position to produce a "Swipe Right".
The module is also prepared to use two ultrasonic sensor to also produce a "Swipe left".
- Navigate into your MagicMirror's
modules
folder and executegit clone https://github.com/DanielHfnr/MMM-Switch.git
. Change with cd into the new created folder named MMM-Switch. - Execute
npm install
to install the dependencies
To use this module, add it to the modules array in the config/config.js
file:
modules: [
{
config: {
module: 'MMM-Switch',
position: 'middle_center', // Doesnt matter
config: {
triggerRightPin: 18,
triggerLeftPin: 17,
echoRightPin: 24,
echoLeftPin: 23,
leftDistance: 10,
rightDistance: 10,
intervall: 2,
}
}
}
]
The following properties can be configured:
</tbody>
Option | Description |
---|---|
echoLeftPin |
Left Sensor's Echo pin. Example: 23
Default Value: 23
|
triggerLeftPin |
Left Sensor's Trigger pin. Example: 17
Default Value: 17
|
echoRightPin |
Right Sensor's Echo pin. Example: 24
Default Value: 24
|
triggerRightPin |
GPIO pin that will be activated when you "press" the sensors. Example: 18
Default Value: 18
|
leftDistance |
Distance in cm that will initiate the movement detection with the left sensor Example: 10
Default Value: 10
|
rightDistance |
Distance in cm that will initiate the movement detection with the right sensor Example: 10
Default Value: 10
|
intervall |
Time intervall when distance is measured by the sensor. Example: 2
Default Value: 1
|