Skip to content
Back to skills

Esp32 Mcp4725 Analog Output

ASecurity

Use when an ESP32 must output an analog voltage - 0 to 10 V command, valve position, 4-20 mA loop driver or a setpoint - with an MCP4725 or a similar I2C DAC. Covers reference, buffering and the load it cannot drive.

  • 16 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 7, 2026
ai-agents

Works with

  • terminal
  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 7, 2026

npx -y skills add Esmail-sarhadi/esp32-agent-skills --skill esp32-mcp4725-analog-output --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Esp32 Mcp4725 Analog Output?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Esp32 Mcp4725 Analog Output
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/esmail-sarhadi-esp32-mcp4725-analog-output/badge)](https://www.skillsdirectory.com/skills/esmail-sarhadi-esp32-mcp4725-analog-output)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: esp32-mcp4725-analog-output
description: Use when an ESP32 must output an analog voltage - 0 to 10 V command, valve position, 4-20 mA loop driver or a setpoint - with an MCP4725 or a similar I2C DAC. Covers reference, buffering and the load it cannot drive.
license: MIT
---

# Analog output with MCP4725

A DAC is not an analog output. The MCP4725 gives you a 12-bit voltage on a pin
that can source about 20 mA and cannot drive a cable, a valve or a 4-20 mA loop.

## The chain, not the chip

```
DAC -> op-amp buffer -> (optional gain x2.5) -> protection -> field terminals
```

- **Buffer** is mandatory for anything leaving the board. The DAC output
  impedance changes with code, so a load pulls the voltage down by an amount that
  depends on the value you set - a nonlinearity that looks like a software bug.
- **Gain** turns 0 to 4.096 V into 0 to 10 V with a non-inverting stage. The
  op-amp needs a rail above 10 V, so a 12 V supply is the usual choice.
- **Protection** on the field terminals: a miswired 24 V finds the op-amp
  otherwise.

## The reference decides everything

MCP4725 variants use VDD or an internal 2.048 V reference. With VDD as reference,
every millivolt of supply noise appears in the output. For a setpoint, use the
internal reference and a clean supply, or an external reference.

Code to volts: `V = code / 4096 * Vref`. One LSB on a 4.096 V reference is 1 mV;
after a x2.5 gain it is 2.5 mV at the terminals. State that in the design.

## I2C details that bite

- Address 0x60 to 0x67 by part and A0 strap.
- The write is 3 bytes (fast mode) or 5 bytes (write EEPROM). Writing EEPROM on
  every setpoint change wears it out and takes 25 ms - do not.
- On power-up the DAC loads from EEPROM. If you wrote a value once during a test,
  the output starts there forever until you rewrite it.

## Symptom table

| Symptom | Usually |
|---|---|
| output sags when the load connects | no buffer, load above 20 mA |
| output moves in steps larger than 1 LSB | wrong reference assumed |
| output starts at a random value at boot | EEPROM holds an old setpoint |
| 50 Hz ripple on the output | VDD reference, shared with a switching rail |
| device not found | address strap, 5 V pull-ups on a 3.3 V bus |

## Agent rules

- Never specify a DAC output as a field signal without a buffer and protection.
- State the reference, the gain and the resulting resolution in volts.
- Define the safe output at boot, before the first I2C write.

Files in this skill

  • LICENSE.txt857 B
  • SKILL.md2.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.