Digital Logic Design

Digital Health Monitoring System

Digital control logic for a remote patient-monitoring concept, from sensor inputs to status and urgent alerts.

My contribution
Logic partitioning, truth tables, gate-level schematics and Verilog simulation
Context
Remote patient monitoring · combinational digital design · UNSW
Focus
Embedded & hardware
System overview: keypad decoder, oxygen comparator and alarm logic, with display and buzzer interfaces.
System OverviewSystem overview: keypad decoder, oxygen comparator and alarm logic, with display and buzzer interfaces.
Complete gate-level redraw of the keypad decoder and oxygen comparator, with buffered keypad inputs, shared key terms, BCD masking, per-bit comparisons and OX encoding.
Complete Gate SchematicsSheet 1 — Keypad Decoder & Oxygen Comparator. A consolidated logic redraw; matching net names show the connections between gates.
Complete gate-level redraw of input-category detection, Healthy, Observe and Alarm decision terms and the urgent oxygen buzzer request.
Complete Gate SchematicsSheet 2 — Monitoring Decisions & Buzzer Request. The documented alarm network, with its display and manual-reset requirements identified at the interfaces.
The 4 × 3 keypad layout used to encode decimal setpoint digits.
Keypad DecoderThe 4 × 3 keypad layout used to encode decimal setpoint digits.
ISim keypad verification: row and column stimuli alongside the four BCD output bits.
Keypad DecoderISim keypad verification: row and column stimuli alongside the four BCD output bits.
ISim comparator verification: a selected input pair and its encoded result.
Oxygen ComparatorISim comparator verification: a selected input pair and its encoded result.
ISim comparator verification: another point in the exhaustive four-bit input sweep.
Oxygen ComparatorISim comparator verification: another point in the exhaustive four-bit input sweep.
ISim comparator verification: input and output values across successive comparison cases.
Oxygen ComparatorISim comparator verification: input and output values across successive comparison cases.
ISim comparator verification: selected comparison results from the test run.
Oxygen ComparatorISim comparator verification: selected comparison results from the test run.
ISim comparator verification: additional input combinations and result encoding.
Oxygen ComparatorISim comparator verification: additional input combinations and result encoding.
ISim comparator verification: further sample from the four-bit input sweep.
Oxygen ComparatorISim comparator verification: further sample from the four-bit input sweep.
ISim comparator verification: final retained waveform sample.
Oxygen ComparatorISim comparator verification: final retained waveform sample.
Original bit definitions for heart rate, breathing rate, temperature and oxygen flags.
Monitoring & Alarm LogicOriginal bit definitions for heart rate, breathing rate, temperature and oxygen flags.
Original monitoring decision table defining Healthy, Observe, Alarm and the urgent oxygen flag.
Monitoring & Alarm LogicOriginal monitoring decision table defining Healthy, Observe, Alarm and the urgent oxygen flag.

Experience In Practice

Skills Applied

View All Skills

Turn Monitoring Rules Into Three Logic Blocks

The system concept supports patients recovering at home after hospital treatment. It combines pulse-oximeter, heart-rate, breathing-rate and temperature inputs to identify a Healthy, Observe, Alarm or Urgent status. The design challenge is to turn those monitoring rules into a clear digital control path.

I developed the three combinational blocks in sequence: decode a keypad-selected oxygen setpoint, compare it with the pulse-oximeter reading, then combine the result with the other sensor codes. This allowed each block to be derived and checked before becoming the next block’s input.

The user selects an oxygen setpoint between 90% and 99% by entering its units digit. The pulse oximeter supplies the measured units digit in BCD plus an independent U flag for oxygen below 90%. The complete system specification also calls for a seven-bit SEVEN output to a status display and a buzzer that is reset manually.

System overview: keypad decoder, oxygen comparator and alarm logic, with display and buzzer interfaces.
System overview: keypad decoder, oxygen comparator and alarm logic, with display and buzzer interfaces.

Follow The Complete Gate Network

These two sheets bring the separate gate drawings together into a complete view of the documented combinational logic. The first follows the keypad through BCD decoding and oxygen comparison; the second follows the encoded sensor inputs through the monitoring decisions and buzzer request.

Matching net labels represent connections between gates, and a small circle on a pin means inversion. In sheet 2, BR names the breathing-rate signals so they cannot be confused with the keypad’s BCD bits B3…B0. Open either vector sheet in a new tab to zoom into the gates without losing clarity.

Complete gate-level redraw of the keypad decoder and oxygen comparator, with buffered keypad inputs, shared key terms, BCD masking, per-bit comparisons and OX encoding.
Sheet 1 — Keypad Decoder & Oxygen Comparator. A consolidated logic redraw; matching net names show the connections between gates.
Complete gate-level redraw of input-category detection, Healthy, Observe and Alarm decision terms and the urgent oxygen buzzer request.
Sheet 2 — Monitoring Decisions & Buzzer Request. The documented alarm network, with its display and manual-reset requirements identified at the interfaces.

Derive A Decimal Output From A Matrix Keypad

A 4 × 3 keypad identifies each key by an asserted row and column. I wrote the ten valid combinations first, then formed the BCD output bits by OR-ing together the key combinations that require a 1 in that bit position.

For example, the most significant BCD bit is high only for 8 and 9. Both are on row X3, in columns Y2 and Y3, so B3 = X3·(Y2 + Y3). The same method produces the other three output bits.

The keypad permits one valid key at a time; the two empty positions are excluded. The circuit includes an explicit zero-key mask: detecting X4·Y2 forces all four outputs low. My solution assumes the selected row and column remain asserted until the next key press, keeping input persistence at the keypad interface.

Keypad Truth Table
KeyRowColumnBCD B3 B2 B1 B0
0X4Y20000
1X1Y10001
2X1Y20010
3X1Y30011
4X2Y10100
5X2Y20101
6X2Y30110
7X3Y10111
8X3Y21000
9X3Y31001

Unlisted row/column combinations are outside the valid single-key input set.

B0 = X1·Y1 + X1·Y3 + X2·Y2 + X3·Y1 + X3·Y3

B1 = X1·Y2 + X1·Y3 + X2·Y3 + X3·Y1

B2 = X2·Y1 + X2·Y2 + X2·Y3 + X3·Y1

B3 = X3·Y2 + X3·Y3

G = ¬(X4·Y2); final output bit = Bi·G

Notation: · means AND, + means OR and ¬ means NOT.

Compare The Most Significant Difference First

The oxygen comparator takes A, the sensed oxygen units digit, and B, the selected setpoint digit. Equality at a bit position allows the comparison to continue to the next lower bit. The first unequal pair determines which number is larger.

I reused per-bit product terms across equality and magnitude comparisons, then encoded the result into the two bits expected by the alarm circuit. This avoids treating the four bit positions as equally significant.

For a 95% setpoint, a 97% reading produces 00, a 95% reading produces 01 and a 93% reading produces 11. The comparison of units digits applies within the 90–99% range; U separately identifies the below-90% condition.

Oxygen Comparator Output
Reading A vs Setpoint BOX1 OX0Meaning
A > B00Above the setpoint
A = B01Exactly at the setpoint
A < B11Below the setpoint

Ei = ¬(Ai XOR Bi)

LT = ¬A3·B3 + E3·¬A2·B2 + E3·E2·¬A1·B1 + E3·E2·E1·¬A0·B0

EQ = E3·E2·E1·E0

OX1 = LT; OX0 = LT + EQ

Each equality term gates the next less-significant comparison. Equality uses XNOR: a bit pair must match.

Translate The Decision Table Into Gates

The heart-rate, breathing-rate and temperature sensors each supply two threshold flags. Bit 0 identifies a reading above the lower threshold, and bit 1 identifies a reading above the upper threshold. The valid codes are therefore 00, 01 and 11; 10 cannot occur under those nested threshold definitions.

I grouped the Healthy, Observe and Alarm conditions separately, built an AND term for each valid condition group, then OR-ed the terms into each output. Shared high-category, nonzero-category and middle-category signals reduce repeated logic.

These thresholds define this digital-design scenario. The table below shows how the encoded inputs map to outputs; each row is a sufficient condition. An input may match two Observe rows, but it still asserts only the single Observe output.

Sensor Encoding Used By The Circuit
CodeHeart Rate (beats/min)Breathing Rate (breaths/min)Temperature (°C)
00≤ 100≤ 25≤ 37.5
01> 100 and ≤ 120> 25 and ≤ 28> 37.5 and ≤ 38.5
11> 120> 28> 38.5

The sensor bits use strict “greater than” thresholds. A reading exactly at 100 beats/min, for example, remains in code 00; exactly 120 beats/min is code 01. The ranges above follow those bit definitions.

Monitoring Decision Table
OutputOxygen vs SetpointHeart CodeBreathing CodeTemperature Code
HealthyAt / above00 or 0100 or 0100
HealthyAt / above000001
ObserveAt / above1100 or 0100
ObserveAt / above00 or 011100
ObserveAt / aboveAny valid0101
ObserveAt / above01Any valid01
ObserveAt / above110001
ObserveAt / above001101
AlarmBelowAny validAny validAny valid
AlarmAt / above1111Any valid
AlarmAt / aboveAny validAny valid11

“Any valid” means 00, 01 or 11. “At / above” covers comparator outputs 00 and 01; “Below” is 11. These are the H/O/A decision conditions; the independent U flag supplies the urgent oxygen indication.

Connect Status Indication And Urgent Alerts

The buzzer request is the OR of Alarm and U. If the pulse oximeter asserts U for oxygen below 90%, the request is high regardless of the setpoint comparison, heart rate, breathing rate or temperature.

The specified seven-segment interface uses a seven-bit signal, SEVEN, to show H, O, A or U. This translates the decision outputs into a compact status indication, with U identifying the independent urgent oxygen condition.

The brief specifies manual reset for the buzzer. The retained solution shows the combinational request Z = Alarm + U; keeping the buzzer on until manual reset requires a separate state-holding element. The consolidated schematics show the documented gate network and identify the display and reset requirements at its interfaces.

Specified Seven-Segment Status Indications
SymbolMeaningTrigger
HHealthyHealthy decision output is asserted
OObserveObserve decision output is asserted
AAlarmAlarm decision output is asserted
UUrgent oxygen conditionU = 1: measured oxygen is below 90%

SEVEN is a seven-bit segment-control interface. The retained gate drawings document the decision and buzzer logic; they do not provide a complete segment-decoder schematic.

Z = Alarm + U

Z is the combinational turn-on request shown in the solution. Manual-reset persistence is a system-level requirement.

Check The Logic Against Simulation

I used Verilog testbenches to drive the keypad and comparator circuits, then inspected their inputs and outputs in ISim. The retained waveforms connect the truth-table decisions to the simulated gate-level behaviour.

The comparator test sweeps 256 pairs of four-bit values. Of those, 100 pairs use valid decimal BCD digits from 0 to 9; the remaining pairs exercise the wider four-bit comparison logic.

The two consolidated gate sheets connect the truth-table derivations to the complete logic path. The slideshow also retains the keypad and comparator waveforms, input encoding and original decision table; individual gate close-ups remain available in the image library.

ISim keypad verification: row and column stimuli alongside the four BCD output bits.
ISim keypad verification: row and column stimuli alongside the four BCD output bits.
ISim comparator verification: a selected input pair and its encoded result.
ISim comparator verification: a selected input pair and its encoded result.

The Engineering Journey

Partition

Separate input decoding, magnitude comparison and monitoring decisions.

Derive

Turn valid input cases into Boolean expressions and shared gate signals.

Inspect

Use Verilog stimuli and ISim waveforms to trace the implemented behaviour.

What This Experience Achieved

The result

A documented three-block monitoring logic design, from keypad truth table to comparator and alarm gates, supported by keypad and comparator simulation evidence.

Technical decisions & tools

The design brief supplies already-encoded sensor values. Physical sensing and signal conditioning are outside the three combinational blocks shown.

The comparator equations follow its truth table. Per-bit equality is XNOR; LT means the measured units digit is less than the selected setpoint digit.

The sensor-bit definitions determine threshold boundaries: bit 0 is high above the lower threshold and bit 1 above the upper threshold. Only codes 00, 01 and 11 are valid.

The two consolidated SVG sheets are functional redraws of the retained gate logic. Shared net names connect the stages; BR labels identify breathing-rate signals to distinguish them from the BCD setpoint bits B3…B0.

The specified SEVEN display interface and manually reset buzzer are identified separately from the documented combinational gate network.

Boolean logicTruth tablesBCD encodingSchematic captureVerilog testbenchesISimWaveform analysis