Skip to content

MakerDen/Maker-Den-Mono-on-Raspberry-Pi

Repository files navigation

IoT-Maker-Den-Mono-.NET-on-Raspberry-Pi2

IoT Maker Den migrated and implemented on Mono .NET on Raspberry Pi 2

Documentation in progress

Please refer to the IoT Maker Den on .NET Micro Framework on Netduino documentaion

Running Maker Den on Raspberry Pi

This project can run with or without the configured prototype shield. See the code examples below for running barebones or with a fully configured Maker Den prototype shield.

#Setting up Mono on Raspberry Pi

More to come, but for now refer to this excellent article of setting up Mono on your Raspberry Pi.Getting started with the Raspberry Pi 2, for .NET developers

What is the Internet of Things Solution Accelerator?

The Internet of Things Solution Accelerator for the .NET Micro Framework provides a pluggable foundation to support sensors, actuators, data serialisation, communications, and command and control.

Alt text

Extensible/pluggable framework supporting

  1. Sensors
  • Physical: Light, Sound, Temperature, CPU Temperature
  • Virtual: Memory Usage, Diagnostics
  • Sensor data serialised to a JSON schema
  1. Actuators
  • LED, Relay
  • Adafruit Mini 0.8" 8x8 LED Matrix
    • Low and high level pixel frame transformation primitives
    • alphanumeric character and symbol drawing and scrolling capability
  1. Command and Control
  • Control relays, send messages to a Adafruit Mini 8x8 Matrix etc via the communications layer
  1. Communications
  • Pluggable – currently implemented on MQTT (Mosquitto MQTT Server running on Azure)
  1. Supported and Tested

IoT Dashboard

The IoT Dashboard allows you to visualise the data streamed to Azure.

IoT Dashboard

You can install the IoT Dashboard from here. Note, you will need to allow to run from unknown publisher.

#Prototype Board Layout

##Wiring and Component Layout

Wiring and Components

Complete Board

Click the image to see Maker Den on Raspberry Pi in Action. The Raspberry Pi 2 on the right, Netduino 2 Plus on the left.

Complete with components

Watch Maker Den on Raspberry Pi in action on YouTube

Parts List

All parts are generally available worldwide. This is a peliminary parts list with links to sites where I purchased the parts for the Maker Den on Mono (.NET) on Raspberry Pi 2 (also supports Raspberry Pi B+). The links are for your reference only and in no way are these sites affiliated with Microsoft.

  1. Raspberry Pi 2
  2. MCP3002-I/P, 10 bit ADC Differential - 2 x ADC Channels
  3. MCP9701A-E/TO, 8 bit Analogue Temperature Sensor
  4. Light Dependent Resistor
  5. Prototyping Shield for Raspberry Pi Model B+
  6. Breadboard Mini Self-Adhesive
  7. Rubber Feet - Small Stick On - Pk.4 (or a case)
  8. Adafruit Mini 0.8" 8x8 LED Matrix
  9. 1 x 22k ohm resistor for Light Dependent Resistor
  10. 1 x 200 ohm resistor for the LED

Optional

  1. Electret Microphone Breakout Board

Programming Models

Declarative Event Driven Model

Raspbery Pi Barebones without the Maker Den Prototype Board

Connect Ethernet port to router/internet.

This example does the following

  1. Start network services and posts sensor data via MQTT to IoT Dashboard

  2. Loads Sys for remote shutdown and reboot via MQTT,

  3. Reports CPU Temperature,

  4. Reports .NET Working set memory.

     using Glovebox.Adafruit.Mini8x8Matrix;
     using Glovebox.RaspberryPi.IO.Actuators;
     using Glovebox.RaspberryPi.IO.Sensors;
     using Raspberry.IO.GeneralPurpose;
     using System.Threading;
    
     namespace MakerDenMono {
     	class MainClass : MakerBaseIoT {
     		public static void Main(string[] args) {
    
     			InitializeDrivers();
    
     			StartNetworkServices("mono", true);
    
     			using (Sys sys = new Sys("rpi"))
     			using (SensorCPUTemp cpuTemp = new SensorCPUTemp(10000, "cpu01"))
     			using (SensorMemory mem = new SensorMemory(2000, "mem01")) {
    
     				cpuTemp.OnBeforeMeasurement += OnBeforeMeasure;
     				cpuTemp.OnAfterMeasurement += OnMeasureCompleted;
    
     				mem.OnBeforeMeasurement += OnBeforeMeasure;
     				mem.OnAfterMeasurement += OnMeasureCompleted;
    
     				Thread.Sleep(Timeout.Infinite);
     			}
     		}
     	}
     }
    

Raspberry Pi with Maker Den Configured Prototype Board

Connect Ethernet port to router/internet.

This example does the following

  1. Start network services and posts sensor data via MQTT to IoT Dashboard

  2. Loads Sys for remote shutdown and reboot via MQTT,

  3. Reports CPU Temperature,

  4. Reports .NET Working set memory.

  5. Blinks LED for every sensor measurement

  6. Relay support with remote on/off via MQTT

  7. Adafruit Mini LED 8x8 Matrix running test pattern

  8. LDR based light level sensor

  9. Temperature sensor

     using Glovebox.Adafruit.Mini8x8Matrix;
     using Glovebox.RaspberryPi.IO.Actuators;
     using Glovebox.RaspberryPi.IO.Sensors;
     using Raspberry.IO.GeneralPurpose;
     using System.Threading;
    
     namespace MakerDenMono {
         class MainClass : MakerBaseIoT {
             public static void Main(string[] args) {
    
                 InitializeDrivers();
    
                 StartNetworkServices("mono", true);
    
                 using (Sys sys = new Sys("system"))
                 using (SensorCPUTemp cpuTemp = new SensorCPUTemp(10000, "cpu01"))
                 using (SensorMemory mem = new SensorMemory(2000, "mem01"))
                 using (led = new LedDigital(gpioDriver, ProcessorPin.Pin13, "led01"))
                 using (Relay relay = new Relay(gpioDriver, ProcessorPin.Pin06, "relay01"))
                 using (AdaFruitMatrixRun matrix = new AdaFruitMatrixRun(i2cDriver.Connect(0x70), "matrix01"))
                 using (SensorLight light = new SensorLight(spiConnection, 1000, "light01"))
                 using (SensorMcp9701a tempMcp9701a = new SensorMcp9701a(spiConnection, 15000, "temp02")) {
    
                     cpuTemp.OnBeforeMeasurement += OnBeforeMeasure;
                     cpuTemp.OnAfterMeasurement += OnMeasureCompleted;
    
                     mem.OnBeforeMeasurement += OnBeforeMeasure;
                     mem.OnAfterMeasurement += OnMeasureCompleted;
    
                     light.OnBeforeMeasurement += OnBeforeMeasure;
                     light.OnAfterMeasurement += OnMeasureCompleted;
    
                     tempMcp9701a.OnBeforeMeasurement += OnBeforeMeasure;
                     tempMcp9701a.OnAfterMeasurement += OnMeasureCompleted;
    
                     Thread.Sleep(Timeout.Infinite);
                 }
             }
         }
     }
    

About

IoT Maker Den migrated and implemented on Mono .NET on Raspberry Pi 2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages