Azure Sphere – ADC

This sample application demonstrates how to do analog-to-digital conversion in a high-level application.

The application samples and displays the output from a simple variable voltage source once per second. It uses the MT3620 analog-to-digital converter (ADC) to sample the voltage.

The sample uses the following Azure Sphere libraries.

Library Purpose
adc Manages the analog-to-digital converters (ADCs).
eventloop Invokes handlers for timer events.
log Displays messages in the Device Output window during debugging.


File/folder Description
app_manifest.json Application manifest file, which describes the resources.
CMakeLists.txt CMake configuration file, which Contains the project information and is required for all builds.
CMakeSettings.json JSON file for configuring Visual Studio to use CMake with the correct command-line options.
launch.vs.json JSON file that tells Visual Studio how to deploy and debug the application.
LICENSE.txt The license for this sample application.
main.c Main C source code file. This README file.
.vscode Folder containing the JSON files that configure Visual Studio Code for building, debugging, and deploying the application.
HardwareDefinitions Folder containing the hardware definition files for various Azure Sphere boards.


The sample requires the following hardware:

  1. Seeed MT3620 Development Kit or other hardware that implements the MT3620 Reference Development Board (RDB) design.

  2. 10K ohm Potentiometer.

Note: By default, this sample targets MT3620 reference development board (RDB) hardware, such as the MT3620 development kit from Seeed Studio. To build the sample for different Azure Sphere hardware, change the Target Hardware Definition Directory in the CMakeLists.txt file. For detailed instructions, see the README file in the HardwareDefinitions folder.


  1. Ensure that your Azure Sphere device is connected to your computer, and your computer is connected to the internet.

  2. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.04 or above. At the command prompt, run azsphere show-version to check. Upgrade the Azure Sphere SDK for Windows or Linux as needed.

  3. Enable application development, if you have not already done so, by entering the following line at the command prompt:

    azsphere device enable-development

  4. Clone the Azure Sphere samples repository and find the ADC_HighLevelApp sample in the ADC folder or download the zip file from the Microsoft samples browser.

Set up the ADC connections

  1. Connect MT3620 dev board pin H2.2 (GND) to an outer terminal of the potentiometer.
  2. Connect both pin 1 and pin 2 of jumper J1 to the other outer terminal of the potentiometer. This connects the MT3620 2.5 V output to the ADC VREF pin and to the potentiometer.
  3. Connect MT3620 dev board pin H2.11 (GPIO41 / ADC0) to the center terminal of the potentiometer.

ADC connections

Build and run the sample

To build and run this sample, follow the instructions in Build a sample application.

Test the sample

The ADC output is displayed in the output terminal or Device Output window during debugging. Adjust the potentiometer and observe that the displayed value changes, as shown in the following example output.

Show output from: Device Output
The out sample value is 2.500 V
The out sample value is 2.483 V
The out sample value is 2.337 V
The out sample value is 2.055 V

Next steps