top of page

1. How does it work?

1.1 Summary

1.How Does it Work?
- 1.1 Summary

Many analog devices require a 0-10V analog output, a requirement challenging to meet directly with a microcontroller due to its limited output range and resolution, typically necessitating complex external circuitry. This module simplifies the process, providing two channels of 12-bit analog outputs capable of delivering the necessary 0-10V range.

It is designed to be versatile, accepting either 3.3V or 5V logic levels, thanks to an onboard 5V voltage regulator that ensures a constant reference voltage. This setup provides a stable and accurate analog output, making it suitable for interfacing with a wide range of analog devices.

1.2 Digital to Analog Converter

- 1.2 Digital to Analog Conerter

This module utilizes the MCP4922, a 12-bit Digital to Analog Converter (DAC), which offers a dual-channel output. Initially capable of delivering 0-5V, the output range is extended to 0-10V through the application of a precision op-amp. With its 12-bit resolution, the MCP4922 provides 4096 unique analog voltage levels, achieving a fine granularity of approximately 0.25mV per level. This precision ensures detailed control over the output, making the module ideal for applications that demand a 0-10V signal range.

Analog Output MCP4922.png

1.3 Precision Op Amp

- 1.3 Precision Op Amp

To achieve the 0-10V output range, the module employs a precision op-amp for each channel, configured to double the output voltage from the initial 0-5V to 0-10V by applying a 2x gain. This scaling approach ensures that each channel can precisely deliver the expanded voltage range, maintaining the integrity and accuracy of the signal output suitable for various applications requiring a 0-10V range.

1.4 Level Shifters

- 1.4 Level Shifters

Given that the DAC operates at 5V, the module must ensure that the SPI communication signals are compatible with the VCC of the connected microcontroller, which may be either 3.3V or 5V. To achieve this, the module employs MOSFETs as level shifters. These MOSFETs adjust the SPI signal levels to match the VCC provided, ensuring reliable data exchange between the ADC and the microcontroller regardless of the VCC level.

levelshifters.png

2. Specification 

- 2.1 Form
2. Specification

2.2. Pinout

Pinout_edited.jpg
- 2.2 Pinout

2.3. Electrical Characteristics 

Coming Soon...

- 2.3 Electrical Characteistics
- 2.4 Schematic

2.5. BOM

BOM.png
- 2.5 BOM

3. Code

3. Code

Overview

This example demonstrates how to use the MODSPI_AnalogOutputs class to control a set of digital output channels. The code initializes a MODSPI_AnalogOutputs instance and ramp up from 0 - 10.0V on channel 0 using both value and voltage.

Prerequisites

Ensure you have the MODSPI library installed in your Arduino IDE. If not, you can download and install it from the Library Manager or GITHUB.

Available Functions

Void begin (int chipSelect)

Starts the Initializes the analog output module with the specified chip select pin. If you're using a MODSPI controller you can also put in "BAY1" and select your desired bay.

Void writeValue (int channel, int value)

Sets the specified output channel (from 0 - 1) to the given value (between 0 - 4095).

Void writeValue (int channel, float voltage)

Sets the specified output channel (from 0 - 1) to the given voltage (between 0 - 10.0v).

Example Code Breakdown

Include the MODSPI Library

First, we need to include the MODSPI library to access the necessary functions and classes.

#include <MODSPI.h>      

Create an Instance of MODSPI_AnalogOutputs

Next you create an instance of the MODSPI_AnalogOutputs class and name it whatever you want, for example analogOutputs1.

If you have multiple analog output modules, you will need to create additional instances.

MODSPI_AnalogOutputs analogOutputs1;       

Setup Function

The setup function is called once when the Arduino starts. Here, we initialize the instance and perform some initial actions.

void setup() {

    // Initialize the analogOutputs1 instance with D5 as the chip select pin.

    analogOutputs1.begin(D5); // D5 is the chip select pin.

}

Main Loop

In the main loop function we ramp up from 0 - 10.0V on channel 0 using both value and voltage.

void loop() {

    // Ramp up from 0.0V to 10.0V on channel 0 by setting raw values (0 to 4095).
 
   for (int a = 0; a <= 4095; a++) {
        analogOutputs1.
writeValue(0, a); // Set channel 0 to value 'a'.
        delay(1); // Wait for 1 millisecond before setting the next value.
    }

    // Ramp up from 0.0V to 10.0V on channel 0 by setting a voltage.

    for (float a = 0; a <= 10; a += 0.2) {

        analogOutputs1.writeVoltage(0, a); // Set channel 0 to voltage 'a'.
        delay(100); // Wait for 100 milliseconds before setting the next voltage.

    }  

}

4. Downloads

4. Downloads

MODSPI Analog Outputs Datasheet

MODSPI Analog Outputs V1.0 Schematic


CAD Models

MODSPI Arduino Library

Want this product?

Check out our shop!

bottom of page