Browse over 10,000 Electronics Projects

Gesture recognition with Arduino

Gesture recognition with Arduino

The selected time is a global one and thus is associated with all the digital outputs that are driven as monostable ones. In other words, once selected, for example a 5 seconds time will be associated with all the monostable outputs. It isn’t possible to associate different times for each output.

Please notice that the bistable mode means that the output inverts its state at each associated gesture recognition; thus a detection energizes the output, a later detection will bring it to sleep mode, and so on. The monostable mode, on the other hand, energizes the output associated with the gesture and keeps it for the selected time. If the gesture associated with the output is caught before the time has expired, the same will be rearmed, thus extending the energizing of the associated output.

As hinted during the library’s description, the gestures that are recognized and made available to the user are in a total of 25; of these, only a part is returned to the relay outputs, managed by the FT1079K boards.  Table shows the correspondences between the recognized gesture and the relay output, addressed to the FT1079K board.

 

Gestic-11

 

If so desired, it is possible to return the missing gestures to the relay outputs as well, but to do so we need to add at least another FT1079K with the 0x02 address; once this has been done, the code needed to manage the new board should obviously be written.

 

MGC3130_Leonardo

Let’s describe now the demo created with the Leonardo Rev. 3 board. The purpose of this sketch is to command an image management software by means of the gestures recognized by the MGC3130 integrated circuit. First of all, let’s talk about the program used for the demo we are analyzing: it is the “FastStone Image Viewer” program, that can be downloaded freely

After having installed the software on your PC, please continue with the configuration of its possible launch by means of a combination of keys; to do so you need to click with the right button on the program icon and under the “Collegamento” entry, and to set the shortcut keys. In our case we set the “CTRL+ALT+F1” combination, as shown by figure.

 

Gestic-12



Advertisement1


 

With this precaution we may set a gesture for the software start and as many gestures for the images’ management. The mechanism to interact with the PC software by means of gestures has to be activated; to  do so we arranged two possible actions: the first consists in using the P1 and P2 buttons, found on the electrode board. The P1 button, if pressed for more than two seconds, activates the software management mechanism on the PC; if on the other hand the P2 button is pressed for more than two seconds, the mechanism is deactivated. The other method consists in using the serial monitor, in order to activate the ‘S’ ASCII character, vice versa ‘P’ is used to deactivate it.

The activation by means of the P1 button or ASCII ‘S’ character recalls the activation functions of the mouse and keyboard services, made available by the Leonardo board:

 

Keyboard.begin();
Mouse.begin();

Vice versa, the P2 button or the ‘P’ ASCII character recalls the deactivation functions of the abovementioned services:

 

Keyboard.end();
Mouse.end();

 

The activation/deactivation by means of ASCII characters turns out to be useful in the case in which the Arduino Leonardo Rev.3 board is connected to electrode boards that are different from the ones used for the sketchup. For example, the electrodes we showed in the previous episodes, or something else. Once this preparatory operation has been executed, the system is ready to recognize the gestures and, consequently, to interact with the images management software.

To open the program, it is enough to tap once on the central electrode: the program will be opened and the available images will be shown. To browse the images, please use the “West to East” and “East to West” gestures: the first one browses the images by going to the right, and the second one does it by going to the left. To see the images in full screen mode, it is enough to Tap once on the “West” electrode, and to exit the full screen view it is enough to Tap once on the “East” electrode.

To enlarge a picture (Zoom +) please perform an “Edge West to East ” gesture, and to reduce the picture (Zoom -) please perform an “Edge East to West ” gesture. When we are looking at a zoomed in picture in full screen mode, it is possible to move the enlarged picture via the gestures, ”West to East”, “East to Ovest”, “North to South” and “South to North”.

Finally, it is possible to rotate the selected pictures: to do so please perform a circular clockwise movement, in order to rotate the picture to the right, and a counterclockwise movement to rotate the picture to the left. To close the software, you just need to double Tap on the central electrode.

 

Original article published at Open Electronics.

 

[tps_footer][/tps_footer]

Pages: 1 2 3 4 5

 


Top