Neonode Touch Sensor Module can be used to send keyboard or mouse input to a computer using a microcontroller board. The mouse pad and keyboard example (zForceKeyboardMouse) is included in our zForce Arduino Library. The example uses the official Arduino libraries <Mouse.h> and <Keyboard.h.> to communicate with the host system through HID.
The zForceKeyboardMouse example can be implemented on any surface, or adapted to be used as an in-air solution by including click-on-touch functionality. The example can be used as a base for a customized control panel or keyboard controller.
The zForceKeyboardMouse example showcase how touch input can be translated to mouse or keyboard input. The example enables SAMD micro based boards (e.g. Neonode Prototyping Board) to send keystrokes or mouse navigation to the host system by using the official Arduino libraries <Mouse.h> and <Keyboard.h>, through HID.
The example divides the Touch Active Area into one mouse pad and a keyboard section, containing 5 buttons (A-E). The mouse section works like a relative mouse pad, where the cursor moves relatively to its previous position. The Keyboard buttons are programmed to print the letters A-E when a touch is being preformed in each corresponding section.
We can access the touch data from the sensor module through the zForce Arduino library
Touch events are included in the touch notification message and are used to describe the current reported touch event. The touch events are used to trigger buttons and left-clicks in the MouseKeyboard example, and are defined in the Arduino Library.
Mouse Pad Touch handling
Since the Touch Sensor Module is recognized as a touch screen digitizer, the touch input data needs to be extracted in order to translate it as mouse input. To calculate the objects relative movement, the current touch is subtracted with the precious touch in the absolute space.
A left-click action is preformed once the touch object exit the Touch Active Area. In practice, this means that the end user would needs to both "press" and "release" their finger within the TAA in order to preform a left-click action.
This means that the end user would have to first "press" and "release" their finger in a tapping motion in order to preform a touch. The touch sensitivity can be adjusted by the global variable holdTime, which acts like a timer for how long a "touch" can take. To optimize the tactile response for in-air applications, please refer to section Click-on-Touch for In-Air Applications for further information.
The zForceKeyboardMouse evaluates the left-click action by the touch events:
Keyboard Touch Handling
The keyboard buttons will send a key press depending on the position of the touch object. Each buttons are sectioned by the variable keyboardBoundary, and are thereafter sectioned further to distinguish each key.
If a reported touch with a DOWN-event is positioned within the keyboardBoundary, a second look-up will be preformed in order to evaluate which key to print.
Click-on-Touch for In-Air Applications
For in-air solution, the Touch Sensor Module gives a higher tactile response when the touch object triggers an action on the DOWN-event, instead of the UP-event. Meaning that a "left-click" or "button presses" would be be triggered when the end user first enters the Touch Active Area.
Please refer to the below click-on-touch adjustment for the mouse pad:
- Holders for the Touch Sensor Modules
- Neonode Prototyping Board
- Interface Library for Arduino
- USB HID Communication Example
- Multi-Sensor Example Application
- I2C Mouse pad and Keyboard Example
- Selected Touch Area
- Touch Device Handling