Quite often, you will build a packaged project that requires external control. Various ways to provide ham Arduino controls include using buttons, potentiometers, encoders, and even remote keypads.
A simple button or switch is perhaps the easiest way to implement control. Since Arduino digital input pins include pull-up resistors, sending a button or switch command is trivial. Some buttons fit into breadboards, most need external wiring. You can program your Arduino to poll digital input pins and then respond appropriately to a pin going HI or LOW. An alternative to polling is a hardware interrupt when the state of a switch changes.
Many starters get the popular LCD 1602 Keypad Display shield. This board has a two row, sixteen character alpha-numeric display, as well as six momentary push buttons. Each button sends a different analog voltage to Analog Pin 0 when pressed. Everything you need to run this shield is included in the Liquid Crystal library that comes with the Arduino. You can test these buttons for state, long or short presses, and even vary the response according to how long each button is pressed. Pretty simple.
Ham Arduino Controls – Advanced Input
If you want pure analog input, you can connect a potentiometer to an analog input pin. A more advanced method of control can use optical or rotary encoders. For less than a dollar, you can but a KY-040 rotary encoder that is like a digital volume control. Turning the encoder sends up or down pulses. The KY-040 also includes a push button. Again, you can use polling or interrupts to read encoders. They are good for things like changing frequency or implementing a menu system.
If you want to avoid mounting a lot of controls on your project front panel, another alternative is an infrared remote control. Only three wires are needed to set these up: voltage, ground and signal. These cost $2 on e-bay and are supported by open-source libraries.
Finally, you can use WiFi to send commands to your project. If you have a NodeMCU, this capability is right at your fingertips. It is straightforward to write a command processor to remote control you project just as you would your radio or RC vehicle.
In our next article, we will talk about sensors. Most makers use a very wide variety of sensors to interface with the environment.