Raspberry Pi 4

The Raspberry Pi 4 is a single-board computer developed by the Raspberry Pi Foundation. The Raspberry Pi 4 includes a high-performance 64-bit quad-core processor, dual-display support with up to 4K resolution, up to 4GB of RAM, 40-pin GPIO headers, and connectivity support with dual-band 2.4/5.0 GHz wireless LAN, Bluetooth Low Energy, Gigabit Ethernet, two USB 3.0 ports and two USB 2.0 ports.

The Raspberry Pi 4 is a unique platform to work on Atmosphere compared to other supported hardware as it’s a Linux computer and not a single-purpose development board, so it runs an Atmosphere project alongside other applications as opposed to being the sole the firmware running on the device. Atmosphere projects installed on the Raspberry Pi 4 run as a system service, and will start on boot alongside other system services. Likewise, they execute and can be stopped in the same manner as other applications.

Users are expected to have a moderate understanding of working with a Raspbery Pi and embedded Linux systems prior to use with Atmosphere.

Project Specifics

Raspberry Pi 4 projects start with the following sensor elements imported from the Element Library:

RaspberryPi4CPUTemperatureElement icon for the element library

Raspberry Pi CPU Temp

Hardware Specifics

Some devices may have limitations or design restrictions that cause unexpected behavior when used with Atmosphere. Specific information and details pertaining to the Raspberry Pi 4 and its performance on Atmosphere is noted below.

Hardware Version Compatibility

The project type for the Raspberry Pi 4 is specifically for the Raspberry Pi 4 (model B). Earlier generations of the computer are currently not supported in Atmosphere, and aren’t compatible with this project type.

Connectivity Layer in Atmosphere Projects

Unlike most hardware supported in Atmosphere, projects created for the Raspberry Pi 4 don’t require a connectivity aspect built into them in order to communicate with Atmosphere. Instead, the application generated from Atmosphere that runs on the Raspberry Pi 4 uses the native connectivity running on the Raspberry Pi 4 – such as Ethernet or Wi-Fi – to send data to the cloud.

Additional information on connecting the Raspberry Pi 4 can be found in the sections below.

Default Pin Mapping

Atmosphere configures each peripheral to a default pin for every supported device, based on ideal pairing of pins and their usage. The default pin configuration is set for convenience and enables each peripheral to work naturally without needing to be modified.

Raspberry Pi 4 projects start with the following pin configuration:

Pin Description Notes
P3 Header Pin 3  
P5 Header Pin 5  
P7 Header Pin 7  
P8 Header Pin 8  
P10 Header Pin 10  
P11 Header Pin 11  
P12 Header Pin 12  
P13 Header Pin 13  
P15 Header Pin 15  
P16 Header Pin 16  
P18 Header Pin 18  
P19 Header Pin 19  
P21 Header Pin 21  
P22 Header Pin 22  
P23 Header Pin 23  
P24 Header Pin 24  
P26 Header Pin 25  
P27 Header Pin 27  
P28 Header Pin 28  
P29 Header Pin 29  
P31 Header Pin 31  
P32 Header Pin 32  
P33 Header Pin 33  
P35 Header Pin 35  
P36 Header Pin 36  
P37 Header Pin 37  
P38 Header Pin 38  
P40 Header Pin 40  

The default pin for any peripheral can be changed within an element's properties, from an element that references that particular peripheral.

Peripherals

Below is information regarding the Raspberry Pi 4’s exposed peripherals.

I2C

In order to use I2C, ensure that I2C is enabled via raspi-config. I2C can be accessed via P3(SDA) and P5(SCL).

Programming Method

Programming an Atmosphere project onto a Raspberry Pi 4 involves putting a project’s app image file onto it and running the file as an executable application.

Setup Configuration

Prior to putting an app image onto a Raspberry Pi 4, ensure you have the following setup configuration:

  • The project has been compiled in Atmosphere.
  • The Raspberry Pi 4 is powered on.
  • An Internet connection is maintained.
  • You have a method for putting the app image onto the Raspberry Pi 4, either while directly on the computer itself or through remote access.

Programming Instructions

With setup complete, you can program the Raspberry Pi 4:

  1. From Atmosphere Studio’s Embedded tab, click the Program Firmware button from the tab’s toolbar. This downloads an Atmosphere_Project.AppImage file containing the project’s compiled firmware.
  2. Put the app image onto the Raspberry Pi 4. This process may vary based on how you’re running the computer.
    • If running the Raspberry Pi 4 with a standard desktop setup (display, keyboard, mouse, etc.), the app image can be downloaded into the Downloads folder and run from there.
    • If running in headless mode, use the remote access method (SSH, VNC, etc.) and associated software of your choice to put the app image onto the Raspberry Pi 4.

Once the download/transfer is complete, the Raspberry Pi 4 has the project app image on it, but can’t yet be run. Steps to run the application are included below as part of registering the Raspberry Pi 4.

Registering to Atmosphere

Connecting a Raspberry Pi 4 to Atmosphere involves generating an API token in Atmosphere, and providing that token in a terminal when an application attempts to execute. Once the token is provided, the Raspberry Pi 4 will register to Atmosphere automatically as long as the Internet connection is maintained.

To run an Atmosphere application and register the Raspberry Pi 4:

  1. While in Atmosphere open the account menu from the navigation bar and click Security.
  2. In the Security section’s Authentication Tokens area, click the Generate Token button to make a new API token. This will be the token you use to provide the Raspberry Pi with the credentials to connect to Atmosphere. Raspberry Pi API Token

Once you’ve created an API token, it then has to be provided once you run the app image.

  1. The app image file needs to updated to be executable. Open the terminal of your choice, and within the location of the file, run chmod +x Atmosphere_Project.AppImage to update the file to be executed as an application.
  2. From the terminal, run the application file as root.
    • Atmosphere applications install and run on the Raspberry Pi 4 as a system service. Because system services are run as the root user, the file will return an error if it’s not run as such.
  3. When the file attemptes to execute, you’ll be prompted to enter an API key. This is the API token you generated earlier. Enter the key and submit.

Once the API token is entered, the application executes and initiates communication with Atmosphere and the Raspberry Pi 4 registers itself as a device. The application then installs itself as a system service on the Raspberry Pi. If the Raspberry Pi is powered off and on again, the application will run on boot with other system services; the above steps only need to be completed once in order to run the application and register the Raspberry Pi.

The complete registration process should resemble the following command line output:

pi@raspberrypi:~ $ chmod +x Atmosphere_Project.AppImage
pi@raspberrypi:~ $ sudo ./Atmosphere_Project.AppImage
== Atmosphere IoT Raspberry Pi Setup ==

Please enter your API Key:
1ab234c5-6d78-1234-abc1-d23456ef78a9
Registering Project Atmosphere Demo to https://platform.atmosphereiot.com...
Registration Successful...
Stopping Atmosphere System Service...
Installing Atmosphere_Project.bin to /usr/bin...
Installing Atmosphere System Service...
Created symlink /etc/systemd/system/multi-user.target.wants/atmosphere.service → /etc/systemd/system/atmosphere.service.

Guides and Tutorials

Get started using the Raspberry Pi 4 with Atmosphere by walking through the following guides:

Raspberry Pi 4 Guides
Getting Started with Raspberry Pi 4

Demo Projects

Atmosphere includes the following Raspberry Pi 4 demo projects for users of all levels. Check them out by clicking the demo’s name to open the project in Atmosphere.

Name Description
Raspberry Pi CPU Temperature Demo Demonstrates using the Raspberry Pi 4 on Atmosphere with a simple project that reads the computer’s CPU temperature and sends the data to the cloud.

Videos

The Atmosphere video library contains the following videos on the Raspberry Pi 4:

Getting started video coming soon!

Resources

The following additional resources and downloadable files are available for the Raspberry Pi 4: