INPUT DEVICES

Group Assignment

  • Probe an input device's analog levels and digital signals

Individual Assignment

  • Measure something: add a sensor to a microcontroller board that you have designed and read it

Input devices are the sensors and transducers that allow a microcontroller to perceive the physical world. They convert real-world phenomena — light, temperature, pressure, motion, touch, magnetic fields, sound — into electrical signals that a microcontroller can read, process, and act on.

Every embedded system starts with inputs. Without them, a microcontroller is blind to its environment — it can only execute fixed instructions with no awareness of what is happening around it. Input devices close that loop, enabling systems to sense, respond, and adapt in real time.

Input signals broadly fall into two categories:

This week's work focused on adding real sensor inputs to a custom-designed PCB — exploring how to select, wire, and read different types of sensors from a microcontroller.

Individual Assignment

For this week I designed and milled a custom input board built around the ATtiny1624. The board integrates two capacitive touch pads and a linear Hall effect sensor — all inputs that will eventually feed into my final project, a pill dispenser. Below is the finished board after milling, soldering, and testing.

Input devices board — ATtiny1624 with capacitive touch pads and Hall effect sensor
Completed input devices board — ATtiny1624, two capacitive touch pads, and an A1324 Hall effect sensor

Schematic

The schematic was drawn in KiCad's schematic editor and is organised into four labelled blocks for clarity. Net labels (rather than direct wires) connect the blocks to the ATtiny1624 in the centre, keeping the sheet readable.

KiCad schematic showing four blocks: TOUCH (two 1MΩ pulldown pads), ATTINY1624 (centre MCU), MAGNETISM (A1324 Hall sensor), LED (two green LEDs with 470Ω resistors), and FTDI (6-pin UPDI header J1)

Project Context

This board is part of my final project — a pill-shaped pill dispenser. It reads two capacitive touch pads for dose acknowledgement and one Hall effect sensor for rotor disc position detection, with LED feedback for each touch input.

Board Overview

MicrocontrollerATtiny1624 (14-pin SOIC, tinyAVR 2-series)
Operating voltage5V
Inputs2 capacitive touch pads, 1 Hall effect sensor (A1324)
Outputs2 green LEDs (visual feedback for touch)
ProgrammingUPDI via SerialUPDI with FTDI adapter

How Capacitive Touch Sensing Works

The touch pad is a 12 mm exposed copper circle on the PCB. A 1 MΩ resistor connects from the pad to GND as a pulldown.

The ATtiny charges the pad high through the GPIO pin, then switches to input mode and measures how long it takes for the charge to drain through the 1 MΩ resistor. When a finger touches the pad, it adds capacitance (~10–30 pF), which slows the discharge. The ATtiny detects this timing difference to determine if the pad is being touched.

Key points:
  • The 1 MΩ resistor is a pulldown to GND, not inline between GPIO and pad
  • The GPIO pin connects directly to the copper pad
  • No external sensor IC needed — sensing is done in software via ADC
  • Works on any ADC-capable pin on the ATtiny

How the Hall Effect Sensor Works

The A1324 is a linear Hall effect sensor that outputs an analog voltage proportional to the magnetic field strength. With no magnet nearby, the output sits at approximately half the supply voltage (~2.5 V at 5 V supply). A south pole magnet increases the output toward VCC, while a north pole decreases it toward GND.

In the pill dispenser, a magnet embedded in each rotor disc passes over the sensor to detect disc position.

Key points:
  • A1324 requires 4.5 V–5.5 V supply — does NOT work at 3.3 V
  • Output connects directly to ATtiny ADC pin — no pullup resistor needed
  • The A1324 has an active push-pull output stage (unlike open-collector Hall switches like the A3144)
  • A 100 nF bypass capacitor is placed close to the sensor for clean power

Design Rules

PCB Design

The PCB was designed in KiCad's PCB Editor as a single-layer board to be milled on the Roland SRM-20. All components are SMD 1206 footprints placed on the front copper layer (F.Cu), routed with a minimum trace width of 0.4 mm.

Board Layout

KiCad PCB editor showing component placement — resistors R1–R3 and R5, diode D2, capacitor C3, connector J1, and two circular capacitive touch pads on the left

On the image above, on the left are two large circles,these are the capacitive touch sense pads that users will physically press. They are drawn directly on F.Cu as filled copper circles assigned to the sense net, rather than as standard pad footprints.

Creating the Capacitive Touch Pads

Because KiCad doesn't have a built-in "touch pad" footprint, the sense pads were drawn manually using the Circle tool on the F.Cu layer. After placing the circle outline, properties had to be set to make it electrically functional.

Right-clicking the circle opens the context menu, where Properties (E) gives access to geometry and net assignment:

KiCad right-click context menu on the circle, showing options: Move, Rotate, Flip, Mirror, Properties, and Positioning Tools

This is the properties panel that opens up

Circle Properties dialog showing unfilled circle with no net assigned on layer F.Cu, radius 2.503 mm

Initially the circle is just a graphic, it has no net (<no net>) and Filled shape is unchecked. In this state it is a courtyard or silkscreen-style outline and carries no electrical signal.

Circle Properties dialog showing the same circle now filled and assigned to net Sense_1 on layer F.Cu

To turn the circle into a real copper pad, two changes were made in the Properties dialog:

Touch Pad Close-up

With both circles filled and assigned to their respective nets, the two capacitive touch pads appear as large solid copper discs on the left side of the board. The traces leading from each pad route toward R1 and R2 (the 1 MΩ pulldown resistors) and onward to the ATtiny1624 ADC pins.

KiCad PCB editor close-up of the two filled copper capacitive touch pads with R1 and R2 pulldown resistors and J1 connector visible on the right

Complete Board Layout

The full board layout shows all components placed and routed on a single copper layer (F.Cu). The two touch pads sit at the top-left. The ATtiny1624 (SOIC-14) occupies the centre. R2 and U1 (the A1324 Hall effect sensor in its TO-92 footprint) are on the left branch, while R4 and D1 are on the right branch. D2 and R3 sit at the far left for touch pad 2 feedback. J1 (the UPDI programming header) runs along the bottom edge.

KiCad PCB editor showing the full routed board — two touch pads top-left, ATtiny1624 centre, Hall sensor U1 left branch, LEDs D1 and D2 on outer edges, UPDI header J1 at bottom

Board Dimensions

Using KiCad's measurement tool, the board width was verified. The coordinate readout (x: −32.460 mm, r: 32.460 mm, θ: 180°) confirms the board spans approximately 32.5 mm horizontally — sized to fit within the Roland SRM-20's usable milling area while keeping all components accessible.

KiCad PCB editor with measurement overlay showing board width of approximately 32.46 mm at θ = 180°

The vertical dimension was measured similarly. The readout (y: 28.260 mm, r: 28.260 mm, θ: −90°) gives a board height of approximately 28.3 mm. The ruler guides along the left and bottom edges confirm the overall footprint of the board before sending it to the milling machine.

KiCad PCB editor with ruler guides and measurement overlay showing board height of approximately 28.26 mm at θ = −90°

3D Render

KiCad's 3D viewer was used to verify component placement and check for mechanical clearance before sending the board to the milling machine. The render shows the ATtiny1624 (SOIC-14) at the centre, the two capacitive touch pads as raised dark-green copper circles on the top-left, and J1 (the UPDI programming header) as a through-hole connector protruding from the bottom edge. The yellow-highlighted component near the top is C3, the 100 nF decoupling capacitor placed close to the ATtiny's VDD pin. All SMD components are 1206 footprints, visible as grey rectangular bodies with silver pads.

KiCad 3D render of the input devices board — ATtiny1624 SOIC-14 at centre, two circular capacitive touch pads top-left, through-hole UPDI header J1 at bottom, 1206 SMD resistors and LEDs, and C3 decoupling capacitor highlighted in yellow

Exporting Milling Files with Gerber2PNG

Before milling, the KiCad Gerber files were converted to PNG images using Gerber2PNG — an online tool that renders each board layer as a separate high-resolution image. The tool shows the board preview at the correct dimensions (32.46 × 28.26 mm) and generates one PNG per layer. The layer visibility panel on the left shows the Top layers (Trace, Pads, Silkscreen) enabled and the Bottom layers hidden, since this is a single-sided board. Three files were generated and are visible in the preview panel on the right:

Gerber2PNG interface showing board preview at 32.46 × 28.26 mm with Top layer selected and three exported PNGs: outline, drills, and traces at 1000 dpi

Programming the ATtiny1624

The ATtiny1624 uses UPDI for programming and is not supported in Arduino IDE by default. Here's the full setup from scratch.

Step 1 — Install Arduino IDE

Download and install Arduino IDE 2.x from arduino.cc/en/software if you don't have it already.

Step 2 — Install megaTinyCore

megaTinyCore is the board package by Spence Konde that adds support for the ATtiny1624.

http://drazzy.com/package_drazzy.com_index.json

Step 3 — Configure Board Settings

Go to Tools and set each option as follows:

Setting Value
Board Tools → Board → megaTinyCore → ATtiny1624
Chip ATtiny1624
Clock 20 MHz internal (no crystal needed)
millis()/micros() Timer TCA0 (default)
Programmer SerialUPDI - SLOW: 57600 baud (more reliable to start with)
Port The COM port of your FTDI adapter (e.g., COM3, COM5)