Introduction: Gesture Controlled Universal Remote With Node-MCU
Hello everyone and welcome to this project! I am quite a lazy person and a lazy person's nightmare is to be watching TV when you realize that the remote is too far away! I realized that my remote will never be too far away if I have it on hand at all times. That inspired me to create LAZr, the gesture controlled universal remote.
In this project, I will be creating a glove equipped with sensors that are able to detect hand gestures and can send signals to a TV or other appliance with a simple finger movement.
I hope you like this project and vote for it in the Epilog Laser Contest!
Step 1: The Parts
This project contains the following parts:
A Glove ($5.00)
Node-MCU / ESP8266 ($3.00)
This is the microcontroller and the brains of this project. It has the ability to connect to WiFi, which makes it very useful in home automation applications and in projects like this one, as WiFi control can be implemented into this project.
5 Flex Sensors ($7.00 each)
These sensors measure bending, similar to how an LDR (Light Dependent Resistor), measure light levels. These are used to measure finger bending and hand gestures.
IR Transmitter ($0.30)
This component transmits IR signals to devices such as TVs, DVD players, etc.
IR Reciever ($1.00)
This component receives IR signals sent by remotes. It is needed to decode signals from remotes. This signals can then be used to control the appliance from the glove. I recommend the TSOP4838 since I have successfully tested it with Sharp, Samsung and Apple TVs.
5 10k Ohm Resistors ($0.01 each)
These resistors are needed for each of the Flex Sensors.
220 Ohm Resistor ($0.01 each)
These resistors are needed for each of the Flex Sensors.
The transistor is used for IR transmitting.
74HC4051N Multiplexer IC ($0.22)
Since the Node-MCU only has one analog port, this IC is used to "split" the analog pin into several, which are connected to the flex sensors. More on this later.
Lots of jumper cables! (If you decide to use a breadboard)
The following parts are optional but are helpful if used:
16 Pin IC Socket
Step 2: The Multiplexer IC (74HC4051N)
While the Node-MCU is packed with excellent features such as WiFi and Arduino IDE compatibility, it has its drawbacks. It only has one analog pin, which is insufficient for this project. Since the glove has five flex sensors, it requires five analog inputs to work. A simple and inexpensive solution to this problem is to use a Multiplexer IC (74HC4051N). This IC is able to convert one analog input into eight!
How Does it Work?
The IC works by turning on one analog input, reading it, and turning it off. It then turns on the next analog input. By doing this, it only reads one sensor at a time, sending it to the microcontroller's analog pin. The IC is able to turn on, read, and turn off the analog inputs so quickly that it seems as though it is reading them all at the same time. This is similar to how computer and smartphone screens work; Each pixel cannot have its own designated pin (that would be a disaster!), so it turns the pixels on and off so fast that our eyes perceive all of them as on at the same time. To function, the IC needs three digital pins. By changing the combinations of the on and off states of the pins, the IC is able to turn on and off all 8 analog inputs.
Step 3: Breadboard Layout
The layout of the device is shown in the image above.
IMPORTANT: Take note of the type of transistor you are using, the collector pin of the transistor should connect to the IR LED, and not the GND Pin.
Step 4: Receiving Signals
For the glove to know the correct signal to send, signals must be received from your TV/appliances remote and programmed into the glove's code. To receive these signals, an IR receiver is necessary.
Note: take a look at your TV remote's model number and try to find the signal specifications online. Some IR receiver and transmitters will not work with some remotes so it is important to find a transmitter/receiver with the frequency corresponding with your TV. I am using a 4838 IR Reciever which works with my Samsung TV remote.
Step 5: Code for Receiving Signals
To use the code the IRremoteESP8266 library must be downloaded. The download link is below:
In the Arduino IDE, go to Sketch > Include Library > Add .ZIP Library. Locate the two downloaded libraries and add them into the IDE. To access the code to receive IR signals, go to File > Examples > IRremoteESP8266 > IRrecvDumpV2. In the code, change the value kRecvPin from 14 to 5. This ensures that the Node-MCU is reading the correct pin (D1).
After wiring the breadboard connections, upload this code to your Node-MCU and open your serial monitor (set baud rate to 115200). If you press a button on your TV remote, the signals will be printed onto your serial monitor. Success!
You will see a long set of numbers with the value rawData. Record these numbers and make sure to record the button you pressed to get those numbers. You will need these later.
Step 6: PCB Schematic
The PCB Schematic was created in Autodesk Eagle and is as shown in the image above. All Eagle files are in this Instructable and can be downloaded in the next step.
Step 7: The PCB Design
Here is my PCB design. All the Eagle files for this circuit board are below, so you can use or modify this design to build your own PCB! I have added SMD pads for the extra 3 analog inputs as well as the 3V3 and GND port. This will allow me to expand this system if I ever need to, saving resources and time and making the PCB versatile.
Step 8: Putting It All Together
After waiting a couple of days, I finally got my PCBs in the mail. Now it's time for the fun part, soldering it all together! By following the schematic, soldering the PCB was fairly easy. In my design, I used an IC socket and female headers for my multiplexer IC and Node-MCU. This is so that I am able to remove these chips If I need to replace or reuse them. If you would like a slimmer form factor, feel free to solder the chips directly to the board, but remember that it will be quite difficult to remove these later.
Step 9: Putting Together the Glove
To install the flex sensors into the glove, I glued small rubber tubes into the glove's fingers and placed the sensors into them. This way the sensors had some wiggle room and could be removed in needed. To hold the PCB, I mounted it to the glove using some velcro tape. Once again putting this together is all up to you. You can be creative!
Step 10: Programming the Commands
Now that the hardware is taken care of, its time for the software. For your glove, download the code below.
To make the code work with your TV, you have to change some numbers. Remember those numbers you wrote down? Now it is time to use them. If you do not have the numbers, don't worry, it is very easy to collect these signals; Simply go back to the IR Receiving Step. Copy the dataset rawData, and paste it under the comment, "PASTE DATA HERE" in the code. Rename this dataset to powerOn. Copy the number next to powerOn (in my case 95). This number is the amount of numbers in the dataset. Now, go to the bottom of the code, under the comment, "DISPLAY POWER". Replace "95" with the value you copied. Now, upload your code to the Node-MCU and put on the glove. If you face your hand to the TV and bend one of your fingers, your TV will turn on!
This is easily customizable. To add more functions, simply add more datasets, and copy-paste the DISPLAY POWER function and change its information to the corresponding dataset and number of values. Since each flex sensor is different, you might have to change the number "310" so that it registers when the finger is folded. You can even make multi-finger gestures and "master switches". For example, I adjusted my code such that when I bend my ring finger and thumb, my TV's volume mutes and the source changes. The possibilities for expandability are endless!
Step 11: Its Done!
There you have it, a universal gesture controlled TV remote! I hope you liked this project, and I hope you vote for me in the Epilog Laser contest. If you have any questions, feel free to write a comment and I will try my best to answer them. Once again, I hope you liked it!