Skip to content

MagicMirror Module for the HoverLabs hover gesture detector

License

Notifications You must be signed in to change notification settings

dancj/MMM-Hover

Repository files navigation

MMM-Hover

This is a MagicMirror module to communicate with the
HoverLabs Hover (Unofficial). The Hover can detect a hand direction swiping in front of it (Up, Down, Left, Right) and taps on the board surface (Top, Left, Bottom, Top, Middle).

Uses NPM package hover-nodejs, which is based on the original python library from HoverLabs, linked here.

Getting events from the Hover board is cool and all, but to make it useful these events can trigger notifications to other modules. For example, configured by default, swiping or tapping left/right will send off PAGE_DECREMENT and PAGE_INCREMENT for the MMM-pages module to change pages.

Installation

cd ~/MagicMirror/modules
git clone https://github.com/dancj/MMM-Hover

cd MMM-Hover && npm install

This installs required NPM packages. Set up your GPIO pins of choice in the config file.

If you have any suggestions, please let me know with an issue.

Using the module

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

modules: [
	{
		module: 'MMM-Hover',
		config: {
			// See 'Configuration options' for more information.
			i2cAddress: 0x42,
			pinTs: 23,
			pinReset: 24,
			pollRate: 10
		}
	}
]

To customize the events triggered by Hover events, use this option:

modules: [
	{
		module: 'MMM-Hover',
		config: {
			// See 'Configuration options' for more information.
			i2cAddress: 0x42,
			pinTs: 23,
			pinReset: 24,
			pollRate: 10,
			triggeredEvents: {
				tap: {
					north: "",
					south: "",
					west: "PAGE_DECREMENT",
					east: "PAGE_INCREMENT",
					center: ""
				},
				swipe: {
					up: "",
					down: "",
					left: "PAGE_DECREMENT",
					right: "PAGE_INCREMENT"
				}
			}
		}
	}
]

Raspberry Pi GPIO Pins

  1. HOST_V+ ---- 3V3 pin
  2. RESET ---- Any digital pin, for example: pin 18, GPIO 24 (BCM Mode)
  3. SCL ---- SCL pin
  4. SDA ---- SDA pin
  5. GND ---- Ground Pin
  6. 3V3 ---- 3V3 pin
  7. TS ---- Any digital pin, for example: pin 16, GPIO 23 (BCM Mode)

Configuration Options

The following properties can be configured:

Option Description
updateInterval Time in ms to update display
i2cAddress i2c address

Value from HoverLabs library: 0x42
pinTs Input pin for hover board, which will receive an 8-bit binary value to indicate the event type, gesture direction, and tap location.

Value from HoverLabs library: 23
Note: please use BCM numbering
pinReset Reset pin

Value from HoverLabs library: 24
Note: please use BCM numbering
pollRate Polling rate in milliseconds to check for input from hover board

Value from HoverLabs library: 1
debug Put module in debug mode (prints messages to browser console)

Default value: false
triggeredEvents Notifications that get fired off upon the different taps and swipes received from Hover. Empty strings result in no action.

Default value:
				{
					tap: {
						up: "",
						down: "",
						west: "PAGE_DECREMENT",
						east: "PAGE_INCREMENT",
						center: ""
					},
					swipe: {
						up: "",
						down: "",
						left: "PAGE_DECREMENT",
						right: "PAGE_INCREMENT"
					}
				}
  </td>
</tr>
</tbody>

Dependencies

Installed via npm install

Troubleshooting

  1. Page won't change

    • Check that LED on back of Hover board is lit. If not power wires are not correct
    • Check that python library from Hoverlabs works, found here. If this detects motion, you have the wiring correct.
    • Check that MMM-pages is installed, and you have multiple pages set up
    • Check config.js file.. by default when you swipe or tap left or right, it will trigger PAGE_INCREMENT and PAGE_DECREMENT

Developers

Run the test npm script, which runs linters

npm test

LICENSE

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

MagicMirror Module for the HoverLabs hover gesture detector

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published