Skip to main content

Posts

Give me a ping, Vasili!

The Linux command line has a rich set of powerful tools. Today we are looking at some examples of commands which allow us to troubleshoot networking issues. Let’s picture a situation where our network connection to the Internet has been working fine yesterday, but suddenly seems to be down or at least has become very unreliable. We also know that the IP address of our firewall/router connecting to the Internet as 192.168.0.1 and that for an arbitrary point out in the Internet, for example 8.8.8.8, the access address of the Google public DNS service. One of the first tools an experienced network administrator might reach for in such a situation is the ping utility. It allows to test the connectivity and measure delay and packet loss to any host in the network. First things first, let’s see if we can still reach the router on our local network: pi@raspberrypi ~ $ ping -c3 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. 64 bytes from 192.168.0.1: icmp_req=1 t...

Don’t bash the shell!

The first Linux command-line command which a user might encounter, would typically be bash , the default Linux command-line interpreter itself. For many newcomers, the Linux command-line interface feel dauntingly complex and often slightly inconsistent. One of the reasons for this feeling might be that there really isn’t such a thing as a single monolithic linux command-line interface: the interface which we see is the result of a relatively basic command-line interpreter shell in combination with a vast and ever growing collection of commands, which are each stand-alone executable programs installed somewhere on the filesystem. A shell is just like any other of these commands, except that one of its main purposes is to interact with the user and to execute other commands. There are several popular shells available - besides the original sh , for example also ksh , csh or tcsh - but on Linux today, bash has largely become the standard. bash is named somewhat tongue in cheek...

OwnCloud server on Raspberry Pi 3

<- Raspberry Pi as Classroom Server and Digital Pet Encouraged by the performance of running a basic wiki engine on the new Raspberry Pi 3, we can try a more resource intensive service. OwnCloud is a popular web based file-sharing solution, similar to Google drive or Dropbox. Reports of running OwnCloud on the original Raspberry Pi have generally been discouraging for performance reasons. We continue using the same lightweight web server setup from the last tutorial. Although not really recommended, we are using sqlite instead of a server based database, primarily out of simplicity and to minimize the amount of services we need to run within the tight memory constraints of the Raspberry Pi. The basic installation of the ownCloud server is as simple as downloading the desired version and moving it to a path in the web server root directory: $ sudo wget https://download.owncloud.org/community/owncloud-8.2.3.tar.bz2 $ sudo tar xvf owncloud-8.2.3.tar.bz2 $ sudo mv owncloud /v...

Raspberry Pi as Classroom Server and Digital Pet

With the new Raspberry Pi 3 just out and presumably much faster than the original, I wanted to try again how well it would hold up as a really small scale server for hosting web applications. Over the last few years, Raspberry Pi had mostly made its mark in the maker community as a small low-power embedded computer. Even the official Raspbian image is now available in a "lite" version, optimized for headless servers. It now has out of the box IPv6 as well as the avahi daemon enabled, making the changes described in this earlier tutorial no longer necessary. Installing a Raspberry Pi server is now easier than ever: copy image to a flash card , plug into any network (including direct tethering) and connect to it under its default name : ssh pi@raspberrypi.local . The hostname can easily be changed when running s udo raspi-config along with other settings (extend filesystem, change GPU memory allocation etc.). Back to the original education use-case, a Raspberry Pi is ...

Computing in Schools - the case for Open-Source

Even at the height of the digital revolution, schools all over the world seem to be struggling with what computer literacy should mean for them. The most technophile view is that everybody should learn how to program in order to take full advantage of the creative potentials of computer technology. With a focus on the digitizing of everything, another position is that everybody should at least be a competent user of computer technology, including the ability to create digital content and not just consume it. Finally, some argue that computers are starting to be mature and ubiquitous enough that they are just a tool that should fade into the background like books or blackboards. After all, there is no subject dedicated to the study of paper & pencil technology - even though K-3 students do spend a lot of time learning to master those basic writing utensils. While I agree that some level of programming or algorithmic thinking should be part of any general education, not every...

Why Open-Source Software works

Many people, specially outside the technology industry are surprised that something like open-source software could exist, specially at the scale and sophistication it quite obviously does. Many vendors of proprietary - i.e. closed-source software, have long tried to discredit open-source as either suspicious and subversive "Commie-stuff" or as hobbyist toys and playthings, not fit for serious applications. Looking at the development of human knowledge and culture throughout history, it should not be surprising that open-source software would exist and be thriving in the long run. On the contrary, closed-source software, like any idea or innovation that is kept secret essentially dies with its inventor, cannot influence new ideas and ongoing innovation and essentially becomes an evolutionary dead-end. In the short-lived word of technology, this can happen within decades rather than centuries, as historically no tech company has managed to stay dominant for more than a few d...

Lernstick

When looking for a platform to learn Linux and Python programming, Raspberry Pi would be on top of most peoples mind today. The success of the Raspberry Pi brand has created an active and novice friendly community, where help and advice is easy to find. However, just using a Raspberry Pi as a low-end desktop computer is surprisingly complex and setting up a room for a programming workshop requires a few crates of additional equipment (keyboards, mice, monitors etc.). It seems that the strength of Raspberry Pi platform is in low-cost, low-power embedded and physical computing applications, like robotics, control and measurements systems. Despite the enthusiasm for Raspberry Pi, it may not be the best choice for organizing a programming class/workshop, specially if the school already has plenty of PC hardware available. The Lernstick is a Debian live-image based distribution which can be booted off a DVD or USB stick. It is being developed by the School for Teacher Education...

Raspberry Pi Temperature Data Recorder - Part III: Visualization

<- Part II: Data Collection Once we have accumulated some data in the RRD database, we can start generating some plots with the RRDTools built-in graph function. The graph above shows the values of the DS18B20 temperature sensors over 3 unseasonably warm days in January. Because of the short cables, the sensors are not optimally placed. E.g. the inside temp sensor is relatively close to the radiator, the outside one is on the ledge, just outside the window and still behind a partially closed shutter in a narrow alley between 2 old poorly isolated buildings. According to the weather report, the current outside temperature is about 3-4 C less than what the sensor shows. From the chart, we can see that the heater feed temperature seems to fluctuate a bit, maybe a sign of  hysteresis  in the burner controller. The heater temperature is also lowered a bit for about 6h during each night, but this seems not to have any noticeable effect on the room temperature. There are smal...

Raspberry Pi Temperature Data Recorder - Part II: Data Collection

<- Part I: Hardware In the previous part of this tutorial , we looked at how to connect a few DS18B20 digital temperature sensors to a Raspberry Pi and read their values. The next part of the problem is periodically collect and record these measurements and store them for graphing and further analysis. It is always possible to store measurement data in a general purpose database e.g. SQLite or MySQL  and then plot the data for example with the Google charts API . For this project however, we are going to use RRDTool , which is a special purpose database optimized for recording, aggregating and graphing time-series data. It is particularly popular for network and system monitoring applications and for example at the base of smokeping  which we used in an earlier example . However this time, we need to configure and setup our own database from scratch. Some of the reasons why RRDTool is particularly nice for this type of application: Fixed-size, fixed-interval...

Raspberry Pi Temperature data recorder - Part I: Hardware

The Raspberry Pi seems ideal for all kinds of "physical computing" applications, as it is small, cheap, low-powered and yet more powerful and feature rich than a traditional micro-controller. One way to showcase such applications in an educational context could be to control science experiments which require long term measurements and data collection. One of the easiest measurement sensors to connect to a Raspberry Pi is the DS18B20  digital thermometer,. It can be read out via a multi-device 1-wire bus that is directly supported by a driver in the Linux kernel. Several sensors can be connected in parallel to the same data-wire and read out individually over the bus interface by their hard-coded IDs. All we need to connect one or more DS18B20 sensors to a Raspberry Pi, is to connect the VCC pin to 3.3V, GND to GND and data to GPIO4 on the Raspberry Pi GPIO header as well as connect a 4.7k Ohm resistor between the VCC and data lines of the sensor. The sensor is available...