Code Monkey home page Code Monkey logo

mmm-swipe's Introduction

Module: MMM-Swipe

The MMM-Swipe program is a MagicMirror addon module. This module uses 2 HC-SR04 ultrasonic sensors to determing hand position to produce a "Swipe Left", "Swipe Right", or "Press"

Installing the module

  1. Navigate into your MagicMirror's modules folder and execute git clone https://github.com/mochman/MMM-Swipe.git. A new folder labeled MMM-Swipe will appear, cd into it.
  2. Execute npm install to install the dependencies
  3. You will need to run sudo npm start instead of npm start in order to read/write to the GPIO pins.

Using the module

To use this module, add it to the modules array in the config/config.js file:

modules: [
	{
		module: 'MMM-Swipe',
		position: 'bottom_left',	// Doesn't matter after it's setup.  It should be blank.
									// Best results in one of the side regions like: bottom_left
		config: {
			// See 'Configuration options' for more information.
			echoLeftPin: 24, 		//Left Sensor's BCM Numbered Echo pin - REQUIRED
			triggerLeftPin: 23, 	//Left Sensor's BCM Numbered trigger pin - REQUIRED
			echoRightPin: 26, 		//Right Sensor's BCM Numbered Echo pin - REQUIRED
			triggerRightPin: 25, 	//Right Sensor's BCM Numbered trigger pin - REQUIRED
			useAsButton: false,		//Enable a GPIO output when you "press".
			buttonPin: 8,
			verbose: false,		
			calibrate: false	
		}
	}
]

This module will use the sendNotification(notification, payload) to send:
notification = 'MOVEMENT'
payload = 'Swipe Left', 'Swipe Right', or 'Press'

Please use as appropriate in your module using notificationReceived(notification, payload, sender)

Wiring the Sensors

Please wire the sensors using this diagram. Example: hcsr04.png

Remember to use the GPIO numbers, not actual pins. For example, if you want to use the defaults and you have a Raspberry Pi 2/3, echoLeftPin should be on GPIO24 (which is physical pin 18, etc...).

Configuration options

The following properties can be configured:

Option Description
echoLeftPin Left Sensor's Echo pin.

Example: 24
This value is REQUIRED
echoRightPin Right Sensor's Echo pin.

Example: 23
This value is REQUIRED
triggerLeftPin Left Sensor's Trigger pin.

Example: 26
This value is REQUIRED
triggerRightPin Right Sensor's Echo pin.

Example: 25
This value is REQUIRED
useAsButton If you want to enable a GPIO output when you "press", change this to true

Example: true
Default Value: false
triggerRightPin GPIO pin that will be activated when you "press" the sensors.

Example: 8
This value is REQUIRED if you enable useAsButton
leftDistance Distance in cm that will initiate the movement detection with the left sensor

Example: 20
Default Value: 20
rightDistance Distance in cm that will initiate the movement detection with the right sensor

Example: 20
Default Value: 20
verbose Will display swipe data to the screen for checking

Example: true
Default Value: false
calibrate This will dispay the distances read by your sensors so you can use a leftDistance & rightDistance that works for you.

Example: true
Default Value: true

mmm-swipe's People

Contributors

mochman avatar robinboehm avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.