The Raspberry Pi 3 Model B+ (2018) - How to Seamlessly Transition To The New Pi And Test It's Performance

You would think that transitioning from the Pi 3 Model B to the Pi 3 Model B+ would be seamless - you buy the B+ and transfer the old SD card from the old Pi into the new one. But it's just not that simple. After ruling out power draw, SD card failure, and update/upgrade of the OS, I finally tried flashing a completely fresh version of Raspbian on an SD card. And it worked! I cover the steps to flash the new Raspbian onto an SD card using The Raspberry Pi foundation's recommendation, Etcher, and the basic process of updating and upgrading to get the new Pi up and running.

 

 

First and foremost, I recommend going to the Raspberry Pi installation guide, here. I don't use NOOBS because I find that a simple install of Raspbian suffices. The link directly to Raspbian is here. Below is the window you should see when downloading the disc image -we want to select the 'Raspbian Stretch With Desktop' option so that your computer can do all the hard work in terms of downloading the OS (rather than letting your Pi do it, it's likely that your computer will have a better WiFi card = faster download).

raspbian_stretch_screenshot.png

You'll also need the SD card flasher called Etcher. This will help you load the Raspian image onto your SD card.

You want to select the extracted Raspian image first, then select your SD card next, and finally hit Flash! This will prepare your SD card for the new Raspberry Pi Model 3B+. 


Running the Pi and Connecting to Enterprise WiFi

After inserting the SD card with the new Raspbian OS installed, I booted the pi. At first boot, everything seems exactly the same on the desktop. I opened up the WiFi menu and attempted to connect to a network. Since I work from a University, I had to go through the extra process of connecting via Enterprise WiFi. There's a great example (here) that I found a while ago that gets you connected with a few lines of code in the command line. If you're not connecting to Enterprise WiFi, then you should already be connected to a personal WiFi and you can skip the rest of this section.

The first thing you want to do is navigate to '/etc/wpa_supplicant/wpa_supplicant.conf'

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

From there, you should see the following:

 

country=UK
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

You'll need to add the following to the 'wpa_supplicant.conf' file to connect to your Enterprise WiFi network:

country=UK
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="test-wifi"
    key_mgmt=WPA-EAP
    eap=PEAP TTLS
    identity="username"
    password="pwd123"
    phase2="auth=MSCHAPv2"
}

where "test-wifi" is your wifi network name, "username" is your particular username for signing in, and "pwd123" is your unique password for your network.


Internet Speed Tests

I used the method suggested by LifeHacker where you instruct the Pi to download a file of a certain size and record the time it takes to download via the command line 'wget' command. I compare two file downloads, one 10 MB and one 100 MB between the Pi 3B and 3B+. The results are shown below.

internet_speed_icon.png

10 MB file download times:

  • 3B+ - 39s / 39s / 39s / 44s / 57s
  • 3B   - 44s / 51s / 39s / 39s / 39s

100 MB file download times:

  • 3B+ - 358s / 367s / 357s
  • 3B   - 356s / 375s / 362s

As you can see in the results above, the new Pi doesn't actually perform faster in terms of internet download speed. There may be increases in speed when on the 5 GHz band (since the 3B doesn't have 5 GHz), however, there are no noticeable changes on the regular 2.4 GHz band. 

 


Python Speed Tests (Processor)

I will be testing several Python programs to verify the efficiency of the CPU. The simplest way to test processor speed is through Python's 'timeit' library. This can be done directly in the command window:

 

python -m timeit '"-".join(str(n) for n in range(100))'

The result should be something like '10000 loops, best of 3: 183 usec per loop.' This tells you that the program completed 10,000 iterations of the loop above, each one averaging roughly 183 microseconds in computation time. The results between the 3B and 3B+ are below:

  • 3B+ - 183 usec
  • 3B   - 212 usec

As expected, we see that the ratio of 3B+ to 3B is about 1.15, which when multiplied by the CPU speed of the 3B (1.2 GHz) gives you 1.39 GHz - the speed of the new processor (about 1.4 GHz). 


Quad-core Parallel CPU Tests

Next, I'll be testing a multi-thread algorithm to fortify the improved speed of the new Pi's CPU. I found a great multithreading, multiprocessing, serial processing benchmark comparison, here. I attached the code below so that any user can test the results.

Results:

  • 3B+ - 3.8s (serial), 3.9s (threads), 0.98s (multiprocessing)
  • 3B   - 4.3s (serial), 4.5s (threads), 1.15s (multiprocessing)

 

rpi_cpu.jpg
 
import os
import time
import threading
import multiprocessing
 
NUM_WORKERS = os.cpu_count() 
 
def crunch_numbers():
    """ Do some computations """
    print("PID: %s, Process Name: %s, Thread Name: %s" % (
        os.getpid(),
        multiprocessing.current_process().name,
        threading.current_thread().name)
    )
    x = 0
    ii = 1
    while ii < 1000000:
        x*x
        ii+=1

## Run tasks serially first
start_time = time.time()
for _ in range(NUM_WORKERS):
    crunch_numbers()
end_time = time.time()
 
print("Serial time=", end_time - start_time)
 
# Run tasks using threads
start_time = time.time()
threads = [threading.Thread(target=crunch_numbers) for _ in range(NUM_WORKERS)]
[thread.start() for thread in threads]
[thread.join() for thread in threads]
end_time = time.time()
 
print("Threads time=", end_time - start_time)
 
# Run tasks using processes
start_time = time.time()
processes = [multiprocessing.Process(target=crunch_numbers) for _ in range(NUM_WORKERS)]
[process.start() for process in processes]
[process.join() for process in processes]
end_time = time.time()
 
print("Parallel time=", end_time - start_time)
 

Conclusion

In this very limited exploration of the new Raspberry Pi 3 Model B+ I discussed how an old SD card cannot be used directly with the new Pi. Consequently, I gave instructions on the simple SD card flash process with Raspbian in order to get the new Pi up and running. I then showed a brief experiment regarding the lack of improvement on WiFi download speed. I finished my analysis by investigating the CPU performance and showed two distinct ways of measuring the CPU speed. The CPU experiments demonstrated, at great length and certitude, that the CPU on the new Pi results in a definite 17% increase in speed and efficiency. I also showed a small snippet of how to parallelize code in Python, something I hope has taught the user the power of multiprocessing.