Main Content

Analog Output

Generate voltage on the specified DAC pin

Add-On Required: This feature requires the Simulink Support Package for Arduino Hardware add-on.

  • Analog Output block

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 Nano 33 BLE Sense

  • Arduino MKR 1000

  • Arduino MKR Zero

  • Arduino MKR Wi-Fi® 1010

  • Arduino Nano 33 IoT

  • Arduino compatible ESP32 – WROOM and ESP32 – WROVER

  • Arduino Uno R4 Wi-Fi

  • Arduino Uno R4 Minima

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.

VariableArduino BoardsDescription
Arduino Due, Arduino 33 BLE SenseArduino MKR1000, Arduino MKR Wi-Fi 1010, Arduino ZERO, Arduino Nano 33 IoTArduino Uno R4 Wi-Fi, Arduino Uno R4 MinimaArduino Compatible ESP32 boards
Vref2.23.2753.3

Reference voltage for the DAC pin.

input0 < input < 40950 < input < 10230 < input < 40950 < input < 255

Input voltage to the block must lie within this range. Any value outside the given range saturates the voltage output at the DAC pin.

N1210128

Number of bits on DAC channel.

Voffset0.560.00700

Offset voltage on Arduino board.

Ports

Input

expand all

The block inputs the digital voltage.

Data Types: uint16

Parameters

expand all

Select a DAC pin on which to generate analog voltage.

This table lists the Arduino boards and DAC pin configuration that the block supports.

Arduino BoardsSupported Number of DAC PinsSupported DAC PinsSupported Number of Bits for DAC Pins
Arduino DueTwoDAC0, DAC112-bit
Arduino Nano 33 BLE SenseTwoDAC0, DAC112-bit
Arduino MKR1000OneDAC010-bit
Arduino MKR Wi-Fi 1010OneDAC010-bit
Arduino MKR ZEROOneDAC010-bit
Arduino Nano 33 IoTOneDAC010-bit
Arduino Uno R4 Wi-FiOneDAC012-bit
Arduino Uno R4 MinimaOneDAC012-bit
Arduino compatible ESP32 – WROOMTwoDAC1, DAC28-bit
Arduino compatible ESP32 – WROVERTwoDAC1, DAC28-bit

Click View pin map to open the Arduino Pin Mapping table. To know how to assign pins for the block, see Pin Mapping for Arduino Timer-Independent Blocks.

Version History

Introduced in R2014a