Summer project – PowerShell IoT – pt 2. Installation and prereqs.

Disclaimer: This is just what I did. some of this might actually be unneccesary, irrelevant or just plain weird. If so, let me know, and Ill try and update next time I install Raspbian.

So, to get everything we need up and running,
This is what i ended up with doing.

Download Raspbian and install in using etcher.
A simple guide for this can be found here.

Insert the sd card in the Pi, and boot it up.

After initial setup, start bash (console),  and do the following

  • Expand disk to use all free space on sd card using the following command
sudo raspi-config --expand-rootfs
  • Configure network to use WLAN. This is espacialy needed if you, like me, have a hidden SSID which is not supported in the gui configuration.
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf 

I found a guide here of how to configure it, and my conf file ended up looking like this

network={
        ssid="insert_your_hidden_SSID_here"
        scan_ssid=1
        psk="insert_your_wifi_password_here"
        key_mgmt=WPA-PSK
}

And after doing this, I did a reboot to get connected to my network.

sudo reboot
  • Next step, Install prereqs for PowerShell and PowerShell IoT.
    According to the PowerShell install instructions, we need libunwind8.
    It seems to be some kind of prereq for CoreCLR 2.0 to work properly as it can generate really weird errors if it is missing.
sudo apt-get install libunwind8
  • Install Powershell. Download the latest build from here
    the file you get is a gziped file, that you can install using the following command.
mkdir ~/powershell
tar -xvf ./Downloads/powershell-6.0.2-linux-arm32.tar.gz -C ~/powershell/

This will install powershell in the ~/powershell folder. Feel free to use any folder you like.

  • Install Mono framework. PowerShell-IoT is based on the unosquare raspberryio framework, and that in turn requires a Mono version greater than 4.6 installed. The following commands will upgrade your installed packages, and install mono for you.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mono-complete
sudo apt-get install dirmngr
# Verify mono version -gt 4.6
mono --version
  • Finaly we install the unosquare raspberyio framework that PowerShell-IoT is based on using nuget. First off, make sure we have nuget installed.
sudo apt-get install nuget
  • Because the nuget version distributed is old, you will get a really weird error when trying to install stuff. Update Nuget exacutable by running the following command.
sudo nuget update -self
  • And finally, we can install raspberryio.
nuget install Unosquare.Raspberry.IO
  • It’s time to enter the world of powershell. Start Powershell using the following command.
sudo WIRINGPI_CODES=1 ~/powershell/pwsh

What is this WIRINGPI_CODES? you ask. a well structured and good explanation can be found on the PowerShell IoT Github page.

Photo from terminal on Raspbian. I have no idea how to do screenshots on Linux. And I know i didnt use the wiringpi variable. Bad Bjompen.

In the next chapter we will finally start to look in to some code and the first project: lighting a Led. ’til then, stay cool in the heatwave.