Difference between revisions of "Setting Up Your Raspberry Pi"

From AstroBaki
Jump to navigationJump to search
Line 70: Line 70:
* Software Install
* Software Install
** <tt>sudo apt install python3-ipython jupyter vim texlive</tt>
** <tt>sudo apt install python3-ipython jupyter vim texlive libusb-dev</tt>
** Copy over VIM config (if you use vim)
** Copy over VIM config (if you use vim)
** <tt>scp .vimrc pi@radiopi:</tt>
** <tt>scp .vimrc pi@radiopi:</tt>

Revision as of 20:02, 17 January 2022

With the growing utility and prevalence of low-cost computing boards, it is becoming increasingly common to embed computing directly into instrumentation. The Raspberry Pi is an example of a relatively low-cost but very versatile computer capable of running a full-fledged (Linux) operating system and performing a non-trivial amount of computing, while also providing interfaces for low-level communication with electronics. The Raspberry PI (RPi) is not the only example of such board, and it is not necessarily suited to all embedded computing applications, but it is widely used and quite capable.

Because of its ubiquity and versatility, we have chosen the RPi as a platform for data acquisition and computing for the Undergraduate Radio Lab. Having a common computing platform for the class makes it easy for us to introduce you to the Linux operating system (a mainstay of scientific computing), the world of embedded computing, and new developments in software-defined radio (SDR). I strongly encourage you to buy your own for use in this class so that you can take it home with you. These little computers are super versatile and you will find that you can use them for all sorts of things. In my home, I use them for wireless print servers, robot controllers, roku-like TV streamers, video game emulators, and as a straight-up desktop computer for kids doing remote schooling. Think of this purchase as your "textbook" for this class.

To get started, here is a parts list:

Raspberry Pi

  • Raspberry PI 4 version B (2 or 4 GB RAM) (~$45/$55 ea). Alternately, may use RPI 3.
    • stock is low because of pandemic supply chain problems. Try https://www.canakit.com/raspberry-pi-4-4gb.html or https://www.sparkfun.com/products/15446.
    • if stock is exhausted, back-order and switch to using it whenever it arrives (using the class ones in the meantime)
    • the computing board does not come with: monitor, keyboard, mouse, power supply, SD card (its hard drive), or even a case to hold it. Some places sell a "starter kit" that has many of these things, or you can buy them separately (under accessories below).

RPi Accessories

Software-Defined Radio (SDR) Receiver

To digitize radio-frequency (RF) signals and get them on an RPi, you need SDR receiver (we will stock these in class, but if you want one for home, or if you are working remotely, consider buying). These are only necessary for "radio" applications. They come with some cheap antennas you can use to listen to, e.g., FM radio on your RPI. Cheap SDRs have become available because they are used for tuning in to broadcast TV and FM radio.


The SD card you ordered functions as your RPi's hard drive. You will need to install it with an operating system, along with any software you will need. The easy way to do this is to clone an existing installation from another card. If you come to class, we will do this for you. Otherwise, follow the instructions below.

Setup from Scratch

Raspberry Pi's benefit from being a standard set of hardware. As such, they have a customized version of Linux (a free, open-source version of Unix) that runs on them an includes drivers for all their hardware. That customized Linux version is called Raspbian (being a branch of Debian Linux for a Raspberry Pi). Other operating systems exist, but we will only support Raspbian in class.

  • Initial boot
    • get wireless up (click Desktop icon in top-right)
    • open up a terminal and run the following commands
      • sudo apt update
      • sudo apt upgrade
    • open Raspberry Pi Configuration (menu)
      • change hostname to, e.g., radiopi
      • Interfaces: ssh=enabled, vnc=enabled, remote gpio=enabled
      • Localisation: Keyboard US layout
    • reboot
    • change passwd
  • Software Install
    • sudo apt install python3-ipython jupyter vim texlive libusb-dev
    • Copy over VIM config (if you use vim)
    • scp .vimrc pi@radiopi:
    • Fix missing ipython command
      • vi .pydisutils.cfg and add these lines:
        • [install]
        • install-scripts=/usr/local/bin
      • sudo pip3 install --force ipython
      • sudo pip3 install astropy

SDR Setup

See https://wiki.gentoo.org/wiki/Rtl-sdr

  • Plug SDR module in
  • Force detect as sdr, not dvb
    • sudo vi /etc/modprobe.d/blacklist-dvb.conf add the following line:
      • blacklist dvb_usb_rtl28xxu
    • sudo apt install rtl-sdr gqrx-sdr
    • sudo vi /etc/udev/rules.d/20-rtlsdr.rules add the following line:
      • SUBSYSTEM==”usb”, ATTRS{idVentor}==”0bda”, ATTRS{idProduct}==”2838”, GROUP=”pi”, MODE=”0666”, SYMLINK+=”rtl_sdr”

Class Software