Intro: WiFi Pocket Remote
A simple remote could come in handy for projects involving WiFi. You can make one from the following items:
- Three tactile buttons*
- ESP8266 v2 (Amica) IoT board (and the plastic wrapper it came in)
- 0.91" generic chinese LCD screen, adafruit library compatible
- 3x7 centimeters pcb protoboard
- 9V battery
- 9V battery cable
- On/Off switch aka 2-position slide switch*
- One 100 ohm resistor*
- Three 1000 ohm resistors*
- adhesive backed velcro (Optional)
*Save money by salvaging this component from a broken stereo or similar junk device (try your local thrift store)
With the following tools:
- Safety Glasses
- Soldering Iron
- Solder (I use 0.8mm)
- Hot glue gun with one glue stick
- Helping hands (nice ones here) (cheap ones here)
- Wire cutters designed to cut small wires so they are flush with a surface
- Needlenose Pliers
- Micro USB cable
- A computer with Arduino IDE and ESP8266 addon installed
- Cordless Drill**
**only needed if you plan to salvage your own parts
It is also worth mentioning that this remote control can be used in reverse - to browse information received from somewhere else.
Step 1: Test Fit Everything on the Protoboard. Glue Down the LCD. Test the Resistors and Button Pins With a Multimeter.
Make sure you are using a nodeMCU "v2" by Amica, as the "v3" Lolin version is slightly larger and will not fit!
Buttons don't always have four pins - but when they do, you have to check them. Set your multimeter to read resistances. Touch two pins. If the resistance reads zero, the pins are connected to each other. It's easier to test the buttons when they are sitting on the protoboard.
Resistors can fool you! For example, we want three 1k resistors, which are brown, black, red. The red band can be easily confused with orange, which designates a 10k resistor! Also, anytime you salvage a component, it is good to check that it is still working right, if possible. So long as all the 1k resistors read something close to 1,000 ohms, you are good to go.
Step 2: Solder the On/Off Switch First, Then the Wires/Buttons/Resistors, Then the NodeMCU. See Schematic.
TinkerCAD was used to create the schematic pictured. Since TinkerCAD does not have a NodeMCU in the available parts list, I used header pins to represent it. Labels were added with a photo editor.
Most of the circuit will be covered up by the NodeMCU and the battery, so it is important to double check everything. Take care that your power switch is not going to block the usb port on the NodeMCU. Use a pliers to route the 9V battery wires, one at a time, through a mounting hole. This will protect the wires from being broken over time. After you have soldered all the rest of the circuit, I recommend only soldering the NodeMCU pins that you are going to use.
Next comes the anti-static plastic. Cut a piece out of the bag the NodeMCU came in. Hotglue the plastic to the underside of the protoboard where the battery will go. This will protect the solder and pins from shorting against the battery casing, or anything else you might set the remote on top of. Also, the plastic provides a smooth surface on which to place the battery.
Step 3: Hardware Testing
Instead of reading a digital on/off signal, we are going to read the analog voltage. This allows us to put all three buttons on a single pin. Each button has a different resistance, which is then connected to a voltage divider when you press the button. The NodeMCU will read a voltage between 0-3.3 volts and give you a corresponding value between 0-1024. I am including a sketch that will fire up the lcd screen and display the value being captured by pin A0. This will allow you to tell whether the buttons are working. The values I captured, from left to right, were 545, 520, and 365 but yours may vary somewhat. When no buttons are pressed, the analog value should be between 0-15.
Step 4: WiFi Programming Choices
There are a number of ways to program the remote to talk to other devices over WiFi and even across the internet. The method you choose will depend on your particular situation. It is also worth mentioning that this remote control can be used in reverse (to browse information received from somewhere else). The two major methods I've seen are HTTP and MQTT. Here are a few tutorials which you can follow from here:
Also check out the examples included with the NodeMCU hardware library (pictured)!
Thanks for reading! There are many ways you could choose to expand upon this remote control once you get the hang of it. By all means, post your results. I'd love to see how it turned out!