All projects
PRJ-05 · Embedded Firmware
Professional ProjectMarine / Industrial ElectronicsCompleted

4-Channel Analog Output Controller – Embedded Firmware Development

Developed the embedded firmware for an RP2040-based four-channel industrial analog output controller used as part of a wider marine / industrial electronic control system, supporting configurable current and voltage ranges (4–20 mA, 0–20 mA, 0–24 mA, 0–10 V, -10 V to +10 V). The firmware handled UART command processing, independent channel control, calibration, scaling, persistent configuration, watchdog supervision, filtering, fault handling and hardware-level validation.

RP2040Embedded C/C++UARTExternal DACAnalog OutputsIndustrial Analog Outputs4–20 mA0–20 mA0–24 mA0–10 V±10 V
Conceptual illustration: UART host to RP2040 to 4-channel analog output, with current and voltage output modes
Technical illustration — not a photograph of the proprietary product.
01 Project Overview

The controller provided four independently controlled industrial analog output channels, supporting configurable current and voltage ranges including 4–20 mA, 0–20 mA, 0–24 mA, 0–10 V and -10 V to +10 V. The RP2040 firmware received commands over UART, processed the requested output values, applied channel-specific calibration, scaling and filtering, and controlled an external DAC / analog-output stage to generate the required industrial analog signal.

The firmware was responsible for
  • ▸UART communication
  • ▸Command parsing
  • ▸Command validation
  • ▸Control of four independent analog channels
  • ▸Current / voltage output mode handling
  • ▸Calibration
  • ▸Scaling & output correction
  • ▸Configuration storage
  • ▸Non-volatile memory handling
  • ▸Filtering
  • ▸Watchdog supervision
  • ▸Fault handling
  • ▸Startup / initialization
  • ▸Recovery behaviour
  • ▸Hardware / firmware integration
  • ▸Output validation

The controller was designed to operate reliably as part of a wider marine / industrial control system.

02 My Contribution

I was responsible for the embedded firmware development of the controller and its integration with the electronic hardware.

Firmware architecture
RP2040 firmware development
UART communication handling
Command parsing and validation
Four-channel analog output control
External DAC interfacing
Current & voltage output mode handling
Per-channel calibration logic
Output scaling & correction
Non-volatile configuration management
EEPROM / persistent parameter handling
Watchdog implementation
Filtering
Fault handling
Startup and initialization logic
Hardware / firmware debugging
Analog output testing
Calibration verification
System-level validation
03 System Architecture
Host / Main Control System
UART
RP2040
Command Processing
Calibration + Scaling + Filtering
External DAC / Analog Output Stage
CH1
CH2
CH3
CH4

Four independent channels

Configurable Industrial Analog Output Modes
Current
4–20 mA0–20 mA0–24 mA
Voltage
0–10 V-10 V to +10 V

Selectable per channel — ranges, not separate physical outputs

04 Industrial Analog Output Modes

The controller was designed to support multiple analog signal ranges commonly used in industrial and marine control systems.

4–20 mACurrent

Industrial current-loop output with a non-zero lower bound, useful for distinguishing a valid low-scale signal from a loss-of-signal condition.

0–20 mACurrent

Full-range current output starting from zero current.

0–24 mACurrent

Extended current-output range for applications requiring additional current range or system-specific scaling.

0–10 VVoltage

Common unipolar industrial voltage-control range.

-10 V to +10 VVoltage

Bipolar voltage-output range supporting both positive and negative control signals.

Output Channel
Output Mode Selection
Current Output
4–20 mA
0–20 mA
0–24 mA
Voltage Output
0–10 V
-10 V to +10 V
05 Channel Configuration

Each output channel could be independently controlled and configured for the required analog range. The firmware converted the requested engineering value into the appropriate calibrated DAC command for the selected current or voltage mode.

Requested Engineering Value
Selected Output Mode
Current or Voltage Range
Calibration
Scaling
Filtering
DAC / Analog Output Stage
Industrial Analog Output
06 Firmware Architecture
UART RX
Diagnostics
Command Parser
Command Validation
Fault Handling
Channel Selection
Output Mode Selection
Non-volatile Configuration
Requested Output Value
Calibration
EEPROM / Persistent Parameters
Scaling
Filtering
DAC Update
Watchdog
Analog Output

Main flow (solid) · supporting firmware modules (dashed)

07 UART Command Interface

The controller received control commands over UART from a higher-level control system. Incoming commands could define the target channel, the requested output value and the selected output mode / range. The firmware parsed and validated each command, selected the channel and range, applied calibration / scaling and updated the external DAC.

UART Command
Command Parser
Channel Selection
Output Mode Selection
Current / Voltage Range
Calibration / Scaling
DAC Update
Analog Output
08 Per-Channel Calibration

Per-channel calibration was used to compensate for analog component tolerances and improve output accuracy across the supported current and voltage ranges. Calibration parameters were stored in non-volatile memory and applied by the firmware when calculating the final output command.

Requested Output
Output Mode Selection
Current / Voltage Range Selection
Per-Channel Calibration
Output Scaling
Filtering
DAC Code
Measured Analog Output

// Conceptual calibration model — not the exact implementation.

09 Non-Volatile Configuration

Calibration and operating parameters were stored in non-volatile memory so that device configuration could be restored after power cycles or resets.

Load
Configuration loaded at startup
Validate
Stored parameters validated
Update
Configuration updated
Restore
Operating state restored
10 Reliability & Fault Handling

The firmware was designed not only for normal operation, but also to maintain predictable behaviour when communications, configuration or runtime conditions were invalid.

  • ▸Watchdog supervision
  • ▸Invalid command handling
  • ▸Parameter validation
  • ▸Safe startup behaviour
  • ▸Fault recovery logic
  • ▸Predictable output behaviour during abnormal conditions
Normal Operation
Invalid UART Command
Reject / Error Handling
Invalid Configuration
Validation / Safe Behaviour
Firmware Stall
Watchdog Recovery
11 Output Filtering

Firmware-based filtering was used to improve output stability and reduce unwanted fluctuations before updating the analog output.

Input / Requested Value
Filtering
Calibration
DAC
Stable Analog Output
12 Testing & Validation

Firmware and electronics were validated together, channel by channel and range by range, against measured analog outputs.

Current-output testing
  • ▸4–20 mA range verification
  • ▸0–20 mA range verification
  • ▸0–24 mA range verification
Voltage-output testing
  • ▸0–10 V range verification
  • ▸-10 V to +10 V range verification
General validation
  • ▸Minimum output testing
  • ▸Maximum output testing
  • ▸Mid-scale verification
  • ▸Commanded value versus measured output
  • ▸Channel-by-channel calibration verification
  • ▸Output linearity checks
  • ▸Configuration persistence testing
  • ▸Reset / watchdog recovery testing
  • ▸Invalid UART command testing
  • ▸Fault-condition testing
  • ▸Output behaviour during startup and recovery
UART Command
RP2040 Firmware
DAC / Analog Output Stage
Selected Current / Voltage Range
Multimeter / Oscilloscope
Measured Analog Output
Calibration / Validation
13 Technology Stack
RP2040Embedded C/C++UARTExternal DACAnalog OutputsIndustrial Analog Outputs4–20 mA0–20 mA0–24 mA0–10 V±10 VCurrent Loop ControlVoltage Output ControlAnalog CalibrationOutput ScalingEEPROM / Non-Volatile ConfigurationCalibrationWatchdogFilteringFault HandlingHardware DebuggingOscilloscopeMultimeter

// Technical details have been generalized to protect proprietary product information.