Skip to content

Module for Magic Mirror to switch pages with one ultrasonic sensor

Notifications You must be signed in to change notification settings

DanielHfnr/MMM-Switch

Repository files navigation

Module: MMM-Switch

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".

Installing the module

  1. Navigate into your MagicMirror's modules folder and execute git clone https://github.com/DanielHfnr/MMM-Switch.git. Change with cd into the new created folder named MMM-Switch.
  2. 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,
			}	
		}
	}
]

Configuration options

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

About

Module for Magic Mirror to switch pages with one ultrasonic sensor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published