2. Set up a Headless Raspberry Pi

Setup Raspberry Pi
for
Drone

The drone control computer no needs GUI, we will set up a headless Raspberry Pi. It can save the disk space and also the CPU load.

Download the Raspberry Pi OS (32-bit) Lite

If your RPi didn’t install the OS or you want to reinstall it, you can download the Raspberry Pi OS (32-bit) Lite from here

Writing image to SD card

You can download and use the etcher to write the image to SD card.

Writing image to SD card (using Mac Terminal)

If you use etcher, you can skip this step. If you are using Mac and want to use Terminal to write the image, it is for you.

  1. insert the SD card to Mac (suggested minimum 8GB disk)
  2. look up the disk id:
diskutil list
  1. the screen-print will be something like below. The SD card id is disk2. (Your disk id may be difference, please find it carefully)
/dev/disk2 (external, physical):
   #:     TYPE NAME               SIZE       IDENTIFIER
   0:     FDisk_partition_scheme  *31.9 GB   disk2 
   1:     Windows_FAT_32 boot     268.4 MB   disk2s1
   2:     Linux                   7.8 GB     disk2s2
   3:     Linux                   23.9 GB    disk2s3
  1. replace the "diskx" to your disk id then unmount the disk
diskutil unmountDisk /dev/diskx
  1. format the disk
sudo newfs_msdos -F 16 /dev/diskx
  1. replace the "/path/of/image/xxx.dmg" to the image file path then write the image to disk
sudo dd if=/path/of/image/xxx.dmg of=/dev/diskx bs=1m

Login default username and password

You can use the default username and password log in to the RPi.

Default user: pi
Default password: raspberry

Expanding disk space

Even if you are using a larger card, but the system still using 4GB disk space. This is because writing the disk image to your microSD card creates a partition. The result is that the rest of the disk is unusable unless you expand the file system.

You can run the following command to expand it:

sudo raspi-config --expand-rootfs

Config the WiFi

Setting up a wireless LAN via the command line

You can use ifconfig to check the wifi status. If it prints the wwan0 information, means the wifi connection fine.

wwan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
inet 169.254.xxx.xxx  netmask 255.255.0.0  broadcast 169.254.255.255

You can try to ping a domain to test the connection to Internet.

ping google.com
64 bytes from 172.217.163.238: icmp_seq=1 ttl=58 time=13.067 ms

Note: In case you need to modify or check the WiFi config file directly, find here:

/etc/wpa_supplicant/wpa_supplicant.conf

Security Setup

The document below provides detailed information to protect your RPi. You can choose to execute items that suitable for you, but at least change the default username and password.

Securing your Raspberry Pi

Login SSH

If the everything fine, you can login to your RPi through SSH. You can find the RPi IP using ifconfig in wwan0

ssh [email protected]

Next: 3. Installing 4G USB modem to Raspberry Pi