Skip to content

Creating the CubeSatSim Raspberry Pi Image

Alan Johnston edited this page Dec 23, 2024 · 12 revisions

These are the exact steps I used to create the Pi image, so you can recreate it if you want:

You will need:

  • Raspberry Pi Zero W or Pi Zero 2
  • micro USB cable to power the Pi Zero
  • micro SD card 16GB or larger as storage for the Pi Zero
  • Computer with micro SD card writer or USB adapter to remotely log into the Pi Zero

First, use the Raspberry Pi Imager to write a Raspberry Pi OS (Legacy, 32-bit) Lite image to your SD card.

Here are the steps:

Raspberry Pi Imager Steps

First, you will need to download and install the Raspberry Pi Imager software onto your computer https://www.raspberrypi.com/software/

You will then insert the micro SD card into the SD card reader on your computer.

Then, run the Pi Imager

image001-2

Under Choose Device select the Raspberry Pi Zero as the computer and for Choose OS choose Raspberry Pi OS (other) and then select Raspberry Pi OS (Legacy, 32-bit) Lite as the operating system. Under Choose Storage select your micro SD card that you inserted. If nothing shows here, check your micro SD card and your reader by unplugging and plugging in again:

image002

When you select Next, you will be prompted about applying custom OS settings. Select Edit Settings.

image003

Under the General tab, set the hostname to cubesatsim or whatever you want it to be. You need to set the username pi and choose a password such as the common raspberry. You will select the WiFi country to US (or your country) and the SSID and password of your WiFi network. Set the local to US/New York and us or your preference.

image004

Select Save then under Services, make sure you enable SSH login with password authentication:

image005

Select Save then select Next, then you will be warned that the data on the SD card will be erased. Select Yes and the write will begin:

image006

After Pi Imager is complete, remove the micro SD card from your computer and insert it in the Pi Zero and power the Pi Zero with a micro USB cable to power it and it will boot up.

Logging into your Raspberry Pi

You can customize your software by logging into the Pi. If you put in the WiFi information in the Pi Imager, the Pi Zero should automatically join the CubeSatSim WiFi network. You will need your computer to also join this WiFi network using the same SSID and password.

After it finished booting up, you will have network connectivity to your Pi Zero. For example, in the Terminal Window or Windows Command Prompt, you can type (if your hostname is cubesatsim)

ssh [email protected]

The first time you log in on your computer, you will be asked Are you sure you want to continue connecting (yes/no/[fingerprint])?. Type yes then return to continue the login. At the password prompt, type raspberry or what you chose then return but note that the characters will not display as you type them.

Alternatively, you can use a free application such as PuTTY on Windows. Download it here https://www.putty.org/ and open it, setting the Host Name to cubesatsima.local and then click Open to connect:

Pi SSH Login

Here is how it looks when you login on Windows using PuTTY after entering the default username pi and password

Pi SSH Login

Software Installation Steps

Once you have used SSH to log into your Pi Zero, you are ready to install the CubeSatSim software.

Verify that your Pi Zero is connected to the Internet by typing:

timeout 10 ping amazon.com

If you see messages such as "64 bytes received" then you are online. If not, check your WiFi hub.

To install the software, type these commands (or cut and paste to avoid typos):

sudo apt-get update && sudo apt-get dist-upgrade -y

sudo apt-get install -y git

git clone http://github.com/alanbjohnston/CubeSatSim.git

cd CubeSatSim

git checkout master

You are now ready to install the software.

./install

You will be prompted for your amateur radio callsign. Check your Wiki to see what to enter. If you don't have one or just hit Return, the default AMSAT will be used. The Callsign is transmitted as a CW ID (Morse code) each time the CubeSatSim software starts up.

You will also be prompted for your latitude and longitude - look it up and enter it for the APRS data packets.

After you enter the information, the installation script will run for quite a while. It will prompt you if you want to modify /boot/config.txt file. Type a y and the script will complete. You will need to reboot. After the reboot, you will have to login again using SSH.

When it reboots, you will need to SSH to log back into your Pi Zero and do the configuration that follows.

Configure Transmit Frequency

The default transmit frequency of the CubeSatSim will be 434.9 MHz. If you want, you can change it to another frequency in the range 420 - 450 MHz by typing the command CubeSatSim/config -F and then input the desired frequency.

Looking at Configuration and Logs

You can see all the settings for your Pi Zero by typing CubeSatSim/config

To see all the commands and options of your Pi Zero by type CubeSatSim/config -h

To see the complete second-by-second log output, which will be very useful later to debug your hardware, type CubeSatSim/log

To see the transmitter log, type CubeSatSim/log -r

Shutting Down your Pi Zero

You have completed the software installation steps. You should not just suddenly remove power from the Pi Zero or the micro SD storage may become corrupted and you would need to redo all these steps. Instead, you can shut it down gracefully by typing a command, or by using the pushbutton when the STEM Payload Board is plugged into the Pi Zero.

To shutdown, type sudo shutdown now and after about 30 seconds, the Pi will have shutdown and you can unplug the power from it.

Other Options to access Pi Zero

If you have an HDMI monitor (and mini HDMI adapter or cable) and a USB keyboard (and micro USB to USB adapter or OTG cable), you can access the console directly.

Wi-Fi login

If you didn't set the WiFi using the Pi Imager but are able to connect a keyboard and HDMI monitor to your Pi Zero, you can configure the WiFi using these steps. First type this command:

sudo raspi-config

Then select System Options by hitting Return, then select Wireless LAN by hitting Return again. Then put your Wi-Fi name in the SSID field then hit Return, then type the Wi-Fi password then Return again. Hit the Tab key twice until Finish is highlighted, then hit Return. You may need to reboot. You can tell if you have Internet by typing:

timeout 10 ping amazon.com

If you see messages such as "64 bytes received" then you are online.

You can now update the Pi Zero software by typing:

cd

CubeSatSim/update

You can also login remotely from your PC if it is on the same Wi-Fi as the Pi Zero. For example, in the Terminal Window or Windows Command Prompt, you can type:

ssh [email protected]

and you should be prompted for the password to login.

Ethernet over USB

If not, you can access your Pi from a computer using just a USB cable. This Ethernet over USB service is known as RNDIS on Windows and USB Gadget on Linux.

On Mac or Linux, you don't need to install any software to use this. On Windows, you need the mDNS discovery program Bonjour. If you already have iTunes installed, you should have it. If not, you can download it from Apple here:

https://support.apple.com/kb/dl999?locale=en_US

Note that it is called Bonjour Printer Services, since that is the most common standalone use for the application. Run the installer and reboot.

On your Pi Zero, connect a micro USB cable to the inner micro USB connector which is labeled "USB", not the one on the edge labeled PWR IN (Power In).

When you connect the other end of the USB cable to your computer, it will power up the Pi and should be accessible by your computer to SSH into.

After it finished booting up, you will have network connectivity to your Pi Zero. For example, in the Terminal Window or Windows Command Prompt, you can type (if you are Group A and your hostname is cubesatsima):

ssh [email protected]

and you can login using the default password raspberry.

Sometimes, this doesn't work on Windows - if you are unable to connect after installing the software, try the steps described here: https://fredricraab.wordpress.com/cubesat-simulators/raspberrypi-zero-windows-10-rndis- driver-problems/

You can set other Localization Options by running sudo rasp-config and selecting as Locale (unchecked en.GB and checked en.US.UTF-8 UTF-8 and C.UTF-8), Timezone (US Eastern), Keyboard (Generic 101-key PC, Other, English (US), English (US), default, no compose), and WiFi Country (set to US - if you don't do this, WiFi won't work on 3B or 4B)

You can edit the Message of the Day file sudo vi /etc/motd Added these lines to it:

This Raspberry Pi image has the CubeSatSim v2.x software installed

and runs automatically as systemd cubesatsim.service. For more

information see https://CubeSatSim.org. To update

to the latest version, enter this command:

CubeSatSim/update

To see configuration options, enter this command:

CubeSatSim/config

You can edit the /boot/config.txt file: sudo vi /boot/config.txt Uncommented this line:

hdmi_safe=1

Clone this wiki locally