Linux Laptops

We had a couple laptops recently donated to the Makerspace (thanks Ms. A) and I’ve installed Ubuntu’s Linux (20.04 LTS) to see if I could get them to be useful for my students. I particularly wanted to see how hard they’d be to set up for programming (especially given the issues I’ve had with python). They’re working quite well so far, and this is my record of what I’ve done to set them up.

Installing Ubuntu

Ubuntu makes it really easy to install their operating system; it’s the main reason it’s one of the more popular flavors of Linux. You can download the ISO and get instructions on how to create a USB installation stick on their page.

Getting System Information

inix is a nice tool to for finding information about your computer (which you sort-of need when you’re dealing with donated machines): what type of cpu, how much RAM, size of the hard drive and things like that. Install with:

sudo apt-get install inxi

and to get the full set of information, run:

inxi -F

Extremely useful, but I did not really need this to tell me that I needed to upgrade the hard drive. Swapping the hard disk drive (HDD) for a solid state drive (SSD) is one of the quickest and cheapest ways to upgrade an older system. I picked up a 120 Gb SSD for less than $20 and the computer is now an order of magnitude faster (though I’m down from 500 Gb).

Upgrading

The final step after installing the operating system is to update the software. Ubuntu runs an automatic update on your first boot. However, since I’ll be doing most of my installations from the command line, I run the update commands (just in case):

sudo apt update
sudo apt upgrade

Setting up Python

Python 3.8.5 was installed by default, but I need the python package installer (pip) to install the modules I’ll need:

sudo apt install python3-pip

Now I can install numpy (-U option to upgrade) for numerical stuff:

pip3 install -U numpy

as well as, matplotlib:

pip3 install -U matplotlib

and vpython

pip3 install vpython

and for virtual environments (venv):

pip3 install virtualenv

and the IDLE editor for python

sudo apt-get install idle3

also the Thonny editor that makes using Raspberry Pi Picos much easier (especially for the pico LED strips)

sudo apt install thonny

Now we should be good to go.

git, github, and vs code

git: I’ve been using github.com for keeping my programming projects and GitHub Classroom for my programming class. The GitHub Desktop program is great for Windows and OSX, but does not exist for linux at the moment. So I needed to install git:

sudo apt install git-all

VS Code is a pretty popular IDE for coding that I’ve been using for my computer programming class. It’s a Microsoft product that is designed to work closely with github repositories. You can download the .deb from

It’s usually saved in the ~/Downloads folder, so to install this should work:

sudo apt install ./Downloads/code*.deb

I usually test the VS Code installation with my ledPixelsPico repository because I want to make sure I can operate my Raspberry Pi Pico LED strips.

To get VS Code to be able to make commits and sync with the repository (you’ll have to test this with a repository of your own–or that you have permission to sync with) you’ll need to run the ‘git config –global user.email “you@example.com”‘ and ‘git config –global user.name “Your Name”‘ commands in the VS Code Terminal.

LaTeX

For typesetting beautiful documents (mainly for the equations) I use LaTeX.

Since I don’t want to worry about downloading LaTeX packages when I need something esoteric I install the full Tex Live distribution (Note: for texlive on Fedora use ‘texlive-scheme-full‘).

sudo apt-get install texlive-full

Editor: To use LaTeX we need an editor. I prefer TeXstudio:

sudo apt-get install texstudio
  • Folder with all files needed to test the typical things I do with LaTeX in a chapter format: LaTeX Demo Report.

NOTE: if you’re low on memory, you can install something like Miktex instead of Tex Live because it installs packages only when you need them. Also, some of my students who use Apple computers seem to find TexShop easier to set up than TexStudio.

Installing Additional Software

The basic Ubuntu installation comes with a lot of the free software I use, but, using the command line:

sudo apt install ...

or the Ubuntu (or other package manager) Software tool, I added:

  • [Atom] [depreciated]: text editor for coding (being depreciated unfortunately, I’ve been forced to use VS Code instead: see above, or Thonny: see below and above).
  • Thonny: Coding editor for working with Raspberry Pi Picos in particular (may already be installed from the python section above).
  • GIMP: for image editing
  • Inkscape: for vector graphics
  • OpenScad: for 3d Modeling (for printing)
  • Shotcut: for video editing (it’s multi-platform). I’m trying this one for extracting time information from experiments (like ball drops). Can install with ‘sudo apt-get install shotcut’

UxPlay [Optional]: A crucial piece of software for online teaching that I had to install via the command line was, UxPlay, and you can see my variant of the installation instructions here. This program allows me to mirror my iPad to the computer.

The Rest

The rest is mostly tweaking the settings to your specifications (there’s even a program called Tweak you can install for extra settings).

Tweaks

I use this to enable hot-corners and customize the desktop interface.

sudo apt install gnome-tweak-tool
sudo apt install gnome-shell-extensions
Fonts

Added the student fonts following LinuxConfig’s instructions, specifically the section on “Manual system-wide font installation”, which just meant copying the folder with all the fonts to the “/usr/local/share/fonts/” directory.

php

I use php a lot so I’ve set it up so I can run php off the command line (I haven’t figured out how to use url parameters this way though).

sudo apt install php libapache2-mod-php
sudo apt install php-cli
gdebi

gdebi is a little application for installing .deb software. I’ve had enough hiccups with the Ubuntu Software tool, to find it useful to right click a downloaded .deb file and install it using gdebi. To install:

sudo apt install gdebi
Imager

The first thing I used gdebi to install was Imager, which is used to write the Raspberry Pi operating system to USB’s or SD cards. Download the imager .deb, right click and install using gdebi.

nmap

nmap maps your local network, which is useful if you have a bunch of Raspberry Pi’s around and need to figure out their IP addresses.

sudo apt-get install nmap

To use nmap to find all the raspberry pi’s on the local network use something like this, where you change the IP address (192.168.4.0) to whichever IP your computer is on, but switch the last number for 0:

sudo nmap -sP 192.168.4.0/24 | grep -in -B 2 'pi'

UxPlay: Sharing iPad Screen on Linux (Ubuntu)

My setup for teaching online and in school students simultaneously requires me to mirror/share my iPad screen, which I’m using as a whiteboard, with a computer that’s doing video-conferencing for the online students and is hooked up to a projector for the in-class students.

I’ve been using X-Mirage on a Windows computer, but this week my Windows desktop started having trouble connecting to the internet in the middle of classes, and I’ve not been able to debug. Fortunately, I’d been setting up a donated laptop with Ubuntu Linux, mainly to use as a machine for programming, but a quick internet search lead me to Rodrigo Ribeiro’s UxPlay that allowed me to switch over to the Linux laptop for the last two days.

The installation instructions are straightforward, but I wanted to make a note to myself for future reference, because I did this on two different laptops and both times I had to run one of the commands I found in the comments.

So, to install run:

sudo apt-get install cmake
sudo apt-get install libssl-dev libavahi-compat-libdnssd-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-libav
sudo apt-get install gstreamer1.0-vaapi

The last command was redundant on at least one of the computers, but didn’t seem to hurt.

You then download the UxPlay program from his webpage, and follow his instructions to unzip the file, cd into the directory, make a ./build folder, cd into that, and then run the commands:

cmake ..
make

At this point you may be able to run the program, but I was not able to connect my iPad until I ran:

sudo apt-get install gstreamer1.0-plugins-bad

Then I could launch the program (while still in that build directory) with:

./uxplay
Screen mirrored using UxPlay showing my Jamboard notes that were written on the iPad.

Now, I just need to figure out the best way of streamlining the use of the program.

Update: I copied the “uxplay” executable into the “/usr/local/bin” folder so it’s now accessible from everywhere, and available to all users on the laptop.

The Technology I Use for Teaching in Person and Online at the Same Time

This year we’ve been doing a hybrid system with most students at school and a few, who’re more sensitive to the COVID risk, at home. Setting up the technology to accomplish this has been quite tricky, but we’ve settled on a system the works reasonably well.

Hardware

The standard system involves:

  1. iPad: for notes that will normally be written on the board,
  2. Computer: the iPad screen is mirrored on the computer and then,
  3. Projector: to project what’s on the computer/iPad the kids in the classroom.

In practice it looks like this.

The iPad is mirrored to the computer which connects to the project and shares the screen with the kids at home.

If it looks a bit messy, that’s because it is.

Software

Video Conferencing

We’re using Google Meet for our video conferencing software, pretty much because we’re using Google Classroom for our classes and it’s built in. However, all you need is something that can share the computer screen with the kids at home, so Zoom, which we used in the spring, would probably work as well. One advantage of Meet is that it’s easy to set up a meeting for the class and the link is posted at the top of the page every time you log into Google Classroom.

Jamboard as a Whiteboard app.

After trying a few programs we’re using Google’s Jamboard as a whiteboard program for the iPad. Jamboards are shared documents, just like another Google Doc or Sheet, so in theory, if I shared the specific Jamboard document with them (which I do) the students at home could just follow along in the same document in real-time. In practice Jamboard can be extremely laggy, so I’ve given up on that approach and now I just share my entire computer screen over the video conferencing program.

One nice thing about Jamboard is that they are files, so the whiteboard notes can be saved and cataloged with other materials for a particular lesson or assignment. It’s also probably a good thing that you’re restricted to 20 slides otherwise I’d end up with some really large documents.

The ability to save them as files with all the other google documents, and the fact that it’s free, are the main reasons I prefer Jamboard to the other whiteboard options I’ve tried.

Mirroring the iPad (X-Mirage and UxPlay)

Mirroring the iPad to the computer turned out to be quite tricky. Since we’ve been working primarily with Windows PC’s, I ended up going with X-Mirage. I’ve set it up so X-Mirage automatically launches when you start up the computer, but it’s another piece of software to pay attention to. This program has a mac version as well. On the downside it costs about $14 for each computer it’s on.

I recently got my hands on a couple old (donated) laptops, and installed Linux (Ubuntu) on them for the operating system. In the few days I’ve been testing them they seem to work very well. For these I’ve used UxPlay as mirroring software, which has slotted into the system very, very well. Because it’s a command line program, setting up can be a little tricky.

In Summary

In summary, I have a system, and it works well enough that all of the other teachers have adopted it for their classes as well. This works for us because we can mostly use the hardware we have (we did have to buy iPads for the teachers who did not have them), and the software is fairly cheap. The kids at home appreciate it because it allows them to see and hear what’s going on in the classroom, especially what’s written on the board, pretty clearly. I’ve not heard many complaints from the kids at school.

As for the future, I am somewhat excited that I can effectively use the Linux computer now, and I’m always looking for ways to streamline.

Environments for Teaching Python in Middle and High School

I’ve been using python as the primary programming language for all of my classes, from middle to high school. However, with a variety of different machines and operating systems–macs, PC’s, OSX, Windows, ChromeOS–it has been bit of a pain getting everyone up and running and on the same page. It has been especially problematic because I like to use NumPy and, especially, the VPython module because of its nice, easy 3d visualizations.

I’ve tried Anaconda, which works great on some machines but not so much on others. One student with a Mac had to restart the kernel every time he ran a program with vpython, while others had trouble getting it to work properly at all. I do like the way it allows you to put everything into a single Jupyter Notebook, which works nicely for teaching-length programming assignments, but becomes cumbersome for longer projects. Joel Grus goes into detail about why he does not like Notebooks for teaching; much of which I agree with. I do like the Spyder IDE a lot, but I’ve run into some computers that have problems with it (constant crashes).

So, I’ve been using Glowscript a lot with the lower grades. It’s online, so you only need a browser, and its made for vpython, so you can do a lot of the numerical work with it. However, because it’s online you can’t, understandably, get it to write output files to your computer–you have to copy and paste from its output. I’m also not sure how to import user-created modules, which further limits its utility for higher-level classes.

I’ve recently run into repl.it, and I’m having a student try it out in my Numerical Methods class. It looks quite promising as it seems to be able to manage files well and we’ve tried some basic numerical programs using numpy and matplotlib. However, I’ve not got it running vPython yet (although it’s come close).

(repl.it update): One of our other teachers has been trying repl.it with the middle school class and really likes it.

I’ve also recently discovered MakeCode. I’m looking into it for the lower grades, down to 6th grade or even earlier, because it lets you write programs for Minecraft, which is very popular with a remarkably broad age group. It lets you work in blocks, python, or JavaScript. From my poking around, the first couple of things it teaches you to do in Minecraft are write statements (to generate a chicken) and the loops (to generate a lot of chickens). I’ve asked one of my 9th grade, Minecraft players to investigate, so I should have some results to report soon.

At the moment, for my most advanced class, we’re taking a whatever-works approach. We’re learning about finite differences and using matplotlib to graph the output. I have one student, mentioned above, using repl.it, and another one using Jupyter Notebook on a Mac. A different Mac user is invoking IDLE from the command line because they prefer the IDLE IDE, but couldn’t get numpy to install properly with the python 3.9 version they’d installed earlier–the command-line IDLE actually goes to their Anaconda installation. I have one student, on a Windows machine, for whom everything just works and are using their regular IDLE installation. We spent the entire class period getting everyone up and running with something, but at least now everyone has at least one environment they can use. I’m curious to see what the kids who have multiple options are going to go with.

3d Printable Microscopes

A few interesting, low-cost but potentially lab-grade, microscopes that would be great Makerspace projects for students.

OpenFlexure: Out of the University of Bath, this has a Raspberry Pi at the core that can control the stage, focus, and sensor (using the RPi camera module). Since it’s modular the cost varies with the image quality you’re aiming for, but it looks like you can achieve even high resolution results relatively cheaply. They have great detail on their website, including their own version of Raspbian to install on the Pi, so this looks like an good starter project.

UC2: I really like the look of this building block, LEGO-style, system. It seems extremely flexible and there are some interesting projects that go beyond your standard microscope. There are a lot of designs you can go with, including an Arduino or using a Raspberry Pi and camera, but they claim to get good results just with smartphones. This is a big, sprawling project, which suggests a slightly steeper learning curve.

Hat tip to Maggie Eisenberger for introducing me to these.

Playing with Electron Configurations

I upgraded the table part of the Electron Configuration Interactive I used in the app I made for Practicing Writing out Electron Configurations. It’s now more interactive and embeddable.

Click on the green cell (in the 3d subshell) to start adding electrons. Clicking on the previous cell will remove electrons.

The full documentation is here.

No Such Thing as Dark Matter

We’ve not been able to detect dark matter yet. Natalie Wolchover explains summarizes theories that could explain the way the universe works without having dark matter.

Key to it is the Modified Newtonian Dynamics (MOND) equation to explain why the stars at the outer edges of galaxies are moving faster than Newton’s force law predicts they should be.

Velocities of stars further away from the center of the galactic disk (larger R) have a higher velocity (V) than predicted by Newtonian physics. Dark matter has been used to explain this discrepancy, but tweaking the physics equations could do so as well. Image from Wikipedia.

Newton’s Second Law, finds that the Force (F) acting on an object is equal its mass (m) multiplied by its acceleration (a).

 F = m \cdot a

The MOND equation adjusts this by adding in another multiplication factor (μ)

 F = \mu \cdot m \cdot a

μ is just really close to 1 under “normal” everyday conditions, but gets bigger when accelerations are really, really small. Based on the evidence so far an equation for μ may be:

 \mu = \frac{a}{a_0} \frac{1}{\sqrt{1+\left(\frac{a}{a_0}\right)^2}}

where, a₀ is a really, really small acceleration.

Factoring this μ factor into the equation for the force due to gravity ( F_g ) changes it from:

 F_g = G \frac{ m_1 \cdot m_2}{r^2}

into:

 F_g = G \frac{(m_1 \cdot m_2)}{r^2} + \frac{\sqrt{G \cdot \m_1 \cdot m_2 \cdot a_0}}{r}

The key point is that in the first term, which is our standard version, the denominator is the radius squared (r^2) while the second term has a plain radius denominator (r).

This means as the distance between two objects gets larger, the first term decreases much faster and the second term becomes more important.

As a result, the gravitational pull between, say a star at the edge of a galaxy and the center of the galaxy, is not as small as the standard gravitational equation would predict it would be, and the stars a the edge of galaxies move faster than they would be predicted to be without the additional term.

References:

What is Dark Matter?

Adam Hadhazy, in Discover Magazine, summarizes the top candidates to explain dark matter and the experiments in progress to find them. These include, WIMPs (Weakly Interacting Massive Particles, Axions, Sterile Neutrinos, and SIMPs (Strongly Interacting Massive Particles.

Distortions in the shapes of galaxies caused by gravitational lensing. While gravitational lensing is caused by anything with gravity (this means normal matter as well) the lensing effect of dark matter is a key form of evidence for its presence. Image of the galaxy cluster Abell 2218 via Wikimedia Commons.

via Brian Resnick on Vox, who provides some very interesting historical context on the discovery of dark matter.