Skip to content
A .NET library for controlling an Arduino board directly through a USB (serial) connection.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
Images Replace images. Nov 11, 2016
.gitignore Update to newer version of ArduinoUploader. Jan 11, 2018 Create Oct 7, 2016 Update Jun 22, 2017


A .NET library to easily connect, drive and debug an Arduino through a simple and highly Arduino syntax compatible request / response protocol running over the serial (USB) connection.



A two-line snippet can illustrate some of the library's features:

var driver = new ArduinoDriver(ArduinoModel.UnoR3, true);
driver.Send(new ToneRequest(8, 200, 1000));
  • This creates an ArduinoDriver for a specific Arduino Model (in this case an Uno).

  • The relevant COM port is autodetected (although a constructor overload for specifying the port exists).

  • The second parameter to the constructor (autoBootstrap) enables automated deployment of our protocol listener onto the Arduino (if necessary). This means you don't have to compile / deploy anything on the Arduino itself in order to start using this library (the library uses the related ArduinoSketchUploader library to achieve this).

  • Use the Send method on the driver in order to send a message to the Arduino, and receive a response. Most of the typical Arduino library methods have completely analogous request / counterparts:

    • AnalogReadRequest / AnalogReadResponse
    • AnalogWriteRequest / AnalogWriteResponse
    • DigitalReadRequest / DigitalReadResponse
    • DigitalWriteRequest / DigitalWriteResponse
    • PinModeRequest / PinModeResponse
    • ...

The protocol itself supports:

  • Handshaking and version negotation
  • High speed communication
  • Fault tolerance and error detection (through fletcher-16 checksums)


The library has been tested with the following configurations:

Arduino Model MCU Bootloader protocol
Leonardo ATMega32U4 AVR109
Mega 2560 ATMega2560 STK500v2
Micro ATMega32U4 AVR109
Nano (R3) ATMega328P STK500v1
Uno (R3) ATMega328P STK500v1

If you have a need for this library to run on another Arduino model, feel free to open an issue on GitHub, it should be relatively straightforward to add support (for most).

How to use the .NET library

NuGet version

Link the following nuget package in your project in order to use the ArduinoDriver:

Alternatively, install the package using the nuget package manager console:

Install-Package ArduinoDriver


The library channels log messages (in varying levels, from Info to Trace) via NLog. Optionally, add a nuget NLog dependency (and configuration file) in any project that uses ArduinoDriver in order to redirect these log messages to preferred log targets.

Sample Code Project: Super Mario Bros "Underworld" theme

This sample project uses the library above to play this classic retro tune on an Arduino with C#.

One pin of the buzzer should be connected to digital pin 8. The other pin should be connected to GND.

The sample code is configured for an UNO. Don't forget to change the following line if you have another Arduino model attached:

// ----------> CHANGE THIS!
private const ArduinoModel AttachedArduino = ArduinoModel.UnoR3;
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.