C# on Raspberry Pi

Getting Ready

For Linux distributions, you can use either Raspbian or Ubuntu Mate.

Please follow Raspberry Pi Software Guide on Raspberry Pi official web site to install Raspbian or Ubuntu Mate on your Raspberry Pi. Note however, at this time, Ubuntu Mate (version 16.04.2) does not boot on Raspberry Pi 3B+.

Most samples on this web site are developed on Raspbian. Major differences in Ubuntu Mate will be mentioned where applicable.

Update Software Packages

After booting up your Raspberry Pi, you will need to update the software packages to the latest version.

For those who are new to Linux, the Terminal is where you enter Linux commands. You can launch Terminal by clicking on the icon on the task bar on top of the screen. (For Ubuntu Mate, open menu Applications | System Tools | MATE Terminal.)

This is the Terminal screen where you can enter commands:

Launch Terminal session and run the following commands to update software packages to the latest version:

sudo apt update
sudo apt dist-upgrade

The second command may take a while to finish, sometimes more than 30 minutes. It depends on how many packages need to be updated.

raspi-config

Update raspi-config

Since we are at updating software, might as well update rasp-config. rasp-config is a program that helps configure Raspberry Pi. With Raspbian, some of the options can be configured from menu option Preferences | Raspberry Pi Configuration.

At Terminal, enter command sudo raspi-config.

With the keyboard, move cursor to highlight Update. Then hit Enter key to update.

Later, raspi-config will be used to configure software and hardware components.

Expand File System

One of the functions provided by raspi-config, is to expand the file system on Micro SD card. You can find the function under Advanced Options. If you use Micro SD card with large capacity, you may consider expand the file system now.

VNC

Now is a good time to enable VNC, if you need it. VNC allows you to control your Raspberry Pi from a remote client in full screen mode, e.g. Windows. It is possible to connect to more than one Raspberry Pi at the same time from one remote computer. Source codes and objects can be copy-paste between client (e.g. Windows) and server (Raspberry Pi).

Raspbian has included VNC in the installation. To use it, all you need to do is to enable it. From Desktop open menu Preferences | Raspberry Pi Configuration:

On Raspberry Pi Configuration screen, click Interfaces tab. Then select Enable for VNC:

And, that’s it. You are ready to control your Raspberry Pi remotely. When you attempt to connect, you will need user name/password, which by default is pi/raspberry. You will also need the IP Address of the Raspberry Pi. You can obtain the information by simply hovering your mouse cursor over the up-down arraws icon on the task bar:

Here you can see the IP Address is “192.168.0.39”.

Alternatively, you can get the IP Address by clicking the VNC icon. The screen shows more details on the VNC connection: (The VNC icon is visible after VNC has been enabled.)

Ubuntu Mate Only

For Ubuntu Mate, you need to install one of the VNC server packages. I will show you steps to install and activate vino. (Some say that vino is installed with Unbuntu Mate. Somehow, I couldn’t find it.)

Open up Terminal and enter command sudo apt install vino to install vino. Then, enter command vino-preferences to configure. On the configuration screen:

  • Enable Allow other users to view your desktop.
  • Enable Allow other users to control your desktop.
  • Under Security, uncheck everything.

Next, return to the desktop. Open the menu item Applications | System Tools | dconf Editor. On the left side of the screen, expand the options org | gnome | desktop | remote-access.

Note: You won’t see remote-access until one of the VNC packages is installed. Depending on the package you install, the configuration options may be different.

The options that need your attention are:

  • Leave blank for network-interface.
  • Uncheck require encryption. (You can leave this checked, if you are sure the client software accepts the encryption.)
  • Put blank in vnc-password.

That’s all about installation and configuration.

Now you can start VNC by entering command /usr/lib/vino/vino-server --sm-client-disable. Usually, you would want to run this command at system startup. To do so, open the menu item System | Control Center. Then click Startup Applications in Personal group. Enter /usr/lib/vino/vino-server in the Command field. Enter your choice for Name and Comment fields. Restart the system, you should see the VNC icon on top of the desktop.

Security

If security is a concern, you will need to tighten the security by changing the configuration options.

VNC Client

On the client side, I use VNC Viewer which can be found at realvnc.com.

Screen Resolution

If Raspberry Pi is connected through VNC without a monitor. You may need to adjust the screen resolution.

To adjust screen resolution, open Terminal. Enter command sudo raspi-config. Select option Advanced Options | Resolution. Select the resolution to use. Hit Ok. You will need to reboot the system.

Where Are We?

Now we have a Raspberry Pi with either Raspbian or Ubuntu Mate installed. The system is up-to-date, and ready to install mono and other software. Right, we have not even started on mono yet. But, if you are at his point, it’s a good start.

Continue reading, mono will be coming next.

Leave a Reply