Analog Output
Generate voltage on the specified DAC pin
Add-On Required: This feature requires the Simulink Support Package for Arduino Hardware add-on.
Libraries:
Simulink Support Package for Arduino Hardware /
Common
Description
The Analog Output block generates voltage on the specified DAC pin of the board.
You can run a Simulink® model containing Analog Output block in Connected IO mode on Arduino® boards.
Supported Arduino Boards
Arduino Due
Arduino MKR 1000
Arduino MKR Zero
Arduino MKR Wi-Fi® 1010
Arduino compatible ESP32 – WROOM
Arduino compatible ESP32 – WROVER
The Arduino Due board has two12-bit DAC pins, DAC0 and DAC1, available for conversion. When using this board, the block accepts a uint16 value but considers only the least significant 12 bits for conversion.
The Arduino MKR1000, Arduino MKR WIFI 1010, Arduino MKR ZERO, and Arduino Nano 33 IoT boards have one 10-bit DAC pin, DAC0, available for conversion. When using these boards, the block accepts a uint16 value but considers only the least significant 10 bits for conversion.
The Arduino compatible ESP32 – WROOM and ESP32 – WROVER boards have two 8-bit DAC pins that can be used for conversion, namely, DAC1 and DAC2. When using these boards, the block accepts a
uint16
value but considers only the least significant 8 bits for conversion.
The block outputs voltage
(Vout
) on the DAC pin,
such that:
Vout = VrefX(input/2N-1)+ Voffset
This table explains the variables in the formula.
Variable | Arduino Board | Description | ||
---|---|---|---|---|
Arduino Due, Arduino 33 BLE Sense | Arduino MKR1000, Arduino MKR WIFI 1010, Arduino ZERO, Arduino Nano 33 IoT | Arduino Compatible ESP32 boards | ||
Vref | 2.2 | 3.27 | 3.3 | Reference voltage for the DAC pin. |
input | 0 < input <
4095 | 0 < input <
1023 | 0 < input <
255 | When using Arduino Due, input provided to the block must be between 0 and 4095. Any value higher than 4095 saturates the voltage output at the DAC pin. When using Arduino MKR1000, input provided to the block must be between 0 and 1023. Any value higher than 1023 saturates the voltage output at the DAC pin. |
N | 12 | 10 | 8 | Number of bits on DAC channel. |
Voffset | 0.56 | 0.007 | 0 | Offset voltage on Arduino board. |
Ports
Input
Parameters
Version History
Introduced in R2014a