Gravio Blog
October 6, 2021

[Tutorial] Installing Ubuntu 20.04 LTS on a Raspberry Pi 4 for IoT (including Wifi)

How to install Ubuntu on a Raspberry Pi 4 for IoT, including Wifi
[Tutorial] Installing Ubuntu 20.04 LTS on a Raspberry Pi 4 for IoT (including Wifi)

This is a generic tutorial on how to install Ubuntu 20.04 LTS on a Raspberry Pi 4 including hooking it up to Wifi.

To give some context: the reason we are setting updevice is to run Gravio on it. The vision of Gravio is to become an “Operating System for the Physical Space” by enabling everybody to create applications without any programming or software engineering knowledge.

 

Installing Ubuntu 20.04 LTS 64 bit on Raspberry Pi 4 (including setting up WiFi)

 

In order to get Gravio on the Raspberry Pi 4, we need to start with installing the 64 bit Ubuntu. Please note that Gravio will not run on a 32 Bit Linux, Raspbian or a Raspberry 3:

  1. Download the latest ARM 64 bit image from https://ubuntu.com/download/iot
  2. Write the downloaded image on an SD card (preferably a 32gb or less FAT32 formatted, fast speed) using, for example, the Balena Etcher which is available for Mac and Windows
  3. Put the flashed SD card into the Raspberry Pi and connect a monitor and keyboard. Note, the Raspberry Pi 4 has 2 HDMI ports.
  4. Power-on the Raspberry 4 and wait for it to boot. This process can take a long time, up to 10 minutes.
  5. Log in with username ubuntu and password ubuntu and change the latter to something you can remember
  6. Next you need to connect your RPI to a wifi network using netplan :
    There is an example file available under /usr/share/doc/netplan/examples/wireless.yaml
    You probably want to enable the DHCP configuration and remove the static parts. Just copy the example to the /etc/netplan/ directory and edit it, so it may look similar to this:

7. Run sudo netplan try and accept the configuration

8. You should now be connected to the internet

 

Bonus:

  • Install net-tools by entering the command sudo apt install net-tools (you may have to reboot before doing so). This allows you to find out the IP address using the command ip -a or ifconfig so you can log in from another computer using SSH.

 

Raspberry Pi 4 and Gravio Dongle/Aqara Sensors

Installing Gravio HubKit on the Raspberry Pi4

Now, that you’re up and running with Ubuntu 20.04 LTS, it’s time to install Gravio:

  1. Log into your Raspberry Pi and download the latest arm64 bit Gravio HubKit deb file:
    wget https://download.gravio.com/release/raspberry/gravio_arm64.deb
  2. Ensure your dpkg packages are up to date:
    sudo apt-get update
    sudo apt-get upgrade
  3. Install Gravio: sudo apt install ./gravio_arm64.deb

Now, reboot your Raspberry Pi and once it’s back, you will be able to connect to it using Gravio Studio.

 

Installing Gravio Studio on your PC/Mac and Creating a Gravio Account

 

Gravio Studio is a free desktop app that is needed to configure the platform and put your IoT applications together. You can also subscribe to the sensor rental plan inside those apps if you like to rent hardware sensors.

After you have downloaded the application and started it, you will see a registration screen:


 

Sign up with your details and you will receive an e-mail with a code:



 

Now click on the + sign on the top right to add your Raspberry Edge node:


 


 

Now you can start configuring your node and build your applications.

 

Ordering Sensors

 

If you like to order sensors, you need a subscription. Please check availability in your country before you order sensors.

The sensors are rented on a monthly basis. You can stop the subscription at any time, in which case you will have to send the sensors back.


Upgrading to order sensors

 

Choose your subscription and follow your Operating System’s instructions on how to subscribe: 

Once you are subscribed, you can visit https://www.gravio.com and use the login button at the top right to log in and visit the ordering page:



 

Once ordered, Asteria will ship the sensors and the USB dongle to you, ready to connect.

For more information, have a look at https://doc.gravio.com or join the Gravio Slack Channel

 

Note: If you have a RPI4 with 4GB ram, you may run into the issue of the USB ports not working. To fix this, access your SD card on your computer and add the line

total_mem=3072

to the file

/boot/firmware/usercfg.txt

It will limit the memory usage to 3GB but at least USB will work. This is supposed to be a temporary fix until Ubuntu fixes the kernel.


Latest Posts
[Tutorial] Using Eniscope, an Energy Monitoring Device and Gravio to Measure and Log your Energy Consumption with MQTT.
Tutorial on how to use Gravio, MQTT, and Eniscope to build a simple Energy reporting and logging system without coding. Connect data points to Line for notifications and writing to a CSV file for logging.
Thursday, November 14, 2024
Read More