The .NET Core GitHub project djaus2/DNETCoreGPIO runs on the RPi, whether Raspian or IoT-Core (unchanged) to exemplify some of the hardware capabilities of the GitHub project dotnet/io. This uses Nuget packages from that project rather than direct dependencies.

DNETCoreGPIO

A .NET Core app to run on the RPi. Works with both Raspian and Win10 IoT-Core unchanged. Exemplifies System.Devices.GPIO and Iot.Device.Bindings Nuget packages. Provided as Visual Studio 2019 project.

This is based upon the GitHUb Repository: dotnet/iot
Whereas the samples therein (from which this is taken, and extended) use library sources in that repository, this uses the associated Nuget packages.

Code includes:

  1. Led and Button press <– Works
  2. Temperature with BMP180 sensor …Waiting on supply of BME280
  3. Temperature and Humidity with DHTxx sensor
  4. Temperature and Humidity with DHT22 sensor using 1-Wire <– Works on Raspian, not IOT-Core
  5. LED driven by Software PWM. <– Works
  6. H-Bridge Motor using L293D <– Works (See note below for IoT-Core)>

To run ./DNETCoreGPIO n on Raspian or .\DNETCoreGPIO n in a PowerShell windows on IoT-Core, where n is 1,2 … 6 as above.

Run App

Running Led and Button

Connect LED to GPIO17 and button to GPIO4 and Ground (to the one in between. ie Pins 11 7 and 9 respectively.
DHT22

SW driven LED

As above
DHT22

DHT22

See circuit diagram under Circuits .
Active pin is is GPIO26. I’m using a 10K pullup to that.
Some conversions fail, which output as dots.
DHT22

PS » Be careful with pinnout of the DHT22. I blew 2. As mounted on some versions, the Vcc and Gnd pins are the reverse relative to each other to what is on the actual device ( unmounted).

Motor

Run this from an SSH session or direct on the device (with kb and monitor). Not in Remote PowerShell. Remote PS does not facilitate user input in .Net Core Console app. Eg Console.ReadLine() does not pause it.

A picture says a 100 words: Motor App

Publishing

You need to Publish the app from Visual Studio for linux-arm or win-arm. You can publish to a share of the Pi, or build to a folder on the desktop and then copy or send it across.

  • You can Publish as Framework Independent. See Raspian publish profile (It publishes to a share).Correction .. currently publishes to desktop folder
  • Or Build as Framework dependent. The IoT-Core publish profile publishes to a folder under \bin. You copy iot from there.

NB: You could though build and deploy from VS Code.

ToDos

  • Get DTE280 running
  • Test Motor code
  • Do an IoT Hub version
    • Send temperature and pressure to cloud). Available: See https://github.com/djaus2/az-iothub-ps Look for the app quickstarts\telemetry\telemetry\simulated-device_on_RPi there.
    • Take button presses from service app via IoTHub

 TopicSubtopic
  Next: > Now for some HW on the RPi
<  Prev:   .NET Core on IoT
This Category:.NET Core on IoT
  Next: > Now for some HW on the RPi IoT Hub Telemetry App that sends real data 
<  Prev:   .NET Core on IoT