4-20 mA Circuit Design for STM32

I've added all the required components into your schematic and wired them as described. Here's a summary of what was done:

Components Added

Table


DesignatorPart NameValue/ConfigurationLink
R1Generic Resistor100 Ω (Sense resistor)
U1Generic OpAmpConfigured as a voltage follower, powered by 3.3V/GND
R2Generic Resistor10 kΩ (Filter resistor)
C2Generic Capacitor0.16 μF (RC filter capacitor)
U2Generic Dual ComparatorDual comparator for window comparison
R3Generic Resistor68 kΩ (Lower divider top)
R4Generic Resistor10 kΩ (Lower divider bottom)
R5Generic Resistor10 kΩ (Upper divider top)
R6Generic Resistor15 kΩ (Upper divider bottom)
D1Generic DiodeUsed in the lower clamp network
D2Generic DiodeUsed in the upper clamp network
U3STM32G030C8T8Microcontroller for ADC interface

Schematic Wiring Overview
  1. Current-to-Voltage Conversion Block
    • R1 (Sense Resistor): One terminal is connected to the external 4–20 mA current source; the other terminal forms the V_sense node.
    • U1 (OpAmp Buffer):
      • Non-Inverting Input: Connected to V_sense.
      • Inverting Input: Tied to the op-amp output (voltage follower configuration).
      • Supply Pins: Powered by +3.3V and GND.
    • The output of U1 now represents the buffered voltage across [R1].
  2. Low-Pass Filtering Block
    • R2 (Filter Resistor): Connected in series with the output of U1.
    • C2 (Filter Capacitor): Connected between the node after R2 (labeled Filtered_V) and GND.
    • This RC network yields a 100 Hz cutoff frequency.
  3. Window Comparator for Fault Detection
    • Lower Threshold Setup:
      • R3 (68 kΩ) and R4 (10 kΩ) form a voltage divider between +3.3V and GND.
      • The divider’s junction produces ~0.4V, which is connected to the inverting input of the lower comparator within U2.
      • The non-inverting input of this comparator is connected to Filtered_V.
    • Upper Threshold Setup:
      • R5 (10 kΩ) and R6 (15 kΩ) form a voltage divider between +3.3V and GND.
      • The junction produces ~2.0V, which is connected to the inverting input of the upper comparator within U2.
      • The non-inverting input of this comparator is also connected to Filtered_V.
    • The outputs of the two comparator halves provide digital fault signals: one goes active when Filtered_V falls below 0.4V (indicating 20 mA).
  4. Output Clamping Network
    • Lower Clamp [D1]:
      • Anode: Connected to Filtered_V.
      • Cathode: Tied to the lower threshold junction (from the divider [R3]-[R4]).
      • This clamps the voltage if it tries to drop significantly below 0.4V.
    • Upper Clamp [D2]:
      • Cathode: Connected to Filtered_V.
      • Anode: Tied to the upper threshold junction (from the divider [R5]-[R6]).
      • This clamps the voltage if it exceeds approximately 2.0V.
    • The voltage at the Filtered_V node—after clamping—is then a linear representation of the 4–20 mA current within the specified range.
  5. ADC Interface and MCU Integration
    • The final clamped analog voltage at Filtered_V is routed to an ADC input of the STM32G030C8T8.
    • The digital fault outputs from U2 are wired to dedicated digital input pins of the microcontroller for out-of-range signaling.

All components and connections have been added according to your specified design requirements. Your schematic now contains a complete 4–20 mA current sensing front-end with a 100 Hz low-pass filter, linear output clamping, and digital fault indicators for currents below 4 mA or above 20 mA.
Feel free to review the schematic in Flux, and let me know if any refinements or adjustments are required!
Complete schematic creation


No results...

Circular Brown Warp Drive

Circular Brown Warp Drive thumbnail
Welcome to your new project. Imagine what you can build here.

Properties

Properties describe core aspects of the project.

Pricing & Availability

Distributor

Qty 1

Controls