For the purposes of this chapter, you will need the following:
- A Raspberry Pi 2 or 3 (you'll need three in total, throughout the book)
- A micro SD memory card (16 GB or greater) for each Raspberry Pi
- A shielded box, to avoid electrostatic damage to your device
- A laptop or PC running Windows 10, where you can insert the memory card
- An Ethernet network cable, if you use Raspberry Pi 2 or lack Wi-Fi
- An internet connection
The Raspberry Pi 2 or 3 will allow us to run .NET applications and control peripherals using digital input and output easily. It's also a great platform for creating connected distributed services. One of its weaknesses, however, is its lack of simple out-of-the-box analog interfaces. To do analog input and output, you must connect additional chips or equipment using either synchronous or asynchronous serial communication interfaces that converts analog signals to digital ones. To simplify this task, you can also use an Arduino board that you connect to the Raspberry Pi via USB. This has the added benefit of allowing you to use a wide range of standard Arduino peripherals and devices in your Raspberry Pi projects. So, you need to add to your list:
- Arduino shield for Raspberry Pi B+/2B/3B
- Short serial USB cable to connect the Arduino board to the Raspberry Pi
- Analog Arduino-compatible light sensor
- Digital motion detection PIR sensor
- Digital relay module
Most of the above equipment (and more) can be obtained in so-called Starter Kits. Such starter kits make for great fun, since they often include a wide variety of sensors and actuators for you to play with. For examples, refer to https://www.dfrobot.com/category-173.html.
You can use the Arduino Uno board as well. The advantage of the Arduino shield for Raspberry Pi is that it mounts easier on top of the Raspberry Pi.
Installing Windows 10 on a Raspberry Pi is both free and very easy. Microsoft has developed a tool for this purpose: the IoT Dashboard. Apart from allowing you to download and install Windows 10 on your devices, it also helps you manage your devices in the network. It's a very handy tool, and does not require you to learn any command-line syntax:
Download and install the IoT Dashboard from the following link: https://developer.microsoft.com/en-us/windows/iot/docs/iotdashboard
The IoT Dashboard is a Windows 10 app. Once running, you can choose to right-click on its icon and select
Pin to taskbar, so that you can find it easier later.
If you don't want to use Windows 10, and want to use Linux instead, you can do so with the following modifications:
- You can use the Raspbian operating system instead. It's based on Debian. Follow the following instructions on how to download and install it: https://www.raspberrypi.org/documentation/installation/installing-images/.
- Instead of compiling your project as a
.NET Coreapplication, compile it as a standard
.NET Frameworkapplication instead.
- Run the application using
Mono. You can follow the following instructions on how to accomplish this: http://www.raspberry-sharp.org/eric-bezine/2012/10/mono-framework/installing-mono-raspberry-pi/.
You can run .NET Core on Linux as well. For more information, see: https://github.com/dotnet/core/blob/master/samples/RaspberryPiInstructions.md
Set up a new devicein the left-hand menu. This will open a simple form. Select your device (
Raspberry Pi 2 & 3) and the OS you want to download and install (
Windows 10 IoT Core).
- Also, insert the memory card into the computer and select the
Driveletter it is assigned to. Other relevant information you need to provide include the
Device nameand an
Setting up a new device
- If you have access to Wi-Fi (
2.4 GHz), and are programming a device with access to Wi-Fi, make sure the correct
Wi-Fi Network Connectionis also assigned:
Configuring Wi-Fi connectivity
- Finally, accept the license agreement, and press the
Download and installbutton:
Installing Windows 10
You need to confirm you really want to format the memory card, and install Windows 10 on it. All previous data on the card will be lost. The IoT Dashboard then goes on to download the operating system and preparing the memory chip for you, including configuring the device, according to the settings you provided. This process includes performing some command-line tasks, so you will see a terminal window appear temporarily.