dac-onde.ino
Two true 12-bit DACs: the GIGA outputs a clean analog voltage, not filtered PWM. The ramp checks out on a multimeter; the sine wave makes a backup signal generator.
Hardware required
An Arduino GIGA R1 WiFi (STM32H747, 1DX radio module: Wi-Fi b/g/n + BLE, u.FL antenna included), powered over USB-C. A multimeter (or scope) on A0; an op-amp if you need drive.
Wiring
Probe on A0 and GND. The DAC sources ~3 mA: enough for an external ADC or a filter, not a speaker.
How it works
analogWrite on a DAC pin writes the converter directly (no timer); 12-bit resolution gives 0.8 mV steps. The 100-point sine is a home-brew sampler. In the Arduino IDE, « Arduino Zephyr-based Boards » platform, « Arduino Giga R1 » board; fit the u.FL antenna before using the radio, then Upload.
Going further
A frequency-sweep generator (chirp), or bias-voltage control of an RF module.
dac-onde.ino
// DAC0 (A0) : rampe en escaliers de 0 a 3,3 V — a verifier au multimetre.
// La GIGA a 2 DAC 12 bits reels (A0, A1), rares en Arduino.
const int DAC = A0;
void setup() {
analogWriteResolution(12);
Serial.begin(115200);
}
void loop() {
for (int pas = 0; pas <= 4095; pas += 256) {
analogWrite(DAC, pas);
float v = pas * 3.3f / 4095.0f;
Serial.printf("code %4d -> %.3f V attendus\n", pas, v);
delay(250);
}
// Petite sinusoide 10 Hz sur 100 points (sortie audio bas de gamme)
for (int t = 0; t < 100; t++) {
float e = 2048 + 2000 * sinf(t * 2 * PI / 100);
analogWrite(DAC, (int)e);
delay(5);
}
}