Microcontroller Pins

Micocontrollers (boards), modules and components have pins that are used to connect and exchange data with sensors, relays, other electronic components, and even other microcontrollers. There are multiple categories of pins that are used when designing and assembling cirucits as described below:

  • Power Pins These pins are used to supply power to the board and to take power from the board to power modules and components. All boards generally have the following pins:

    • VIN: You can provide power to the board (5V or 3.3V as required) using a regulated power supply. The alternative is to provide external power using the USB connector.
    • 5V: Provides a regulated 5V output that can be used to power components attached to the board.
    • 3V3: Provides a regulated 3.3V output that can be used to power components attached to the board.
    • GND: Circuit ground.
    • IOREF: This pin provides the voltage reference with which the microcontroller operates.
    • AREF: Reference voltage for the analog inputs.
  • Input/Output Pins These pins are used to receive or send data from and to other microcontrollers, modules, and components. There are pins that receive a direct data signal and pins that use more complex transmissiion mechanisms (described earlier). I/O pins are further categorised into two:

  • Digital Pins: These pins can be used as input or output pins to read binary (0/1) data from devices like buttons, or to send binary signals, such as to switch an LED on and off. They provide an output of 0V (representing the binary value 0) or 5V (representing the binary value 1). These are also referred to as GPIO (General-Purpose Input/Output) pins.

  • Analog Pins: These are used to read analog data from components. They accept a range of values, usually from 1 (0V) to 1023 (5V), which is then referred to as a 10-bit resolution. Analog pins are primarily used as input pins to read data that varies continuously, like from temperature sensors or potentiometers.

  • Pulse Width Modulation (PWM) Pins: Pulse-width modulation is a technique to achieve an analog signal using binary values by continuously toggling a signal between a HIGH (1) and a LOW (0) state. The state of the device is controlled by changing how long the signal is HIGH versus LOW the. PWM can be used to dim LEDs or control motor speeds. The PWM signal has two key parameters, frequency and duty cycle. GPIO pins marked with a tilde (~) can be used to send PWM signals.

  • Data Tranmission (Communication) Pins There are pins specifically designed to support one of the data transmission mechanisms described earlier:

    • UART Communication: It is used to receive and transmit data between the board and the computer via the USB cable or between boards and components. There are two pins that support this labelled as RX and TX.
    • SPI Communication: These pins support SPI (Serial Peripheral Interface) communication with other boards or components. There are four pins labelled COPI (Controller Out Perpheral In), CIPO (Controller In Perpheral Out), CS (Chip Select), and SCK (Serial Clock).
    • I2C Communication: These pins support I2C communication with other boards or components. There are two I2C pins, SDA (Serial Data Line) and SCL (Serial Clock Line).
  • External Interrupts These pins can be configured to trigger an external interrupt, which sends the microcontroller a signal to do some specific processing based on an external event.

  • Reset Bring this line LOW to reset the microcontroller. Typically, it is used to add an alternative reset option to the reset button on the board.

Most boards are designed around a microchip. Boards use the pins provided by the microchip and may add some pins of thrie own for additional functionality. The pins on boards, are labelled using letters and numbers, such as D1, D2, and so on for digital pins, A1, A2, and so on for analog pins, VCC, GND for power and ground.

Each of the pins on the board may map to a pin on the chip, board-specific functionality, or not map to any pin on the chip. In the board specifications it is important to know what pin they are referring to, the chip pin or the board pin.

In all the pin descriptions in these courses and projects, we will be using the board pins. The specific pins on each board that are to be used for assembling a circuit will be defined in the instructions; however, you can use any equivalent pin as long as you had read and understood the board's specifications and functionality.

Board pins and their functionality are represented visually using a Pinout Diagram (see the next topic).