BT

InfoQ Homepage News Advanced IoT Application Support in .NET Core 3 with System.Device.Gpio

Advanced IoT Application Support in .NET Core 3 with System.Device.Gpio

Bookmarks

System.Device.Gpio is a new open-source library for .Net Core that aims to enable IoT applications to interact with sensors, displays, and input devices through their GPIO pins or other I/O control hardware. The library is augmented by a community-maintained collection of bindings for a number of devices.

As Microsoft .NET program manager Richard Lunder demoed, the new library gives developers control over the general purpose I/O (GPIO) pins of single-board-computers through a set of APIs that can be used to control external devices. This was not easily possible previously using .NET Core, although .NET Core could run for example on a Raspberry Pi. Supported platforms include the Raspberry Pi, BeagleBoard, HummingBoard, and ODROID, but leave out popular Arduino boards such as the UNO, Mega, Nano, etc.

The new library, which is available through a NuGet package, can run on Linux as well as Windows 10 IoT Core by relying on native drivers available for those platforms. For Linux distros based on Linux 4.8 and newer versions, System.Device.Gpio uses libgpiod, which supersedes the GPIO sysfs interface that provides a more limited and slower GPIO access available for older Linux versions. For top performance, albeit at the cost of portability, System.Device.Gpio on Linux also supports GPIO access through /dev/mem, although these board-specific drivers could be removed in the future.

System.Device.Gpio has a companion library called Iot.Device.Bindings aimed to make it easier to use many existing "dumb" sensors, displays, and input devices by providing developers a higher-level API to access them instead of relying on their pin-level protocols. Currently, Iot.Device.Bindings include bindings for dozens of devices such as A/D converters, accelerometers, gas sensors, light sensors, barometers, and many more. It is important to note the Iot.Device.Bindings are a community effort and not fully supported by Microsoft.

Lunder, who demoed using Visual Studio Code on a Mac to run a LED-controlling application running on a Raspberry Pi 3 with full support for step-by-step debugging, said parts of System.Device.Gpio are written in C++ but they are being progressively ported to C#, which should make it easier for .NET developers to contribute improvements and fixes.

System.Device.Gpio is considered still experimental and Microsoft is seeking active feedback on its API, which could thus change in future versions.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.