While it is possible to run Visual Studio Code on a Raspberry Pi or a NVIDIA Jetson, the process previously had a few challenges. With one method, a user could grab the code from Microsoft and compile it for their device. This was time consuming and required that a person perform some steps to be set up for development. An easier method involved acquiring a build from a third party source. The issue there is the user must trust the third party source. Now these are no longer issues because Microsoft provides ARM binaries for Visual Studio Code. The installation can be done on both devices with the same steps.
To install VS code, navigate to VisualStudio.com and click on the Learn More link on the Visual Studio Code box. From there, if you click on Other Platforms you will see all of the downloads that are available for Visual Studio Code. For the Jetson series of hardware you will want to download the ARM64 deb installer. For Raspberry Pi, if you are using the a 64-bit OS installation grab an ARM64 build. Otherwise grab the ARM build.
After the build has downloaded, open a terminal and navigate to the folder where you saved the ARM file. From the terminal type the following command.
sudo dpkg -i name_of_file.deb
An actual file name should replace name_of_file.deb. After a minute or two the installation completes. You can start VS Code from the command line by typing the command code and pressing Enter. You can also find it within your program files. Videos of the installation are available below.
The Raspberry Pi has a few more power options than what one might gather from a quick glance. With the exception of the computer modules (which will get no further mention here) the Pis have a USB port for providing power. The Pi-4 has a USB-C port while the other units use micro-USB. In most cases having a 5-volt power supply with a the appropriate USB interface is sufficient. Using the USB interface, the Pi can be powered through a phone charger. This includes portable chargers, which might be used if the Pi needs to be placed where outlets are not available or if they must be movable. The USB port isn’t the only way to power the Pi though.
Another way of powering the Pi is through the 40-pin connector. There are pins labeled 5V and GND. these pins are often used as a voltage output. But these pins can also be used as a voltage input. Applying appropriate voltage to these pines will power the Pi on. In addition to applying 5-volts directly, there are also Pi-hats made for interfacing to these pins. On the Pi-4 and Pi-3, just behind the Ethernet connector, there are 4 pins. These pins connect to the unused connections in the Ethernet jack. With a Power over Ethernet (PoE) hat, voltage supplied over these pins can be passed through a voltage regulator and then fed into the Pi.
To use this there are a few conditions that must be met. If you are considering this this solution then you will undoubtedly be using the Pi with a wired network connection. You also need a means of injecting power into the network. Some routers have this functionality build in. For routers that do not, there are various forms of PoE power injectors. With this solution a headless Pi only needs one cable for providing a network connection and a the power. Such hats are available in a number of form-factors. My preference is towards the one of the minimalist PoE adapters.
This adapter leaves many of the other pins open. If cooling is needed, the official Raspberry Pi PoE hat also has a fan.
If you have a Pi that doesn’t support PoE, you are not out of luck! You can still take advantage of it with adapters for extracting power from the extra lines and routing it to the USB input on your Pi.
Another way of powering a Pi is with batteries. While it is possible to take consumer batteries (AA or AAA batteries) and power a Pi with those, I would not suggest it. There are options available with higher capacities and other features that are worth considering. In looking at a battery solution not only might you want to consider the battery capacity, but the inclusion of a real time clock and the ability to query the power level of the batteries. The most basic solutions only provided power and a USB port for charging the battery.
Many of the solutions use 18650 batteries. So named because they are 18mm in diameter and 65mm long. These cells look a lot like enlarged AA batteries. Even if you don’t recognize them, you’ve probably encountered these batteries before in laptop computers. Unlike the diminutive consumer batteries of similar shape, these cells rate at having a nominal voltage of 3.7 volts each. With two batteries together they are able to meet and exceed the 5-volt power requirement for the Pi. Power regulation circuits within the battery adapters ensure that the power delivered to the Pi doesn’t exceed 5-volts.
One of my favourite is the Geekworm X728. This unit contains a real-time clock and has scripts available for probing the state of the battery. The unit allows settings for having the pi automatically startup when power is applied and shutting down when when the battery level is low. For increasing the battery capacity, additional pairs of batteries can be added to the X728-A2 . The X728-A2 is made only for connecting to the X728 and add additional batteries. Though if you have the know-how, you can connect additional batteries in parallel to the ones in the X728. The board shows the power level through three LEDS on the side. There’s also a dedicated power-button on the board for powering up and shutting down.
In close second is the PiJuice. Right now the PiJuice is a lot more expensive than the X728 at almost twice the price. But it has an additional feature; the PiJuice allows scripts to be scheduled to run under specific power or time conditions. While the battery included with the PiJuice has lower capacity than a pair of 18650 batteries, there are use cases under which it could have longer usage before requiring a charge. On the PiJuice the Pi can be put to sleep, consuming much less power, and then wake up to perform some work and go back to sleep.
The last battery kit I want to mention is sold under various names. When I ordered one, it was branded under GeekPi. While that specific SKU is no longer available, the same unit is available branded from MakerHawk. It is often described as a UPS (Uninterruptible Power Supply). It is the least expensive of the battery kits, costing less than half the price of either of the other two. But it doesn’t have any way for the pi to detect the battery level or a way to have the Pi react to power events. It only provides power and nothing more. Like the X728, one could connect additional batteries in parallel to increase the available energy.
All of the battery solutions can also function as a UPS; if external power fails your Pi would be able to continue working. I’ve been able to keep the Pis running for hours at a time (days in the case of the Pi Juice on a wake/sleep schedule). I love the overall compactness of the the battery solutions made for the Pi. Some time in the future I plan to present one of the Pi based solutions that I made using the batteries.
Posts may contain products with affiliate links. When you make purchases using these links, we receive a small commission at no extra cost to you. Thank you for your support.
I stumbled upon a thread in the Raspberry Pi forums about enabling networking on the USB-C port on the Raspberry Pi 4. At first glance I thought this would be about networking with a USB-C to Ethernet dongle. It’s not. It is about configuring the Raspberry Pi to present as a network adapter when connected to another device with a USB-C cable. While this might sounds like a rather pedestrian capability at first it is something that has a lot of potential. I see using this when I want to do development on the Pi and I’m in an environment in which a network isn’t available (such as when I’m on a long plane trip) or when there’s a network but I just can’t connect the Pi to it (such as on a corporate network). Additionally since I expect my Android tablet to loose it’s ability to run Linux this provides a portable dev environment in which I can put the capabilities that I need.
The basic steps in what to do can be found on this thread posted by the user thagrol. The steps are simple. I am re-posting the steps here.
Open /boot/config.txt and add the line dtoverlay=dwc2
Open /boot/cmdline.txt and append the following modules-load=dwc2,g_ether
Reboot the Pi
After doing these steps when the Pi is connected to a computer the computer will see it as a networking device. If you list the network adapters on the Pi you will see a new network adapter with the name usb0.
thagrol notes that the mac address generated for both sides of this virtual network adapter will be different every time that the service is started. This can cause issues when using DHCP. He provides a solution in the form of a script that will generate a set of MAC addresses based on a unique identifier in the Raspberry Pi. After cloning the GIT repository for the script run it as root.
sudo ./set_id.py --test
Once the addresses are generated they can be added to /boot/cmdline.txt. The addition will follow this format.
I’m going to set a static IP on my pi. To do this the file /etc/dhcpcd.conf must be edited. Scrolling to the bottom of the file commented out is a demonstration of how to set a static address.
For the USB interface I’e added two lines to the bottom of this file
After rebooting the Pi now shows this address for the USB network interface. I’m connecting to my pi with a Windows machine. After physically connecting the device a static IP address was set on the Windows side.
To ensure that things are working I started off trying to ping the device and received positive responses.
Pinging 10.11.12.14 with 32 bytes of data:
Reply from 10.11.12.14: bytes=32 time<1ms TTL=128
Reply from 10.11.12.14: bytes=32 time<1ms TTL=128
Reply from 10.11.12.14: bytes=32 time<1ms TTL=128
Reply from 10.11.12.14: bytes=32 time<1ms TTL=128
To try something a bit more functional I tried opening a folder on the Pi using Visual Studio Code running from my computer. Success!
In theory this could work with a phone or other mobile device. The restricting factor is whether someone’s mobile device allows changing settings on external network adapters. Many will allow communication over such adapters, but a much smaller set will allow you to change the settings.
Something to note though, when using this solution on a mobile device there is a significant power drain, which makes sense; the mobile device’s battery is now working for two. There are a few ways to mitigate this but they break down to either batteries or external power. For batteries someone could add a battery to the Pi itself. There are a number of solutions that work well. I prefer PiJuice since it comes with some other options on invoking behaviours based power levels or time. Unfortunately at the time that I am writing this (during the 2020 shelter-at-home directive) this specific unit looks to be unavailable.
There are many other Pi batteries available. If you shop for one make sure that you purchase one that provides power through the headers or through pogo pens. Some provide power through the USB-C connector, which you need to keep available to act as a network connection. Also give consideration to the connector used to charge the unit you select. You might prefer micro-USB or USB-C. I would suggest not overclocking your Pi if it is running off of a battery. Some batteries might not be compatible with some types of cases. Ex: there is a Pi case that is essentially a heatsink that wraps the entire device. That would not work with with a power solution that uses pogo pens.
There have been a couple of SBC updates in the past few weeks that I thought were noteworthy.
The first is that there is now a 64-bit version of the Raspberry Pi operating system available. Previously if you wanted to run a 64-bit OS on the Pi your primary option was Ubuntu. Raspbian was 32-bit only. That’s not the case any more. The OS has also been rebranded as “Raspberry Pi OS.” Among other things with the updated OS a process can take advantage of more memory. Speaking of more memory, there is now also an 8 gig version of the Raspberry Pi 4 available for 75.00 USD.
Jetson Xavier NX
Another family of single board computers is seeing an update. The Jetson family of SBCs has a new edition in the form of the Jetson Xavier NX. At first glance the Xavier NX is easily confused with the Jetson Nano. Unlike the Nano the Xavier NX comes with a WiFi card and a plastic base around the carrier board that houses the antenna. The carrier board is one of the variants that supports 2 Raspberry Pi camera connectors. The underside of the board now has a M.2 Key E connector. While it has a similar formfactor as the Jetson Nano a quick glance at the specs show that it is much more powerful.
CUDA Core Count
The Jetson Xavier NX is available now for about 400 USD from several suppliers.
The .NET framework acts as an intermediate execution environment; with the right runtime a .Net executable that was made on one platform can run on another. With .NET Core the focus on the APIs that are supported on a variety of platforms allows it to be supported on even more platforms. Windows, Linux, and macOS are operating systems on which the .NET Core framework will run.
The .NET Core Framework also runs on ARM systems. It can be install on the Raspberry Pi. I’ve successfully installed the .NET CORE framework on the Raspberry Pi 3 and 4. Unfortunately it isn’t supported on the Raspberry Pi Zero; ARM7 is the minimum ARM version supported. The Pi Zero uses an ARM6 processor. Provided you have a supported system you can install the framework in a moderate amount of time. The instructions I use here assume that the Pi is accessed over SSH. To begin you must find the URL to the version of the framework that works on your device.
Visit https://dotnet.microsoft.com to find the downloads. The current version of the .NET Core framework is 3.1. The 3.1 downloads can be found here. For running and compiling applications the installation to use is for the .NET Core SDK. (I’ll visit the ASP.NET Core framework in the future). For the ARM processors there is a 32-bit and 64-bit download. If you are running Raspbian use the 32-bit version even if the target is the 64-bit Raspberry Pi; Raspbian is a 32-bit operating system. Since there is no 64-bit version yet the 32-bit .NET Core SDK installation is necessary. Clicking on the link will take you to a page where it will automatically download. Since I’m doing the installation over SSH I cancel the download and grab the direct download link. Once you have the link SSH into the Raspberry Pi.
You’ll need to download the framework. Using the wget command followed by the URL will result in the file being saved to storage.
After the download is completed it must be unpacked. The file location that I’ve chosen is based on the default location that some .NET Core related tools will look by default for the .NET Core framework. I am using the path /usr/share/dotnet. Create this folder and unpack the framework to this location.
sudo mkdir /usr/share/dotnet
sudo tar zxf dotnet-sdk-3.1.201-linux-arm.tar.gz -C /usr/share/dotnet
As a quick check to make sure it works go into the folder and try to run the executable named “dotnet.”
The utility should print some usage information if the installation was successful. The folder should also be added to the PATH environment variable so that the utility is available regardless of the current folder. Another environment variable named DOTNET_ROOT will also be created to let other utilities know where the framework installation can be found. Open ~/.profiles for editing.
sudo nano ~/.profile
Scroll to the bottom of the file and add the following two lines.
Save the file and reboot. SSH back into the Pi and try running the command dotnet. You should get a response even if you are not in the /usr/share/dotnet folder.
With the framework installed new projects can be created and compiled on the Pi. To test the installation try making and compiling a “Hellow World!” program. Make a new folder in your home directory for the project.
Create a new console project with the dotnet command.
dotnet new console
A few new elements are added to the folder. If you view the file Program.cs the code has default to a hello world program. Compile the program with the dotnet command
After a few moments the compilation completes. The compiled file will be in ~/helloworld/Debug/netcoreapp31. A file name helloworld is in this folder. Type it’s name to see it run.
My interest in the .NET Core framework is on using the Pi as a low powered ASP.NET Web server. In the next post about the .NET Core Framework I’ll setup ASP.NET Core and will host a simple website.
To see my other post related to the Raspberry Pi click here.