Compact I²C-controlled analog output board based on the Linearin GP8212S-TC50-EW (15-bit DAC → industrial 0 / 4–20 mA current loop).
Open interactive BOM ↗ — browser BOM for soldering / identifying parts (do not use the GitHub .html file viewer).
| Chip | GP8212S-TC50-EW (ESOP-8), 15-bit I²C |
| Output | 0–25 mA full scale (typical with Rs = 100 Ω); use 4–20 mA for industrial loops |
| Interface | I²C address 0x58, logic 2.7–5.5 V (Arduino & ESP32 friendly) |
| Module power | 5 V input → onboard MT3608 boost → ~12 V for the DAC |
| MCU examples | Arduino / ESP32 library in this repo; STM32 bit-bang reference included |
| Interactive BOM | Open in browser |
| Item | Link |
|---|---|
| GP8212S chip only | uge-one.com — GP8212S-TC50-EW |
| Empty bare PCB | uge-one.com — PCB for I2C 4–20 mA generator |
| Interactive BOM | Open live BOM |
Assembled modules: contact UGE Electronics.
software/GP8212S/ Arduino & ESP32 library + examples
docs/ GitHub Pages site + interactive BOM + images
hardware/ Link to the live BOM (GitHub code view cannot render HTML)
stm32_reference/ Original STM32F10x bit-bang I²C (MyI2C)
Option A — manual
- Download this repository (Code → Download ZIP) or clone it.
- Copy the folder
software/GP8212Sinto your Arduino libraries directory:- Windows:
Documents\Arduino\libraries\GP8212S - macOS:
~/Documents/Arduino/libraries/GP8212S - Linux:
~/Arduino/libraries/GP8212S
- Windows:
- Restart the Arduino IDE.
Option B — ZIP
Sketch → Include Library → Add .ZIP Library… and select a ZIP that contains the GP8212S folder (with library.properties at its root).
| Module | Arduino Uno / Nano | ESP32 (typical) |
|---|---|---|
| SDA | A4 | GPIO 21 |
| SCL | A5 | GPIO 22 |
| GND | GND | GND |
| 5 V | 5 V (powers MT3608 → ~12 V for the DAC) | 5 V capable supply to module VIN |
- Share GND between MCU and module.
- Do not feed the GP8212S chip
VCCpin from USB 5 V directly — use the module’s 5 V input so the MT3608 can boost to ~12 V. - I²C works at 3.3 V (ESP32) or 5 V (classic Arduino).
#include <Wire.h>
#include <GP8212S.h>
GP8212S dac; // I2C 0x58, 25 mA full scale (Rs = 100 Ω)
void setup() {
Serial.begin(115200);
#if defined(ESP32)
if (dac.begin(21, 22) != 0) { // SDA, SCL
#else
if (dac.begin() != 0) {
#endif
Serial.println("GP8212S not found");
while (true) {}
}
dac.setCurrent_mA(12.0); // milliamps
// dac.setPercent4_20(50); // 0–100% of 4–20 mA span
// dac.setDAC(0x3D70); // raw 15-bit code
}
void loop() {}After install: File → Examples → GP8212S
| Example | What it does |
|---|---|
| CurrentSweep | Sweeps 4 → 20 → 4 mA |
| SetAndStore | Set mA from Serial; optional NVM store() |
| Calibrate4_20 | Interactive two-point calibration with a meter |
| Method | Description |
|---|---|
begin(sda, scl, freq) |
Init I²C and probe (returns 0 on ACK) |
setCurrent_mA(mA) |
Output current in mA (0 … full scale) |
setPercent4_20(pct) |
0% → 4 mA, 100% → 20 mA |
setDAC(code) |
Raw 15-bit code 0 … 0x7FFF |
calibrate4_20(dac4, dac20) |
Use measured codes for accurate 4–20 mA |
store(sda, scl) |
Save last DAC value in chip NVM (survives power-off) |
Ideal codes with Rs = 100 Ω (0–25 mA full scale):
| Current | Approx. DAC |
|---|---|
| 4 mA | 5243 (0x147A) |
| 12 mA | 15728 (0x3D70) |
| 20 mA | 26214 (0x6666) |
| 25 mA | 32767 (0x7FFF) |
Datasheet: IOUT = (2.5 V / Rs) × (DATA / 0x7FFF).
At ~12 V loop supply (MT3608), use a 220–330 Ω load (compliance is lower than at 24 V).
- Power the module from 5 V, connect I²C, load on
IOUT, DMM in series (mA) or measureV / Racross the load. - Run Calibrate4_20, open Serial Monitor @ 115200.
- Trim to 4.000 mA → send
s4. - Trim to 20.000 mA → send
s20. - Send
applyand paste the printed line into your sketch:
dac.calibrate4_20(/* your 4 mA code */, /* your 20 mA code */);GitHub’s file viewer only shows HTML source. Use one of these instead:
| Live page (recommended) | Open interactive BOM |
| Docs home | ugeelectronics.github.io/…/ |
| Offline | Download docs/GP8212SBOM.html and double-click it |
First-time Pages setup (repo admins) — required once:
- Open Settings → Pages
- Under Build and deployment → Source, choose Deploy from a branch
- Branch: main, folder: /docs → Save
- Wait about a minute, then open the live BOM link above.
stm32_reference/MyI2C.c is the original STM32F10x open-drain bit-bang I²C layer (no high-level DAC API). The Arduino library replaces that with Wire and implements the GP8212S register write / store sequence.
- Default I²C address:
0x58. - Chip
VCCrange per datasheet: 9–36 V; this module uses ~12 V from MT3608 after 5 V input. - Max load resistance shrinks at 12 V vs 24 V — keep calibration / field loads in the ~220–330 Ω range unless you raise the boost voltage within safe design limits.
- There is no official Arduino library named GP8212S from the chip vendor; DFRobot’s GP8XXX covers related parts (e.g. GP8211S / GP8302) but not this module. Use UGE
GP8212Shere.
MIT — see LICENSE.
© 2026 UGE Electronics — uge-one.com


