Windows IoT – Arduino Devices

Overview

The Arduino family of boards can be used as peripheral devices with Windows 10/11 IoT Core. Using the Windows.Devices.Gpio and Windows.Devices.SerialCommunication APIs, you can control LEDs, read sensors, and communicate via UART, I2C, or SPI.

Getting Started

  1. Install the tools – Visual Studio 2022 with the "Desktop development with C++" and "Universal Windows Platform development" workloads.
  2. Connect the Arduino via USB. Windows will install the usbser driver automatically.
  3. Create a new project – Choose Blank App (Universal Windows) and select the target device family Windows 10 IoT Core.
  4. Add the Arduino package – In your project, right‑click ReferencesAdd Reference…Windows.Devices.SerialCommunication.
  5. Deploy – Set the target device to your Raspberry Pi or other IoT device running Windows IoT Core and press F5.

Wiring Guide

Below is a basic wiring diagram for an Arduino Uno controlling an LED and reading a temperature sensor (TMP36).

Arduino wiring diagram
Arduino Pin Connection
5VPower LED & TMP36
GNDCommon ground
Pin 13LED (through 220 Ω resistor)
A0TMP36 analog output

Sample Code

This C# sample reads the analog temperature value from the TMP36 and toggles the LED every second.

using System;
using System.Threading.Tasks;
using Windows.Devices.Gpio;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace ArduinoIoTSample
{
    public sealed partial class MainPage : Page
    {
        private const int LED_PIN = 13;
        private const int ANALOG_PIN = 0; // Requires an external ADC; shown for illustration
        private GpioPin ledPin;
        private DispatcherTimer timer;

        public MainPage()
        {
            this.InitializeComponent();
            InitGpio();
            timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
            timer.Tick += Timer_Tick;
            timer.Start();
        }

        private void InitGpio()
        {
            var gpio = GpioController.GetDefault();
            if (gpio == null) return;
            ledPin = gpio.OpenPin(LED_PIN);
            ledPin.SetDriveMode(GpioPinDriveMode.Output);
            ledPin.Write(GpioPinValue.Low);
        }

        private void Timer_Tick(object sender, object e)
        {
            var current = ledPin.Read();
            ledPin.Write(current == GpioPinValue.High ? GpioPinValue.Low : GpioPinValue.High);
            // TODO: Read analog value via Serial/ADC and display
        }
    }
}

For a complete project, download the sample project archive.

Resources