Skip to Content

Input devices

In autonomous (not requiring any human intervention) Physical Computing and IoT systems sensors are the source of input data to the processor. There may be scenarios where you need to also provide human inputs to the microcontroller. The input devices listed below allow multiple types of inputs to be provided to a microcontroller.

Switches

There are two types of switches:

  • On/Off Switch: The switch has two positions on and off and remains in either position unless manually moved to the other position.
  • Pushbutton Switch: The pushbutton switch normally stays in the off position, turns on when pressed, turns off when released, and stays off until pressed again.

Potentiometers

A potentiometer has a shaft that can be turned with a knob or a screw. Turning the shaft changes the amount of internal resistance, which changes the voltage output at the center pin. The varying voltage is read by the analog input pin on the Arduino board. Arduino boards have a circuit inside called an analog-to-digital converter (ADC) that reads a voltage that varies from 0V to 5V and proportionately converts it to a number between 0 and 1023.

Keypads

Keypads allow a user to send alphanumeric character inputs to a microcontroller. Keypads are laid out as rows and columns. Each key on the keypad can be individually identified when pressed and the program can determine what number or a letter of the alphabet each key should be considered as. Keypads use tactile sensors that measure finger touch and pressure inputs. There are various types of tactile sensors and they are most commonly used in touchscreen devices such as smartphones.

Joysticks

A joystick is an input device that provides directional inputs to a board generally used to control moving objects, physical or on-screen, by translating the directional inputs to movement. A joystick can be pushed in any direction along a circle, up, down, left, right, and any diagonal position. The joystick input is translated into movement depending on the context and the object being moved.

For example, if a joystick is controlling a car, the up and down movements will translate to forward and backward movements for the car, the left and right movements will turn the car left or right. If the joystick is controlling a flying airplane, the up and down movements will translate to nose down and nose up movements for the airplane (known as the pitch), the left and right movements, will cause the airplane to tip its wings left or right (known as the roll) and at the same time turn left or right (known as the yaw).

The joystick module has two output pins that send analog signals, one for the up-down (y-axis) movement, and one for the left-right (x-axis) movement. The signal voltage varies from 0 when the joystick is moved to the extreme left or bottom, to 5V or 3.3V (the operating voltage) when the joystick is moved to the extreme right or top. When the joystick is in its center (resting) position, the output is about half the operating voltage. The analog values are read by the microcontroller’s Analog-to-Digital Converter (ADC) and converted to a value between 0 and 1023. The microcontroller program can translate these values into motion as required.