This is an old revision of the document!
Raspberry Pi data transfer rate test
The Raspberry Pi stores the images which are collected during flight. After the plane landed, the images are retrieved from the Pi. The least impact with respect to water sealing would be a wireless transfer via Wifi or Bluetooth. For completeness I also test the transfer rate via USB configured as RNDIS network device. As a seperate topic I look into the transfer rate of the SD Card.
Author: Friedrich Beckmann
Raspberry Pi configuration
I did a headless setup and connected the Pi via USB to startup the pi.
- Download the Raspbian SD Card image from raspberrypi.org
- Install Etcher (on MacOS) and download the image to the SD Card
- Setup the Pi for Headless connection via USB according to this description
In order to be able to login via ssh over usb cable, the following modifications have to be done on the SD Card. All changes are done in the files in the root folder. That folder is formatted FAT32 and can be accessed and modified via MacOS.
config.txt
Append at the bottom of config.txt
dtoverlay=dwc2
cmdline.txt
After rootwait, append
modules-load=dwc2,g_ether
and only add one space between and no newline. The parsing of this line is delicate.
Enable SSH
ssh is disabled by default. In order to be able to login via ssh, the ssh service has to be enabled in the Pi. This can be done by creating an empty file on the SD Card.
Create an empty file “ssh”
That file is deleted every time the pi does a new boot. So if you power off the pi, then you need to create that file again to be able to login via ssh.
Boot the Pi
Attach the Pi via the USB cable to the Mac. There are two USB connectors on the Pi. You must attach the cable to the connector labeled “USB”. Do not attach it to the connector labeled “PWR” - that connector does not provide a data connection. No additional power supply is required. The Pi is powered from the Macbook.
When the Pi boots, the green LED blinks when the SDCARD is accessed. Once boot is finished, the green LED stays on permanently.
Setup on the Mac
Go to System Preferences/Network or Systemeinstellungen/Netzwerk and check if you find RNDIS/Ethernet Gadget. That is the Raspberry Pi which is connected as network device. Then you can login to the Pi. Open a terminal on the Mac and do
ssh pi@raspberrypi.local
The default user on the Pi is pi and the default password is raspberry.
Enable ssh permanently
You need to enable ssh access permanenty with
sudo ssh systemctl enable ssh
Configure a static IP address for Raspberry Pi
The default behavior of the Pi RNDIS service is to receive an IP address vi dhcp. But the Mac does not provide a DHCP service, so we configure the Pi to have the fixed IP address 192.168.2.2. The Mac is setup to have the IP address 192.168.2.1. To configure the pi append to
/etc/dhcpcd.conf
interface usb0 static ip_address=192.168.2.2/24 static routers=192.168.2.1 static domain_name_servers=192.168.2.1
On the Mac go to Systemeinstellungen/Netzwerk. You need to configure the IP setup for the “RNDIS/Ethernet Gadget” device to “manual”. Set the IP to 192.168.2.1 and the subnetmask to “255.255.255.0”.
Configure the MAC to provide internet access to the Pi
As default the Pi is connected locally to the Mac. To provide internet access to the Pi via the Mac go to Systemeinstellungen/Freigaben and activate Internetfreigabe for RNDIS/Ethernet Gadget.
To check the internet access on the Pi open a terminal on the Mac and login to the pi via ssh. Then check
ping www.hs-augsburg.de
on the Pi. You should get a connection the hs-augsburg web server.
Setup WLAN access as wlan client
To setup the Pi to connect to the WLAN access point as client, I modified the file
/etc/wpa_supplicant/wpa_supplicant.conf
country=DE ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="fred" scan_ssid=1 psk="dosenpups" key_mgmt=WPA-PSK }
You can also place that file in the root folder on the Pi from the Mac. That will result in copying the wpa_supplicant.conf file the the /etc/wpa_supplicant directory and start the Wifi service. I am not too sure if this is permant or only for one boot.
Data transfer via Wifi / USB
Measurement Setup
The Raspberry is connected as WLAN client to the Fritzbox 7390 as access point. The Raspberry Pi Zero only has a 2.4 GHz rf modem and can not connect in the 5 GHz band. The Pi Zero W uses the CYW43438 chipset with 802.11n in single mimo stream setup and a maximum bandwidth of 20 MHz. This setup limits the air rate of the Pi to 65 MBit/s for a standard guard interval of 800ns and 72 MBit/s for a short guard interval. The Macbook is connected via Wifi to a Apple Timecapsule in the 5 GHz band, i.e. the Macbook is connected via seperate band to the FritzBox access point an does not use the channel bandwidth. There are no other clients connected to the Fritzbox AP. The channel is however occupied by other 2.4 GHz stations in the neighbourhood.
- Raspberry Pi Zero WH
- SanDisk Edge 8 GB - Class4 U1 SDHC Card
- Raspbian Buster Lite release from 2019-09-26 with kernel 4.19
- Macbook Pro (Retina 13 inch, Modell 2015) running MacOS 10.13.6 High Sierra
- Fritzbox 7390 as WLAN access point for the Raspberry Pi in 2.4 GHz band
- Apple Timecapsule 3GB version 7.9.1 for the 5 GHZ Wifi connection of the Mac
The Fritzbox reports the Raspberry Pi connection status with 65 MBit/s when I place the Pi in about 1m distance to the AP. There is no possibility to configure the FritzBox for Short Guard Interval, i.e. the system runs with the default 800ns GI.
Install iperf on the Raspberry Pi
To install iperf on Raspberry Pi run
sudo apt install iperf
Install iperf in the Mac
I installed iperf version 2.0.5 via homebrew. So on the Mac
brew install iperf
iperf data transfer rate measurement via USB
The iperf datastream goes from the client to the server. For our scenario the relevant direction is Pi to Mac. Therefore I run the iperf server on the Mac and the client on the Pi. iperf opens a tcp connection from the client to the server.
On the Mac
iperf -s
On the Pi
iperf -i 10 -t 300 -c 192.168.2.1
That tests the TCP/IP data transfer speed from the Pi to the Mac via USB connection. Each test interval is 10s and the toal test time is 300s. The result looks like this:
pi@raspberrypi:~ $ iperf -i 10 -t 300 -c 192.168.2.1 ------------------------------------------------------------ Client connecting to 192.168.2.1, TCP port 5001 TCP window size: 70.0 KByte (default) ------------------------------------------------------------ [ 3] local 192.168.2.2 port 34428 connected with 192.168.2.1 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 185 MBytes 155 Mbits/sec [ 3] 10.0-20.0 sec 186 MBytes 156 Mbits/sec [ 3] 20.0-30.0 sec 186 MBytes 156 Mbits/sec [ 3] 30.0-40.0 sec 186 MBytes 156 Mbits/sec [ 3] 40.0-50.0 sec 185 MBytes 155 Mbits/sec [ 3] 50.0-60.0 sec 180 MBytes 151 Mbits/sec [ 3] 60.0-70.0 sec 180 MBytes 151 Mbits/sec [ 3] 70.0-80.0 sec 180 MBytes 151 Mbits/sec [ 3] 80.0-90.0 sec 181 MBytes 152 Mbits/sec [ 3] 90.0-100.0 sec 181 MBytes 152 Mbits/sec [ 3] 100.0-110.0 sec 181 MBytes 152 Mbits/sec [ 3] 110.0-120.0 sec 184 MBytes 155 Mbits/sec [ 3] 120.0-130.0 sec 182 MBytes 152 Mbits/sec [ 3] 130.0-140.0 sec 182 MBytes 152 Mbits/sec [ 3] 140.0-150.0 sec 181 MBytes 152 Mbits/sec [ 3] 150.0-160.0 sec 181 MBytes 152 Mbits/sec [ 3] 160.0-170.0 sec 180 MBytes 151 Mbits/sec [ 3] 170.0-180.0 sec 180 MBytes 151 Mbits/sec [ 3] 180.0-190.0 sec 180 MBytes 151 Mbits/sec [ 3] 190.0-200.0 sec 180 MBytes 151 Mbits/sec [ 3] 200.0-210.0 sec 180 MBytes 151 Mbits/sec [ 3] 210.0-220.0 sec 181 MBytes 152 Mbits/sec [ 3] 220.0-230.0 sec 180 MBytes 151 Mbits/sec [ 3] 230.0-240.0 sec 181 MBytes 152 Mbits/sec [ 3] 240.0-250.0 sec 181 MBytes 152 Mbits/sec [ 3] 250.0-260.0 sec 181 MBytes 152 Mbits/sec [ 3] 260.0-270.0 sec 180 MBytes 151 Mbits/sec [ 3] 270.0-280.0 sec 181 MBytes 152 Mbits/sec [ 3] 280.0-290.0 sec 180 MBytes 151 Mbits/sec [ 3] 290.0-300.0 sec 180 MBytes 151 Mbits/sec [ 3] 0.0-300.0 sec 5.32 GBytes 152 Mbits/sec pi@raspberrypi:~ $
The transfer rate from the Pi to the Mac over the usb interface is on average 152 MBit/s.
The other direction for a data transfer from the Mac to the Pi shows a data rate of 109 MBit/s. For that test I started the iperf server on the Pi and called the iperf client on the Mac.
Fredo:~ fritz$ iperf -i 10 -t 100 -c 192.168.2.2 ------------------------------------------------------------ Client connecting to 192.168.2.2, TCP port 5001 TCP window size: 129 KByte (default) ------------------------------------------------------------ [ 4] local 192.168.2.1 port 63206 connected with 192.168.2.2 port 5001 [ ID] Interval Transfer Bandwidth [ 4] 0.0-10.0 sec 130 MBytes 109 Mbits/sec [ 4] 10.0-20.0 sec 130 MBytes 109 Mbits/sec [ 4] 20.0-30.0 sec 130 MBytes 109 Mbits/sec [ 4] 30.0-40.0 sec 130 MBytes 109 Mbits/sec [ 4] 40.0-50.0 sec 130 MBytes 109 Mbits/sec [ 4] 50.0-60.0 sec 130 MBytes 109 Mbits/sec [ 4] 60.0-70.0 sec 130 MBytes 109 Mbits/sec [ 4] 70.0-80.0 sec 130 MBytes 109 Mbits/sec [ 4] 80.0-90.0 sec 130 MBytes 109 Mbits/sec [ 4] 90.0-100.0 sec 130 MBytes 109 Mbits/sec [ 4] 0.0-100.0 sec 1.27 GBytes 109 Mbits/sec Fredo:~ fritz$
The transfer rate from the Mac to the Pi is 109 Mbit/s over the USB Interface.
CPU Load during iperf transfer
I measured the cpu load with the top tool. I login to the pi via the wifi interface and run “top” there. The idle sitation is shown here:
top - 13:29:01 up 33 min, 2 users, load average: 0.03, 0.04, 0.00 Tasks: 77 total, 1 running, 76 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.7 us, 1.0 sy, 0.0 ni, 98.4 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 432.7 total, 327.0 free, 36.6 used, 69.1 buff/cache MiB Swap: 100.0 total, 100.0 free, 0.0 used. 345.0 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 578 pi 20 0 10172 2952 2520 R 1.0 0.7 0:01.11 top 556 root 20 0 0 0 0 I 0.3 0.0 0:00.02 kworker/u+ 1 root 20 0 32532 7876 6384 S 0.0 1.8 0:04.33 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 5 root 20 0 0 0 0 I 0.0 0.0 0:00.04 kworker/u+ 6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu+ 7 root 20 0 0 0 0 S 0.0 0.0 0:00.31 ksoftirqd+ 8 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kdevtmpfs 9 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 netns 10 root 20 0 0 0 0 I 0.0 0.0 0:00.10 kworker/0+ 11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khungtaskd
Then I start the iperf client and transfer the data to the iperf server on the Mac. The cpu load on the Pi looks like this:
top - 13:30:54 up 35 min, 2 users, load average: 0.61, 0.17, 0.05 Tasks: 77 total, 2 running, 75 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.7 us, 46.7 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 52.6 si, 0.0 st MiB Mem : 432.7 total, 326.0 free, 37.5 used, 69.2 buff/cache MiB Swap: 100.0 total, 100.0 free, 0.0 used. 344.0 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 580 pi 20 0 26708 2944 2252 S 80.7 0.7 0:20.34 iperf 7 root 20 0 0 0 0 R 14.1 0.0 0:03.64 ksoftirqd+ 299 root 20 0 27640 1368 1240 S 3.6 0.3 0:01.11 rngd 578 pi 20 0 10172 2952 2520 R 0.7 0.7 0:01.97 top 91 root 20 0 0 0 0 I 0.3 0.0 0:00.51 kworker/u+ 562 pi 20 0 12172 4056 3248 S 0.3 0.9 0:00.37 sshd 579 root 20 0 0 0 0 I 0.3 0.0 0:00.18 kworker/0+ 1 root 20 0 32532 7876 6384 S 0.0 1.8 0:04.33 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 5 root 20 0 0 0 0 I 0.0 0.0 0:00.04 kworker/u+ 6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu+
The CPU is fully loaded with the iperf process (80%) and the interrupt service (14%). The transfer rate is again 150 MBit/s.