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 board (STM32H747 dual-core M7 at 480 MHz + M4, 76 I/O pins, 2 DACs, FDCAN) powered over USB-C or 5-24 V. 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, install the « Arduino Zephyr-based Boards » (or Mbed) platform, select « Arduino Giga R1 », then Upload. 3.3 V logic.
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);
}
}