Usually IR sensors are used to detect the presence of human or any other infrared objects. But the Grove Human Presence sensor has 4 IR sensors integrated. You can not only detect human presence or motion, you could even use the data to determine the movement direction of the infrared object. As shown in the picture, when you wave your hand from different side of the sensor, you’ll get different signals.
So I decided to use the human presence detector to capture hand motions and use the motion captured to control YouTube playback. Because YouTube only allow you to fast forward 5 seconds every time you click the right button. With the Python code, I can fast forward 20 seconds every time I wave my hand.
Besides, you can reprogram the Python code to make different combination of keys. For example, you can use it to turn pages of your e-book.
To replicate the project, you can follow the following steps.
Step 1Connect your Arduino with your computer and the IR sensor. The IR sensor should be plugged into an I2C port.
Download the Grove_Human_Presence_Sensor Library from Github. Then include it into your Arduino library. You can refer to How to install library to install library for your Arduino.
Step 3Copy and paste the Arduino code below into your Arduino IDE. Then compile and upload it into your Arduino board.
Step 4Click ‘Tool -> Serial Monitor ’ to test the motion capture function.
After the test, copy and paste the Python code below into your Python editor. Remember to install the pyserial and pynput library. If you don’t know how to do it. Just open your terminal and type 'pip install pyserial' and 'pip install pynput'.
Step 6Execute the Python file and play with your own gesture controller!
Comments
Please log in or sign up to comment.