Example Code for Arduino-Measure Voltage
Measure Voltage by Arduino
Hardware Preparation
- DFRduino UNO R3 (or similar) x 1
- MCP3432 module ×1
- Regulated power or AA battery 1
- Dupont wires
Software Preparation
- Arduino IDE
- Download and install the Arduino MCP3424 library.
- About how to install the library?
Wiring Diagram

Other Preparation Work
- Adjust voltage of Regulated Power to 0-2.085V, and then power on.
- Install Arduino MCP3424 library, see Install Arduino MCP3424 library
- Open Arduino IDE
Sample Code
/* MCP 3424 version 1.2 example sketch OneShotConversion
Written by B@tto
Contact : [email protected]
In this example, one conversion per second is performed on channel 1 and 16 bits resolution.
A new conversion has to be initiated by the user
*/
#include <Wire.h>
#include <MCP3424.h>
MCP3424 MCP(0x68); // Declaration of MCP3424 with Address of I2C
long Voltage;
void setup(){
Serial.begin(9600);
MCP.Configuration(1,16,0,1); // Channel 1, 16 bits resolution, one-shot mode, amplifier gain = 1
}
void loop(){
MCP.NewConversion(); // New conversion is initiated
Voltage=MCP.Measure(); // Measure, note that the library waits for a complete conversion
Serial.print("Voltage = ");
Serial.print(Voltage);
Serial.println("uV"); // unit: microVolt
delay (1000);
}
Result
- Open Arduino serial monitor, the voltage will be displayed.
Was this article helpful?
