How to Turn Your Raspberry Pi 4 into an Edge Gateway

Raspberry Pi 4 Edge Gateway

If you’re going to transmit large amounts of data to the cloud, you can improve performance and response times by using your Raspberry Pi as an edge gateway. EdgeX Foundry is a platform that you can use to build custom Internet of Things (IoT) solutions, by consuming and processing data from the various smart devices and sensors on your home automation network.

In this article you’ll learn how to record your data more efficiently by transforming your Raspberry Pi 4 into a connection point between the cloud and any sensors, smart devices and controllers on your network.

Logging your data in the cloud can help you identify trends: for example, using your smart scale to record your daily weigh-ins or your smart exercise bike to record the number of miles you’ve cycled. When you’re transmitting large amounts of data to the cloud, you can often reduce response times and network transmission costs by pre-processing that data locally.

What you’ll need

To complete this tutorial, you’ll need:

  • Raspberry Pi 4
  • SD card
  • Laptop or computer where you’ll download the Ubuntu system image
  • Power cable that’s compatible with your Raspberry Pi
  • Ethernet cable
  • Micro HDMI cable
  • External monitor
  • External keyboard and a way to attach it to your Raspberry PI
  • A mouse is optional or use the trackpad on your external keyboard

Flash Ubuntu to your Raspberry Pi

To transform your Raspberry Pi into an Edge Gateway, you’ll need Ubuntu 19.10. Later versions of Ubuntu will likely also support EdgeX Foundry, but the process of setting up your Raspberry Pi as an Edge Gateway may differ.

In this tutorial, we’ll flash the Ubuntu system image using the free balenaEtcher application.

  1. Head to the Ubuntu website and download the 64-bit version of Ubuntu 19.10 for Raspberry Pi 4.
  2. Insert the SD card into the laptop or computer.
  3. Launch the Etcher app.
  4. In Etcher, click “Select image,” and then choose the Ubuntu file that was just downloaded.
  5. Click “Select target,” and then choose the target boot medium, which in this instance is the SD card.
Write Ubuntu to your SD card, using the free Etcher app.

Etcher will now flash the system image to the SD card.

Boot your Raspberry Pi into Ubuntu

We’re now ready to boot the Raspberry Pi:

  1. Remove the SD card from the laptop or computer and insert it into the Raspberry Pi.
  2. Attach the monitor to the Raspberry Pi using the micro HDMI cable.
  3. Attach the keyboard to the Raspberry Pi device.
  4. Attach an ethernet cable to the Raspberry Pi.
  5. Plug the Raspberry Pi into a power source. The device should now boot automatically.
  6. When Ubuntu is launched for the first time, there will be a prompt to enter a username and password. The default username for Ubuntu 19.10 is “ubuntu,” and the password is also “ubuntu.”
  7. When prompted, create a new password.

There will now be access to a Terminal to enter all of the commands needed to provision the Raspberry Pi as an Edge Gateway.

Installing EdgeX Foundry

To install the EdgeX Foundry platform, run the following command in the Terminal:

sudo snap install edgexfoundry

Ubuntu will now download the EdgeX Foundry snap, which contains all the services required to run EdgeX, including EdgeX core, security and support reference services, plus Consul, Kong, MongoDB, and Vault.

All of the EdgeX work can be performed in a web user interface (UI). To download this UI, enter the following command in the Terminal:

sudo snap install edgex-ui-go --channel=latest/beta

Once the download has finished, launch the web browser and enter the following URL: http://((your-raspberry-pir-url):4000/

For example, my Raspberry Pi’s IP address is, so this gives me the following URL:

If the IP address of the Raspberry Pi is unknown, then retrieve it using the following Terminal command:

hostname -I

Once this URL has loaded, you’ll be taken to the EdgeX Foundry Console.

Add Raspberry Pi as an Edge Gateway

Log into the console using the default username and password, which are both “admin.”

Log into the EdgeX Foundry Console, using the default username and password.

To provision the Raspberry Pi as an Edge Gateway:

  1. In the Console’s menu on the left, select “Gateway.”
  2. Create a new gateway by clicking “Add.”
  3. Give your Gateway a name and a description.
  4. Enter the IP address of the Raspberry Pi device.
  5. Click “Submit”

The Raspberry Pi should now appear in the Console, ready to use.

Your Raspberry Pi 4 will now be added as an Edge Gateway.


In this article you learned how to setup a Raspberry Pi 4 as an Edge Gateway.

If you’ve followed along with this tutorial, then we’d love to hear how you’re using Raspberry Pi as a connection point between the cloud and your smart home network, so be sure to share your gateway projects in the comments below!

Jessica Thornsby
Jessica Thornsby

Jessica Thornsby is a technical writer based in Derbyshire, UK. When she isn’t obsessing over all things tech, she enjoys researching her family tree, and spending far too much time with her house rabbits.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox