Posts in Engineering
Solar Panel Characterization and Experiments with Arduino

In this tutorial, the aim is to characterize a solar panel by varying the load at (near) peak solar insolation to identify the panel's nominal values such as open-circuit voltage, short-circuit current, max power voltage and current, and max power output. These values help users understand the expectations from a photovoltaic array and how their power needs may be met with a given PV system. An Arduino board will be used to log the current and voltage values outputted from a small solar panel. The current and voltage are measured using a 16-bit analog-to-digital converter power module, the INA226, which will allow us to track the power outputted from the photovoltaic panel. A potentiometer acting as a rheostat will serve as the varying load on the system, which will be used to identify the peak power points of the system. Finally, analyses will be conducted in Python 3, which will allow us to identify the peak power region and also the total power outputted over a duration of 24 hours.

Read More
PCB Design and Fabrication with NextPCB

The printed circuit board (PCB) is at the center of nearly all electronics products in the 20th century. PCBs originally consisted of wires placed along paths connecting a series of components on a rigid board — these were deemed printed wiring boards. Eventually, the printed wiring board morphed into the circuit boards with conducting strips etched into multi-layer boards that we see on PCBs today. The PCB industry is associated with nearly $1 trillion in sales of electronics each year [read more at: "Printed circuit board industry"]. Thus, it is important for engineers to know at least the basics of PCB design, even if the manufacturing is outsourced to companies. In this tutorial, we will introduce the design of a simple PCB and the process required to get the PCB manufactured by a company called NextPCB. Their process is simple and easy, and even allows the engineer to view their design on their online gerber file viewer.

Read More
Water Metering with the WaWiCo USB Kit and Raspberry Pi

For this project, we will be comparing the WaWiCo sensor with a conventional hall-effect mechanical flow meter. The WaWiCo sensor introduces a novel method for water metering, with non-invasive acoustic analysis. The benefit of the WaWiCo method is evident during the mechanical flow meter analysis, where we need to match pipe diameters and fittings and ensure that the flow terminates at a point. Otherwise, mechanical meters require cutting in piping — which is not an option for many users. Using a Raspberry Pi computer and a WaWiCo USB water meter kit, the frequency content of water flow for a given pipe is analyzed. Additionally, this frequency response will be used to correlate to the flow rate (in L/s) approximated by the mechanical flow meter. This brings us one step closer to being able to non-invasively measure water flow using the WaWiCo method.

Read More
Listening to Your Pipes with a MEMS Microphone and Raspberry Pi

A new type of water meter produced by Water Wise Controls (WaWiCo) introduces a novel method for water metering: non-invasive acoustic analysis. Their USB water metering kit allows users to listen to their pipes without the need for plumbing work. In this tutorial, the acoustic profile of a piping system will be explored using a Raspberry Pi computer, the Python programming language, and a WaWiCo USB water meter kit. The resulting analysis will allow users to identify the acoustic profile of their piping system and determine when water is flowing. This is the first of a series of entries into non-invasive water metering from WaWiCo, where open-source technologies will be used to characterize a piping system based on the acoustic profile of a user's home or apartment.

Read More
Raspberry Pi Stepper Motor Control with NEMA 17

The NEMA 17 is a widely used class of stepper motor used in 3D printers, CNC machines, linear actuators, and other precision engineering applications where accuracy and stability are essential. The NEMA-17HS4023 is introduced here, which is a version of the NEMA 17 that has dimensions 42mm x 42mm x 23mm (Length x Width x Height). In this tutorial, the stepper motor is controlled by a DRV8825 driver wired to a Raspberry Pi 4 computer. The Raspberry Pi uses Python to control the motor using an open-source motor library. The wiring and interfacing between the NEMA 17 and Raspberry Pi is given, with an emphasis on the basics of stepper motors. The DRV8825 control parameters in the Python stepper library are broken down to educate users on how the varying of each parameter impacts the behavior of the NEMA 17. Simple characteristics of stepper control are explored: stepper directivity (clockwise and counterclockwise), step incrementing (full step, half step, micro-stepping, etc.), and step delay.

Read More
Distance Detection with the TF-Luna LiDAR and Raspberry Pi

The TF-Luna is an 850nm Light Detection And Ranging (LiDAR) module developed by Benewake that uses the time-of-flight (ToF) principle to detect objects within the field of view of the sensor. The TF-Luna is capable of measuring objects 20cm - 8m away, depending on the ambient light conditions and surface reflectivity of the object(s) being measured. A vertical cavity surface emitting laser (VCSEL) is at the center of the TF-Luna, which is categorized as a Class 1 laser, making it very safe for nearly all applications [read about laser classification here]. The TF-Luna has a selectable sample rate from 1Hz - 250Hz, making it ideal for more rapid distance detection scenarios. In this tutorial, the TF-Luna is wired to a Raspberry Pi 4 computer via the mini UART serial port and powered using the 5V pin. Python will be used to configure and test the LiDAR module, with specific examples and use cases.

Read More
Thermal Camera Analysis with Raspberry Pi (AMG8833)

The AMG8833 infrared thermopile array is a 64-pixel (8x8) detector that approximates temperature from radiative bodies. The module is wired to a Raspberry Pi 4 computer and communicates over the I2C bus at 400kHz to send temperature from all 64 pixels at a selectable rate of 1-10 samples per second. The temperature approximation is outputted at a resolution of 0.25°C over a range of 0°C to 80°C. A real-time infrared camera (IR camera) was introduced as a way of monitoring temperature for applications in person counting, heat transfer of electronics, indoor comfort monitoring, industrial non-contact temperature measurement, and other applications where multi-point temperature monitoring may be useful. The approximate error of the sensor over its operable range is 2.5°C, making is particularly useful for applications with larger temperature fluctuations. This tutorial is meant as the first in a series of heat transfer analyses in electronics thermal management using the AMG8833.

Read More
Calibration of a Magnetometer with Raspberry Pi

In this tutorial, methods for calibrating a magnetometer aboard the MPU9250 is explored using our Calibration Block. The magnetometer is calibrated by rotating the IMU 360° around each axis and calculating offsets for hard iron effects. Python is again used as the coding language on the Raspberry Pi computer in order to communicate and record data from the IMU via the I2C bus. The second half of this tutorial gives a full calibration routine for the IMU's accelerometer, gyroscope, and magnetometer. The final implementation will allow for moderate (first-order) calibration of the MPU9250 under reasonable conditions, requiring only the calibration block and IMU. Finally, the complete final code will save the coefficients for each sensor for future use in direct applications without the need for constant calibration. The use of the calibration coefficients will allow for improved estimates of orientation, displacement, vibration, and other relevant control and measurement analyses.

Read More
Gyroscope and Accelerometer Calibration with Raspberry Pi

This is the second entry into the series entitled "Calibration of an Inertial Measurement Unit (IMU) with Raspberry Pi" where the gyroscope and accelerometer are calibrated using our Calibration Block. Python is used as the coding language on the Raspberry Pi to find the calibration coefficients for the two sensors. Validation methods are also used to integrate the IMU variables to test the calibration of each sensor. The gyroscope shows a fairly accurate response when calibrated and integrated, and found to be within a degree of the actual rotation test. The accelerometer was slightly less accurate, likely due to the double integration required to approximate displacement and the unbalanced table upon which the IMU was calibrated. Filtering methods are also introduced to smooth the accelerometer data for integration. The final sensor, the magnetometer (AK8963), will be calibration in the next iteration of this series.

Read More
Calibration of an Inertial Measurement Unit (IMU) with Raspberry Pi - Part I

Inertial measurement units (IMUs) can consist of a single sensor or collection of sensors that capture data meant to measure inertial movements in a given reference frame. Acceleration, speed of rotation, and magnetic field strength are examples of sensors contained in an IMU. IMUs can be found in applications ranging smart devices, medical rehabilitation, general robotics, manufacturing control, aviation and navigation, sports learning, and augmented and virtual reality systems. Inertial measurement units have become increasingly popular as their form factors shrink and computational power increases. The ability to use IMUs for indoor/outdoor tracking, motion detection, force estimation, orientation detection, among others has caused the use and availability of inertial sensors to become nearly widespread in smart phones, smart watches, drones, and other common electronic devices. The internet is full of projects involving accelerometers, gyroscopes, and magnetometers, but few cover the full calibration of all three sensors. In this project, the manual calibration of a nine degree-of-freedom (9-DoF) IMU is explored. A common MPU9250 IMU is attached to a cube to manually find the calibration coefficients of the three sensors contained within the IMU: accelerometer, gyroscope, and magnetometer. The IMU is wired to a Raspberry Pi - which will allow for high-speed data acquisition rates of all nine components of the IMU.

Read More
Recording Stereo Audio on a Raspberry Pi

The INMP441 MEMS microphone is used to record audio using a Raspberry Pi board through the inter-IC sound (I2S or I2S) bus. The I2S standard uses three wires to record data, keep track of timing (clock), and determine whether an input/output is in the left channel or right channel. First, the Raspberry Pi (RPi) needs to be prepped for I2S communication by creating/enabling an audio port in the RPi OS system. This audio port will then be used to communicate with MEMS microphones and consequently record stereo audio (one left channel, one right channel). Python iS then used to record the 2-channel audio via the pyaudio Python audio library. Finally, the audio data will be visualized and analyzed in Python with simple digital signal processing methods that include Fast Fourier Transforms (FFTs), noise subtraction, and frequency spectrum peak detection.

Read More
Arduino Venturi Flow Meter

A venturi meters, sometimes referred to as venturi tube, is a flow measurement device that takes advantage of the conservation of mass and flow continuity between three separate sections within a pipe: the inlet, throat, and diffuser (outlet). Differential pressure sensors measure the pressure drop between the inlet and throat and relate it to the volumetric flow rate. The geometry of the venturi meter, along with some empirical characteristics of the flow regime, allow for very accurate quantification of flow rate. The experiment conducted here uses a 3D printed venturi meter to test an 80mm 12V DC fan across different flow rates. Pulse-width modulation (PWM) is used to control the fan's rotation speed, which creates a range of velocities through the venturi meter. The MPXV7002DP differential pressure sensor measures the pressure drop between the throat and inlet, while a BME280 measures the barometric pressure and ambient temperature.

Read More
Capacitive Soil Moisture Sensor Calibration with Arduino

Soil moisture can be measured using a variety of different techniques: gravimetric, nuclear, electromagnetic, tensiometric, hygrometric, among others. The technique explored here uses a gravimetric technique to calibrate a capacitive-type electromagnetic soil moisture sensor. Capacitive soil moisture sensors exploit the dielectric contrast between water and soil, where dry soils have a relative permittivity between 2-6 and water has a value of roughly 80. Accurate measurement of soil water content is essential for applications in agronomy and botany - where the under- and over-watering of soil can result in ineffective or wasted resources. With water occupying up to 60% of certain soils by volume, depending on the specific porosity of the soil, calibration must be carried out in every environment to ensure accurate prediction of water content. Luckily, the accuracy of measurement devices has been increasing while the cost of the sensors have been decreasing. In this experiment, an Arduino board will be used to read the analog signal from the capacitive sensor, which will output voltage values which can be calibrated to volumetric soil moisture content via gravimetric methods.

Read More
High Resolution Thermal Camera with Raspberry Pi and MLX90640

Thermal cameras are similar to standard cameras in that they use light to record images. The most significant distinction is that thermal cameras detect and filter light such that only the infrared region of the electromagnetic spectrum is recorded, not the visible region [read more about infrared cameras here]. Shortly after the discovery of the relationship between radiation and the heat given off by black bodies, infrared detectors were patented as a way to predict temperature via non-contact instrumentation. In recent decades, as integrated circuits shrink in size, infrared detectors have become commonplace in applications of non-destructive testing, medical device technology, and motion detection of heated bodies. The sensor used here is the MLX90640 [datasheet], which is a 768 pixel (24x32) thermal camera. It uses an array of infrared detectors (and likely filters) to detect the radiation given off by objects. Along with a Raspberry Pi computer, the MLX90640 will be used to map and record fairly high-resolution temeperature maps. Using Python, we will be able to push the RPI to its limits by interpolating the MLX90640 to create a 3 frame-per-second (fps) thermal camera at 240x320 pixel resolution.

Read More
MPS20N0040D Pressure Sensor Calibration with Arduino

Pressure is defined as an evenly distributed force acting over a surface with a given area. The accurate measurement of pressure is essential for applications ranging from material testing to weighing scales, aircraft altitude prediction, and evaluating biological functions in humans relating to respiration and blood flow In this tutorial, a digital pressure transducer and analog pressure manometer will be used to measure gauge pressure - where the analog manometer is used as the calibration tool for the digital pressure sensor. Arduino will be used to read the digital pressure transducer, an MPS20N0040D, and a 3D printed manometer will be used to measure analog pressure manually.

Read More
Force Sensitive Resistors (FSRs) with Arduino

A force sensitive resistor (FSR) is comprised of a conductive polymer material pressed between two electrode layers, giving it the ability to electrically respond to changes in stress and strain. FSRs are often used in ergonomic or rehabilitation applications where pressure is applied from human interaction and the response is recorded or translated. Force sensitive resistors are incredibly useful for human interactivity because of their slim profile, inexpensive construction, and multiplicative geometries. The sensor used in this tutorial is the RP-S40-ST, which is a 40mm x 40mm thin film FSR. An Arduino board will be used to read the analog signals outputted by the FSR in a voltage divider configuration, where the force applied to the FSR can be approximated using the sensor’s calibration curve.

Read More
Radar Emulator with Arduino + Python

In this tutorial, an ultrasonic sensor (HC-SR04) will be used in place of a radio emitter; and a plan position indicator will be constructed in Python by recording the angular movements of a servo motor. An Arduino board will both record the ranging data from the ultrasonic sensor while also controlling and outputting the angular position of the servo motor. This will permit the creation of a PPI for visualizing the position of various objects surrounding the radar system.

Read More
Accelerometer, Gyroscope, and Magnetometer Analysis with Raspberry Pi Part I: Basic Readings

A Raspberry Pi will be used to read the MPU9250 3-axis acceleration, 3-axis angular rotation speed, and 3-axis magnetic flux (MPU9250 product page can be found here). The output and limitations of the MPU9250 will be explored, which will help define the limitations of applications for each sensor. This is only the first entry into the MPU9250 IMU series, where in the breadth of the articles we will apply advanced techniques in Python to analyze each of the 9-axes of the IMU and develop real-world applications for the sensor, which may be useful to engineers interested in vibration analysis, navigation, vehicle control, and many other areas.

Read More
Arduino LoRa Network Part I: Radio Basics and Range Tests

LoRa modules, such as the SX1276 used in this tutorial, are widely available and relatively inexpensive, all while being fully compatible with Arduino. LoRa modules are also modular in software and hardware: transmission power is configurable, the modules can be outfitted with antennae, and transmission speed and packet information size are both modifiable. In this tutorial, an Arduino board and SX1276 modules will be used to create a network of long range (LoRa) nodes designed to communicate and transport information. The use of antennae will also help broaden the range of the nodes, and tests in New York City will help quantify the efficiency and cone of functionality for such a node in a complex environment.

Read More