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.
- Supported boards: Arduino Uno, Mega, Nano, Leonardo, and compatible clones.
- Connection methods: USB CDC (virtual COM), direct GPIO via a breakout, or via the IoT Edge board.
- Development environments: Visual Studio, VS Code, Arduino IDE, PlatformIO.
Getting Started
- Install the tools – Visual Studio 2022 with the "Desktop development with C++" and "Universal Windows Platform development" workloads.
- Connect the Arduino via USB. Windows will install the
usbserdriver automatically. - Create a new project – Choose Blank App (Universal Windows) and select the target device family
Windows 10 IoT Core. - Add the Arduino package – In your project, right‑click
References→Add Reference…→Windows.Devices.SerialCommunication. - 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 Pin | Connection |
|---|---|
| 5V | Power LED & TMP36 |
| GND | Common ground |
| Pin 13 | LED (through 220 Ω resistor) |
| A0 | TMP36 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.