1. How does it work?
1.1 Summary
The MODSPI ADC Module simplifies reading 0-10V sensor signals with this plug and play solution.
Many microcontrollers have built-in ADCs, but these are often limited to 10-bit resolution and can only handle input voltages up to their supply voltage (typically 3.3V or 5V). This module eliminates the need for external circuitry to scale signals, offering two channels of 12-bit ADC capable of directly handling 0-10V inputs.
Each channel is equipped with a precision op-amp for signal conditioning, ensuring accurate and reliable readings. The onboard 12-bit SPI ADC delivers high-resolution conversions, while compatibility with both 3.3V and 5V systems ensures seamless integration with a wide range of microcontrollers. Whether you're working with industrial sensors or high-precision applications, the MODSPI ADC Module provides a simple, efficient, and accurate solution for handling higher voltage signals.
1.2 Analog to Digital Converter
This module incorporates an MCP3202, a 12-bit Analog to Digital Converter (ADC), featuring dual-channel inputs capable of reading signals in the 0-5V range. To ensure consistent performance regardless of whether the supply voltage (VIO) is 5V or 3.3V, the module generates its required 5V through an onboard voltage regulator. This design choice allows the ADC to operate correctly and provide accurate conversions under varying VIO conditions.

1.3 Scaling Inputs
To scale inputs from a 0-10V range to fit the ADC’s 0-5V range, the module initially employs a precision op-amp configured as a buffer (or level follower) to convert the high-impedance signal to low impedance. This step ensures that the signal can be handled more effectively without significant loading on the source. Following this impedance matching, the signal undergoes attenuation through a simple voltage divider, effectively halving its voltage to align with the ADC’s input range.
1.4 Level Shifters
Given that the ADC operates at 5V, the module ensures that the SPI communication signals are compatible with the VIO of the connected microcontroller, which may be either 3.3V or 5V. To achieve this, the module employs Bus Transcievers to configure the SPI Signal Voltage ensuring reliable data exchange between the ADC and the microcontroller regardless of the VIO level.
2. Specification
2.2. Pinout

2.3. Electrical Characteristics
Coming Soon...
3. Code
Overview
This example demonstrates how to use the MODSPI_AnalogInputs class to control a set of analog inputs channels. The code initializes a MODSPI_AnalogInputs instance, reading the analog input as a value and a 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 input 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.
int readValue (int channel)
Returns the specified input channel (from 0 - 1) as a value (between 0 - 4095)
float readVoltage (int channel)
Returns the specified input channel (from 0 - 1) as a 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_AnalogInputs
Next you create an instance of the MODSPI_AnalogInputs class and name it whatever you want, for example analogInputs1.
If you have multiple analog Input modules, you will need to create additional instances.
MODSPI_AnalogInputs analogInputs1;
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 analogInputs1 instance with D5 as the chip select pin.
analogInputs1.begin(D5); // D5 is the chip select pin.
}
Main Loop
In the main loop function we cycle through the two analog input channels, printing both the ADC value and the voltage.
void loop() {
// Loop through analog inputs 0 to 1 and read their values and voltages.
for (int a = 0; a <= 1; a++) {
// Print the ADC value to the serial monitor.
int readADCValue = analogInputs1.readValue(a); // Read the raw ADC value of input 'a'.
Serial.print("Analog Input ");
Serial.print(a);
Serial.print(": ADC Value = ");
Serial.println(readADCValue);
​
// Print the ADC voltage to the serial monitor.
float readADCVoltage = analogInputs1.readVoltage(a); // Read the voltage of input 'a'.
Serial.print("Analog Input ");
Serial.print(a);
Serial.print(", Voltage = ");
Serial.println(readADCVoltage);
}
​
delay(500); // Wait for 500 milliseconds before repeating the loop.
}