Create a complete new schematic and PCB-ready design for a single-channel Universal I/O controller based on an ATmega328 microcontroller.
Core requirement:
Design a new circuit from scratch. Do not reuse or include LM76202QPWPRQ1, AD7708, HC595, CD4066, LM2902, or other external switching/ADC/control ICs unless absolutely required and explicitly approved. The ATmega328 should directly measure and control the universal I/O as much as practical.
Universal Input requirements:
The same field input connector must support software-configurable modes:
Digital input
Analog voltage input
0–10 V input
0–20 mA input
Resistance measurement
RTD measurement: PT1000 and NI1000
Thermistor measurement: 10k Type II and 10k Type III
Universal Output requirements:
Provide a software-configurable universal output from the ATmega328. Include at minimum:
Digital output
PWM-based analog voltage output using filtering/buffering if needed
Clearly document whether true 0–10 V output or 0–20 mA output is supported directly, requires extra circuitry, or is out of scope for the first revision.
Architecture constraints:
Use ATmega328 ADC pins directly for measurements.
Avoid HC595 shift registers.
Avoid CD4066 analog switches.
Avoid LM76202 protection IC.
Avoid AD7708 external ADC.
Prefer simple discrete protection, resistor dividers, shunt resistors, RC filters, jumpers or low-cost analog selection methods if needed.
Use clear ALL_CAPS net names.
Design for a 24 V industrial field environment where possible, but keep MCU pins protected within safe voltage/current limits.
Expected schematic blocks:
Power input and regulation for ATmega328 logic rail.
ATmega328 core: power pins, reset, clock option, ISP/programming header, decoupling.
Universal input field connector with protection.
0–10 V divider path into ADC.
0–20 mA shunt path into ADC.
Resistance/RTD/thermistor divider or excitation path into ADC.
Digital input threshold/protection path into an ATmega328 GPIO.
Universal output connector with digital/PWM output conditioning.
Optional test points and calibration notes.
Implementation expectations:
Select suitable components from the Flux library.
Add all required resistors, capacitors, connectors, protection parts, regulator, and ATmega328 support parts.
Wire the complete schematic.
Add Role and Role Details properties to important parts.
Run ERC and fix schematic errors.
Create a project document explaining the circuit architecture, mode configuration table, ATmega328 pin mapping, ADC scaling equations, firmware configuration notes, and limitations.
After schematic validation, set up a reasonable PCB board size and stackup, place components by functional block, and prepare for routing.
Important design notes:
Because the ATmega328 has limited ADC resolution and input range, include scaling and protection so all field signals are reduced to the MCU ADC range.
Firmware must select the measurement mode and apply calibration/scaling formulas.
If fully software-selectable mode switching cannot be achieved without extra analog-switch ICs, propose a simple alternative such as jumpers, resistor option links, MOSFET/discrete switching, or separate input terminals, and document the tradeoff before implementation.
I couldn’t start a new execution plan because a previous execution is currently stopping; once it finishes, I can generate and start the plan for this ATmega328-based Universal I/O redesign.
This project is a single-channel, software-configurable universal input front end: one field terminal can be configured by firmware to measure digital input, 0–10 V voltage, 0–20 mA current, resistance, RTDs such as PT1000/NI1000, and thermistors such as 10k Type II/III.
The design is the reduced one-channel version of the earlier 4-channel Universal I/O architecture. The retained blocks are: LM76202 field power protection, AP2204 3.3 V logic/analog supply, AD7708 ADC measurement core, LM4040 2.5 V ADC reference, 32.768 kHz ADC crystal, 74HC595 mode-control expander, CD4066 analog switch matrix, LM2903 comparator for digital input, and the UI1 field connector/protection network.
High-level block diagram
Text
External host/controller
| 5V_IN, SPI, HC595 control, reset/status
v
J9/J10 interface headers
|----------------------------------------------------|
| |
v v
U10 3V3 regulator U4 74HC595 control expander
| 3V3 | QA..QD mode controls
| v
| U6 CD4066 analog switch matrix
| |
Field input J1 -> D1 TVS -> R1 series -> UI1_PROT ----+---- 0-10V divider R2/R3 -> ADC path
+---- 0-20mA shunt R4 -> ADC path
+---- sensor excitation R5 -> ADC path
+---- digital sense -> LM2903 comparator
ADC path: U6 selected node -> UI1_ADC -> C10 filter -> U2 AD7708 AIN1
Reference/clock: IC1 LM4040 2.5V -> U2 REFIN1(+), Y1/C23/C24 -> U2 XTAL1/XTAL2
Digital path: UI1_DIG_SENSE -> U3A comparator -> UI1_DIG_OUT
Field power protection: FIELD_24V_IN -> U1 LM76202 -> FIELD_24V_PROT, FIELD_FLT_N status
External interfaces
J1 — field input connector
J1 is the actual universal input terminal:
J1 pin 1 is UI1_FIELD, the field signal input.
J1 pin 2 is GND/return.
The same physical input terminal is used for all supported modes. The firmware changes the mode by driving the HC595 outputs that control the CD4066 analog switches.
J9/J10 — control and host interface
The host/controller connects to the ADC and control logic through the programming/control headers:
SPI_SCLK goes to AD7708 SCLK and HC595 SRCLK.
SPI_MOSI goes to AD7708 DIN and HC595 SER.
SPI_MISO comes from AD7708 DOUT.
ADC_CS_N selects the AD7708.
ADC_RDY_N reports when the AD7708 conversion data is ready.
ADC_RESET_N resets the AD7708.
HC595_LATCH, HC595_SRCLR_N, and HC595_OE_N control the shift register output latch, clear, and output-enable states.
UI1_DIG_OUT reports the comparator-backed digital input result.
The board expects an external 5V_IN rail. U10, an AP2204K-3.3TRG1 LDO, generates the local 3V3 rail.
Relevant parts:
U10: 3.3 V regulator.
C19 = 10 µF: bulk/input capacitor on 5V_IN near U10.
C20 = 10 µF: regulator output capacitor on 3V3.
C18 = 100 nF: additional local decoupling/filtering on 5V_IN.
The 3.3 V rail powers the AD7708 analog/digital supplies, HC595, CD4066 switch logic, comparator pull-ups, reference bias, and control pull-ups.
Field 24 V protection path
U1, LM76202QPWPRQ1, protects/supervises a field-power path:
FIELD_24V_IN feeds U1 IN.
U1 OUT creates FIELD_24V_PROT.
FIELD_FLT_N is the active-low fault/status output.
Support parts around U1:
Table
Part
Value
Function
C27
1 µF / 100 V
Input bypass from FIELD_24V_IN to GND
C22
47 µF / 63 V
Output bulk capacitor on FIELD_24V_PROT
R31
143 kΩ
UVLO upper divider from FIELD_24V_IN
R32
10 kΩ
UVLO lower divider to GND
R33
274 kΩ
OVP upper divider from FIELD_24V_IN
R34
10 kΩ
OVP lower divider to GND
R35
5.36 kΩ
ILIM setting resistor
R36
20 kΩ
IMON resistor
C26
12 nF
dVdT / soft-start timing capacitor
This block is separate from the UI1 signal-measurement path. It provides a protected field power rail and fault status, not the primary analog measurement front end.
Universal input front end
The universal input is built around UI1_FIELD, UI1_PROT, U6 CD4066, and U2 AD7708.
Input protection
The signal enters at J1:
J1 pin 1 is UI1_FIELD.
D1 SM6T18A TVS clamps UI1_FIELD to GND for surge/transient protection.
R1 = 1 kΩ connects UI1_FIELD to UI1_PROT, limiting current into the measurement network.
UI1_PROT feeds the selectable measurement paths.
0–10 V voltage mode
Voltage mode uses a resistor divider:
R2 = 30 kΩ from UI1_PROT to UI1_0_10V_DIV.
R3 = 10 kΩ from UI1_0_10V_DIV to GND.
This is a 4:1 divider. A 10 V input becomes approximately 2.5 V at UI1_0_10V_DIV, which is compatible with the 2.5 V ADC reference concept.
The divided signal is routed through U6 CONTROL_A / CTRL_VOLTAGE_MODE to the ADC node UI1_ADC.
0–20 mA current mode
Current mode uses a shunt resistor:
R4 = 165 Ω from UI1_PROT to GND.
At 20 mA, the shunt voltage is approximately:
Text
V = I × R = 0.020 A × 165 Ω = 3.3 V
That means this path can produce up to about 3.3 V at full-scale current. Because the ADC reference is 2.5 V, firmware/range validation should confirm that the selected ADC input range and protection assumptions are valid before production.
The current-mode node is routed through U6 CONTROL_B / CTRL_CURRENT_MODE to UI1_ADC.
Resistance / RTD / thermistor mode
Resistance-based sensors use a simple excitation path:
R5 = 10 kΩ is the sensor excitation resistor.
U6 connects 3.3 V to UI1_EXCITE_SRC under CTRL_RESISTANCE_MODE.
R5 then pulls/excites UI1_PROT.
The resulting divider voltage is measured by the AD7708 at UI1_ADC.
This supports thermistors such as 10k Type II and 10k Type III naturally because the excitation resistor is also 10 kΩ. PT1000 and NI1000 can also be measured, but a 10 kΩ excitation resistor gives lower sensitivity for ~1 kΩ sensors; firmware calibration and noise/error budgeting are important.
Digital input mode
Digital input mode routes the protected input to the comparator:
U6 connects UI1_PROT to UI1_DIG_SENSE under CTRL_DIGITAL_MODE.
UI1_DIG_SENSE goes to U3A, the first comparator inside the LM2903.
U3A compares the input against DIG_THRESHOLD.
UI1_DIG_OUT is the logic-level digital status output.
The threshold is generated by:
R29 = 100 kΩ from 3.3 V to DIG_THRESHOLD.
R30 = 100 kΩ from DIG_THRESHOLD to GND.
So the nominal digital threshold is around 1.65 V.
The comparator output uses:
R25 = 10 kΩ pull-up to 3.3 V.
UI1_DIG_OUT to the host/control header.
ADC measurement core
AD7708 ADC
U2, AD7708BRUZ, is the measurement ADC.
Implemented connections:
AIN1 is connected to the selected universal-input analog node UI1_ADC.
AIN2 through other unused analog inputs are tied to GND for a defined state.
REFIN1(+) is connected to the 2.5 V reference.
REFIN1(-) is connected to GND.
AVDD and DVDD are connected to 3.3 V.
AGND, DGND, and AINCOM are connected to GND.
SPI/control pins connect to the host headers.
ADC reference
IC1, LM4040AIZ-2.5/NOPB, creates the 2.5 V ADC reference:
R21 = 2.2 kΩ biases the shunt reference from 3.3 V.
IC1 cathode creates 2V5_REF.
IC1 anode is tied to GND.
C21 = 100 nF filters the reference.
2V5_REF goes to AD7708 REFIN1(+).
ADC clock
Y1 is a 32.768 kHz crystal connected to AD7708 XTAL1 and XTAL2:
C23 = 12 pF from ADC_XTAL1 to GND.
C24 = 12 pF from ADC_XTAL2 to GND.
Mode-control logic
U4, 74HC595PW, is used as a serial-to-parallel control expander. The host shifts mode-control bits into U4, then latches them to drive the CD4066 switch controls.
Table
U4 output
Net
U6 control
Meaning
QA
CTRL_VOLTAGE_MODE
CONTROL_A
Select 0–10 V divider path
QB
CTRL_CURRENT_MODE
CONTROL_B
Select 0–20 mA shunt path
QC
CTRL_RESISTANCE_MODE
CONTROL_C
Enable sensor excitation path
QD
CTRL_DIGITAL_MODE
CONTROL_D
Select digital comparator path
QE–QH, QH'
No connect
—
Spare/unused
Important firmware rule: normally assert only one mode-control line at a time. Enabling multiple CD4066 paths at once may short measurement networks together or corrupt readings.
Decoupling and filtering
The design includes multiple 100 nF local capacitors:
C1/C2: AD7708 AVDD/DVDD decoupling.
C3: LM2903 comparator supply decoupling.
C4: HC595 decoupling.
C6: CD4066 decoupling.
C7/C8/C9/C18: additional local decoupling/filter capacitors from the earlier architecture.
C10 = 100 nF: ADC input filter / charge bucket from UI1_ADC to GND.
The hardware is not self-ranging by itself. Firmware must:
Drive the HC595 mode bits.
Ensure only one measurement mode is active at a time.
Configure the AD7708 for the expected input range and conversion mode.
Read ADC_RDY_N, then read ADC data over SPI.
Convert raw ADC codes into engineering units using the active mode:
0–10 V: multiply ADC-measured divider voltage by 4.
0–20 mA: compute current from shunt voltage / 165 Ω.
Resistance/RTD/thermistor: compute resistance from the divider equation, then apply RTD or thermistor calibration tables.
Digital input: read UI1_DIG_OUT, or optionally cross-check with ADC voltage.
Monitor FIELD_FLT_N if field-power protection status is relevant.
Current validation status
From the latest project review:
Schematic/ERC categories checked so far are generally clean for the single-channel schematic.
Current DRC still reports 2 airwire errors.
Manufacturing review reports J9 missing manufacturer part number.
So the circuit is logically implemented, but the PCB should not be treated as fully fabrication-ready until the remaining airwires and manufacturing metadata issue are resolved.
Design concerns and follow-up items
0–20 mA full-scale voltage is about 3.3 V. With a 2.5 V reference, this needs ADC range confirmation or a lower shunt value if the AD7708 configuration cannot accept that input span.
PT1000/NI1000 sensitivity may be modest with a 10 kΩ excitation resistor. This is usable as an architecture, but final accuracy depends on ADC noise, excitation tolerance, and calibration.
Digital threshold is fixed around 1.65 V. If the intended digital input standard is 24 V industrial DI, the threshold/hysteresis/protection strategy should be reviewed.
CD4066 switch on-resistance and leakage affect precision. For higher-accuracy RTD/resistance measurements, switch resistance and leakage should be included in calibration/error budget.
The current design is non-isolated. Field input return shares board GND.
Routing is not fully complete yet. Latest review shows remaining airwire errors.
J9 metadata needs completion if manufacturing/BOM checks must pass cleanly.
Practical explanation in plain language
This circuit lets one physical input connector behave like several different input types. A host controller sends configuration bits to the HC595. The HC595 turns on one path inside the CD4066 analog switch. Depending on which path is selected, the field signal is scaled as voltage, converted from current through a shunt, excited as a resistance sensor, or compared as a digital input. The AD7708 then digitizes the selected analog voltage, while the LM2903 provides a direct digital status output for digital-input mode.
Single-channel Universal Input schematic with LM76202 field protection, AD7708 ADC measurement core, CD4066 mode switching, HC595 control mapping, and comparator-backed digital input support for DI, analog, 0-10 V, 0-20 mA, resistance, RTD, and thermistor modes.
Properties
Properties describe core aspects of the project.
Pricing & Availability
Distributor
Qty 1
Arrow
$4.72–$6.84
Digi-Key
$3.25–$5.02
HQonline
$1.58
LCSC
$3.62–$3.69
Mouser
$24.35
TME
$4.69
Verical
$6.18–$8.19
Controls
Welcome 👋
Flux helps you build PCBs faster with an AI teammate!
Create your account to collaborate, stay updated, fork your own version, and get instant answers from our AI agent.