Wednesday, January 06, 2021 - The Raspberry Pi (RPi) is a credit-card sized microcomputer costing less than $150, uniquely fashioned as an embedded platform to control instrumentation, run experiments, and monitor and analyze data.
Raspberry Pi (RPi) computers are an excellent solution to interface with scientific instruments because of their low cost, less than $150, and low operating costs, less than $2/month. There are no moving parts, like hard drives, so the monthly operating costs are extremely cost effective. Most importantly, however, the native Linux operating system, known as Raspbian, makes the Raspberry an extremely stable platform, enabling the Raspberry to communicate, control, acquire, and analysis data in real-time, for long periods, months or longer, of time for long-running experiments, monitoring, and data collection.
Raspberry Pi 3 are good for development and entry-level instrument control. Raspberry Pi 4 are about ten times faster with models up to 8 GB of RAM, USB 3, and dual HDMI monitors, all in a credit-card sized footprint.
Raspbian is the native Linux OS for the Raspberry 4 that comes with Python 3.7. With the addition of PostGreSQL 9 and web2py, the RPi is not only excellent for instrument control, but also serves as a local data and web server to provide a graphical-user interface and experiment and real-time data monitor accessible to itself or other local computers.
After receiving a RPi4 with an associated A1 C10, or faster, microSD chip download the RPi OS from: Raspberry Pi OS, to a Mac or other Linux computer and unzip the download to its image (img) file. I always choose the image with the most options, "Raspberry Pi OS with desktop and recommended software" in case I need to word process or browse the web. Burn the img file using "dd" under a command-line interface (CLI) like BASH with, for example,
> dd if=2021-03-04-raspios-buster-armhf-full.img of=/dev/disk2 bs=1024m
where /dev/disk2 is the location of the microSD chip on the Mac, which can be positively identified under Disk Utility. Once the image is copied to the microSD chip, it can be inserted into the RPi4 and powered on.
Its intended to use the RPi as not only a instrument controller and analyzer of data, but also to act as a database and web server so that a graphical-user interface can be developed to visually control and monitor the data from the RPi itself of other local computers on the same network through a web browser. The first steps to setting up RPi OS is rename the host under Start, Preferences, Raspberry Pi Configuration and under the System tab and the Hostname field: "IQaRPi4a8GB". Under the Interfaces tab, Enable SSH.
Under the Terminal CLI window, type "systemctl enable ssh" and then "systemctl start ssh" to enable SSH. Also type "sudo passwd" to update the password of the default "pi" user and "sudo passwd root" to update the password of "root". The static IP address can be established to the ethernet via:
> nano /etc/dhcpcd.conf # Example static IP configuration: interface eth0 static ip_address=192.168.1.200/24 #static ip6_address=fd51:42f8:caae:d92e::ff/64 static routers=192.168.1.1 static domain_name_servers=184.108.40.206 220.127.116.11 noipv6 static domain_search= >> Ctrl-X, Save? >> Y, Enter > reboot now
or, via the GUI by right clicking the Network icon on the task bar and choose "Wireless and Wired Network Settings". Under Configure, interface, and eth0, uncheck "Automatically configure empty options", check "Disable IPv6", and enter "192.168.1.200/24" for "IPv4 Address", "192.168.1.1" for "Router", and "18.104.22.168 22.214.171.124" for "DNS Servers". This way there is a static IP address predetermined when accessing the RPi server from other local computers. VNC Server will also automatically be setup for full graphical access with the full RPi OS installation.
So at this point, the RPi server can be pinged, ssh'd, and vnc'd from any local computer on the network. Also, Python 2.7 and 3.7, and the Geany code editor are natively installed ready for use.