Posts in Programming
Infrared Thermometry Theory and Applications with Arduino and Python

In this tutorial, I will explore black body radiation, infrared detectors, and the relationship between temperature and emissivity - all with the intention of exploring how infrared (IR) detectors measure temperature from a distance. Arduino will be used, along with an MLX90614 IR thermometer, and a thermocouple for true-temperature approximation of each object. Planck’s discovery of energy quanta and their relationship to thermodynamics is the basis for radiation detectors and infrared temperature sensors. We will use Planck’s law to derive a usable equation that can relate the radiation measured by an infrared sensor to the temperature of a radiative object.

Read More
Satellite Imagery Analysis in Python Part III: Land Surface Temperature and The National Land Cover Database (NLCD)

The third entry of the satellite imagery analysis in Python uses land surface temperature (LST) as the data variable along with land cover information from the national (U.S.) database. The land cover information will allow us to create a relationship between land cover type and its respective heating (or cooling) contribution to the earth’s surface. Land cover is used in many applications ranging from algorithm development to military applications and crop surveying, not to mention applications in water management and drought awareness.

Read More
Satellite Imagery Analysis in Python Part II: GOES-16 Land Surface Temperature (LST) Manipulation

For part II, the focus shifts from the introduction of file formats and libraries to the geospatial analysis of satellite images. Python will again be used, along with many of its libraries. Land Surface Temperature will again be used as the data information, along with shapefiles used for geometric boundary setting, as well as information about buildings and land cover produced by local governments - all of which are used in meteorological and weather research and analyses.

Read More
MATLAB Datalogger with Arduino

In this tutorial, MATLAB is introduced as an interface for data acquisition with an Arduino board. The Arduino, in this particular case, will communicate with a Windows computer via the serial port and send data from an Arduino-compatible sensor, which will subsequently be read by MATLAB through its serial communication library. Serial communication from hardware to MATLAB is very simple and requires only a few lines of code. I will also introduce a real-time analysis and plotting routine to visualize the Arduino data as it arrives in real time. This particular method of data analysis and visualization in real time is incredibly useful for engineers interested in experimentation where microcontrollers and sensors may be used, along with complex data acquisition systems.

Read More
Satellite Imagery Analysis in Python Part I: GOES-16 Data, netCDF Files, and The Basemap Toolkit

In this tutorial series, Python’s Basemap toolkit and several other libraries are utilized to explore the publicly-available Geostationary Operational Environmental Satellite-16 (GOES-16). In this first entry, the following will be introduced: acquisition of satellite data, understanding of satellite data files, mapping of geographic information in Python, and plotting satellite land surface temperature (LST) on a map.

Read More
Arduino Heart Rate Monitor Using MAX30102 and Pulse Oximetry

Pulse oximetry monitors the oxygen saturation in blood by measuring the magnitude of reflected red and infrared light [read more about pulse oximetry here and here]. Pulse oximeteters can also approximate heart rate by analyzing the time series response of the reflected red and infrared light . The MAX30102 pulse oximeter is an Arduino-compatible and inexpensive sensor that permits calculation of heart rate using the method described above. In this tutorial, the MAX30102 sensor will be introduced along with several in-depth analyses of the red and infrared reflection data that will be used to calculate parameters such as heart rate and oxygen saturation in blood.

Read More
SAMD21 M0 Mini Arduino Board

In this tutorial, the SAMD21 M0 Mini is introduced, which is a variation of the Arduino Zero (SAMD21 48MHz). The SAMD21 board will be tested specifically in its speed and compatibility with several Arduino libraries. Particularly, the SAMD21 is the most powerful when harnessing its speed, but also in other areas such as analog to digital conversion. The SAMD21 core is a 32-bit microcontroller that will likely replace the traditional ATmega328 (8-bit microcontroller) over time. The SAMD21 core boasts 48MHz clock speeds in contrast to the 20MHz ATmega boards, while also being fully-compatible with many of the capabilities of the Arduino platform.

Read More
WeMos D1 Mini ESP8266 Arduino WiFi Board

The WeMos D1 Mini is an inexpensive ESP8266-based WiFi board that is low-profile but just as powerful as any NodeMCU or ESP8266-based microcontroller. The D1 Mini is incredibly versatile because it is inexpensive, WiFi-enabled, and fully compatible with the Arduino platform. In this tutorial, the ESP8266 library and board manager will be introduced in order to get the D1 Mini acting as an Arduino board. Then, a simple web page will be introduced with the intention of harnessing the WiFi capabilities of the module. The D1 Mini will act as a web server, allowing any WiFi-connected device to interact with the board and control its pins wirelessly.

Read More
Multiple Object Detection with Python and Raspberry Pi

The picamera and edge detection routines will be used to identify individual objects, predict each object’s color, and approximate each object’s orientation (rotation). By the end of the tutorial, the user will be capable of dividing an image into multiple objects, determining the rotation of the object, and drawing a box around the subsequent object.

Read More
Image Processing Object Detection with Raspberry Pi and Python

In this entry, image processing-specific Python toolboxes are explored and applied to object detection to create algorithms that identify multiple objects and approximate their location in the frame using the picamera and Raspberry Pi. The methods used in this tutorial cover edge detection algorithms as well as some simple machine learning algorithms that allow us to identify individual objects in a frame.

Read More
Image Processing with Raspberry Pi and Python

The Raspberry Pi has a dedicated camera input port that allows users to record HD video and high-resolution photos. Using Python and specific libraries written for the Pi, users can create tools that take photos and video, and analyze them in real-time or save them for later processing. In this tutorial, I will use the 5MP picamera v1.3 to take photos and analyze them with Python and an Pi Zero W. This creates a self-contained system that could work as an item identification tool, security system, or other image processing application. The goal is to establish the basics of recording video and images onto the Pi, and using Python and statistics to analyze those images.

Read More
Arduino SD Card Module Data Logger

This tutorial will explore the range of capabilities available to the Arduino SD library by using a real-world example of data logging. The SD library allows users to read/write, list files, create/remove files, and make/delete directories. Additionally, we will develop an algorithm that creates a new file every time the Arduino board is restarted, which will prevent overwriting of existing data records. The resulting data file will be in comma separated format and contain multiple data points, including a time stamp in milliseconds since the program started. Therefore, it is important to record the program start time. For very accurate time monitoring tasks, a real-time clock is recommended, however, for the experiments conducted here, relative time suffices.

Read More
Arduino Uno R3 vs CH340

The CH340 Arduino board contains an ATmega328P-U-TH chip, which differs from the classic ATmega328P-PU in official Arduino Uno Rev3 boards. The CH340 is an inexpensive USB-to-Serial chip (datasheet here) that takes the place of the Rev3 board’s more expensive ATmega16U2. This creates issues when programming the Arduino board with certain operating systems (specifically Windows), however, for most Linux and Mac systems - there appears to be no issue. In this tutorial, I will explore the CH340 Arduino board to see whether there are differences in performance and power under different operating conditions. This will definitively answer whether the CH340 is a worthy alternative to the Rev3 or if it’s just a cheap imposter.

Read More
Controlling LEDs with A Multiplexer and Arduino

A demultiplexer will be used to control 8 LEDs using just 3 digital pins on the Arduino board. This method of demultiplexing frees up pins on the Arduino, but also makes control of multiple LEDs easier by consolidating the power given to each LED. This will allow us to use LEDs without resistors. In general, a demultiplexer uses N boolean outputs to control 2N switches. In our case, the CD4051 multiplexer will be used as a demultiplexer using 3 digital pins and boolean logic to control 8 individual LEDs. Several skills will also be developed, specifically with regard to programming in the Arduino programming language. Pulse-width modulation (or brightening and dimming) of LEDs will be explored, as well as randomization of LED blinks, along with the general selection process for boolean switching with the demultiplexer.

Read More
Raspberry Pi Vibration Analysis Experiment With a Free-Free Bar

Using the Euler-Bernoulli beam theory, the resonant frequencies of a beam will be measured using a thin film piezoelectric transducer and compared to the theoretical calculations. A Raspberry Pi will be used along with a high-frequency data acquisition system (Behringer UCA202, sample rate: 44.1kHz) and the Python programming language for analysis. The fast fourier transform will allow us to translate the subtle beam deflections into meaningful frequency content. This tutorial is meant to introduce Python and Raspberry Pi as formidable tools for vibration analysis by using measurements as validation against theory.

Read More
Loudspeaker Analysis and Experiments: Part II

Part II of the tutorial series on loudspeaker analysis and experiments. The majority of this entry focuses on finding Thiele-Small parameters to fully characterize an electrodynamic loudspeaker in free air.

Read More
Loudspeaker Analysis and Experiments: Part I

In this tutorial, a loudspeaker will be analyzed by calculating the Thiele-Small parameters from impedance measurements using an inexpensive USB data acquisition system (minimum sampling rate of 44.1 kHz). The methods used in this project will educate the user on multiple engineering topics ranging from: data acquisition, electronics, acoustics, signal processing, and computer programming.

Read More
Arduino Pitot Tube Wind Speed and Airspeed Indicator - Theory and Experiments

The pitot tube is a device used to approximate the speed of vehicles traveling by air and water. An in-depth article on NASA's website is dedicated to pitot tubes (also called pitot-static tubes, Prandtl tubes), where it cites the primary application as airspeed indicator on aircraft. For more information on design and limitations of the instrument, I recommend perusing that page. For this tutorial, only the basic theory is explored using Bernoulli's equation and a practical application. An inexpensive pitot tube and a digital differential pressure sensor are used to measure pressure, which is converted to a digital signal using an Arduino board.

Read More
Arduino Thermistor Theory, Calibration, and Experiment

Thermistor, whose name is derived from a combination of thermal and resistor, is a temperature sensing device that registers changes in internal resistance as a function of temperature. Thermistors are often chosen over thermocouples because they are more accurate, have a shorter response time, and are generally cheaper. For most applications, thermistors are the smart and easy selection for temperature sensing below 300 degrees Celsius. In our case, we will be using a Negative Temperature Coefficient (NTC) thermistor, where the resistance decreases as the temperature increases. NTC thermistors are most common in commercial products that operate in the tens of degrees like thermostats, toasters, and even 3-D printers. An NTC 3950 100k thermistor will be used, which is designed for 100kOhm resistance at 25 degrees Celsius. This tutorial will introduce methods for relating resistance to temperature by fitting factory calibration data. The performance of the thermistor will also be evaluated using an Arduino board and a simple Newton’s law of cooling experiment.

Read More
NodeMCU Tutorial Series Part II: NodeMCU Server Control Over Local Area Network

This tutorial takes full advantage of the ESP8266 WiFi chip by serving a local webpage to control the general purpose input and output (GPIO) pins on a NodeMCU microcontroller. Some basic HTML and CSS programming methods will be utilized to create a stylish webpage that is both asynchronous (AJAX) and input-driven - this will give the user the ability to control the pins on the microcontroller. For the current example, an electromagnet and LED will be controlled using pulse width modulation (PWM) and simple high/low logic, respectively. The PWM control allows the user to change the voltage to the component, altering the magnetic field of the electromagnet. For the LED, the traditional digitalWrite() method will turn the LED on and off.

Read More