September 2022

Using a shift register to control eight digital outputs with three GPIO lines on the Raspberry Pi

A simple and inexpensive shift register can be used to increase the digital output provision of a Raspberry Pi or microcontroller. This well-know technique is easy to apply, but has some limitations that require careful consideration.

Categories: software development, C, embedded computing, Raspberry Pi

Calculus of variations: a lunchbreak guide

The calculus of variations is a branch of mathematics that deals with finding functions that optimize systems. Although calculus of variations has its origins in the 18th century, it is still not widely taught, either to science or engineering students. This brief guide intends to explain the basic principles, with a fully-worked example, in something that can be read in about an hour.

Categories: mathematics

Is dithering necessary when reducing the number of bits per sample in an audio waveform?

The use of dithering when mastering a CD is well-established, and its effectiveness is rarely challenged. But is it beneficial in other circumstances when we need to reduce the bit depth of an audio stream?

Categories: hifi, electronics

How flat-earthers use misrepresentations of scale to promote their ideas

Misrepresentations of scale are common in the literature of organizations that seek to deceive. However, it's sometimes difficult, or unhelpful, to draw diagrams to scale. This article tries to explain the difference between benign and pernicious distortions of scale. I'm picking on the flat-earthers for the purposes of illustration, but the presentational devices they use are common in business and politics as well.

Categories: science and technology, education, snake oil

Getting reasonably robust proximity measurements from an ultrasonic sensor on the Raspberry Pi

The HC-SR04 proximity sensor is an inexpensive and widely-used ultrasonic device. Connecting one to an HC-SR04 to a Raspberry Pi is a common educational exercise, but getting accurate, repeatable measurement of distance in a real application is actually quite difficult. This article explains why, and what can be done to improve matters.

Categories: software development, C, embedded computing, Raspberry Pi

Monitoring an INA219 chip in a Raspberry Pi battery-backed power supply

Many battery-backed power supplies for the Raspberry Pi, and similar systems, use the INA219 current/voltage monitor IC. This device has an I2C interface by which the Pi can determine the battery voltage and current, and estimate the charge level and run-time. This article describes how to write C code that interacts with the INA219.

Categories: software development, C, embedded computing, Raspberry Pi

Using an HD44780 LCD display module with the Raspberry Pi, from the ground up

In this article I explain how to construct, and program in C, an I2C interface to the popular HD44780 LCD display for the Raspberry Pi. Between the article and the accompanying source code, no technical details are concealed: I present the complete hardware design and every line of C code needed to operate it.

Categories: software development, C, embedded computing, Raspberry Pi

The costs and benefits of software pulse-width modulation on the Raspberry Pi

The Raspberry Pi doesn't offer much in the way of analog outputs, or even hardware controlled PWM. Software-controlled PWM is an alternative in some applications, but it needs to be used carefully, if inefficiencies are to be avoided.

Categories: software development, C, embedded computing, Raspberry Pi

Comparing a natively-compiled Java webservice with C

Implementing a webservice in C and Java, to see which performs better in terms of throughput and resource usage.

Categories: software development, Java, C

Why RMS watts is a useless measure of power

It's common for hifi amplifiers and speakers to have a power rating expressed in terms of RMS watts. Although RMS amplitude is an important concept in electronic engineering, it's meaningless here, and should be avoided.

Categories: hifi, electronics

Sorting files and directories on a FAT-formatted USB memory stick

Many portable and automotive media players accept USB memory sticks or SD cards containing audio files. Very often, these players have no sorting logic, and display files and directories in the arbitrary order they appear in the filesystem. This article describes how to sort a FAT filesystem using Linux utilities, to make playback more convenient.

Categories: hifi, Linux