-
4. Normalized Difference Vegetation Index (NDVI)
05/30/2023 at 05:07 • 0 commentsChlorophyll is any of several related green pigments found in cyanobacteria and in the chloroplasts of algae and plants. Chlorophyll allow plants to absorb energy from light. Chlorophylls absorb light most strongly in the blue portion of the electromagnetic spectrum as well as the red portion.Conversely, it is a poor absorber of green and near-green portions of the spectrum. Hence chlorophyll-containing tissues appear green.
Normalized Difference Vegetation Index (NDVI) quantifies vegetation by measuring the difference between near-infrared (which vegetation strongly reflects) and red light (which vegetation absorbs). So, the scientists use NDVI to assess foliage health by measuring the difference between the amount of near-infrared and red light that is reflected off the foliage, using the following equation:
References:
- NDVI always ranges from -1 to +1, and healthy foliage falls within the 0.2 to 0.8 range approximately and according to this tutorial made with Arduino UNO: https://www.sensingthecity.com/interpreting-as7263-nir-spectral-sensor-readings-to-determine-plant-foliage-health-and-turn-on-an-led/
- But, if you have an NDVI value close to +1, there’s a high possibility that it’s dense green leaves. This is according this publication: https://gisgeography.com/ndvi-normalized-difference-vegetation-index/
In my case I used the range between 0.2 to 0.65, because I did tests with my sensor and I found that at values upper 0.7 some leaves were dry. so I lower the upper threshold a bit to ensure good readings.
For this tutorial, I will apply this method to a three plant’s leaves by plugging in readings from the AS7263 NIR sensor into the NDVI equation. The sensor detects wavelengths across 6 channels and puts out readings as counts per μW/cm2, which gives a measure of the amount of incident light that is being reflected at each wavelength. Two of the sensor’s channels are close to the wavelengths that are typically used in the NDVI equation. These channels are S and V, giving out readings for the 680 nm (red range) and 810 nm (near-infrared) wavelengths, respectively. Once the NDVI value is calculate, we can use an "if else" statement to signal whether the foliage is within a healthy range or not.
-
3. Getting Started
05/30/2023 at 05:02 • 0 commentsIn this chapter we learn how to setup the Raspberry Pi and how to detect the peripheral of the sensor.
Configuring the Pi
To get started with your Qwiic pHAT, simply plug it into the headers on the Raspberry Pi with the letters facing you. We'll use the Qwiic pHAT v2.0 in the following image to connect a Qwiic device.
Once the pHAT is plugged in, you can start plugging in AS7262 6-channel Visible Light Sensor.
The Raspberry Pi Configuration via Desktop GUI
You can use the Desktop GUI by heading to the Pi Start Menu > Preferences > Raspberry Pi Configuration. A window will pop up with different tabs to adjust settings. What we are interested is the Interfaces tab. Click on the tab and select Enable for I2C. Click on the OK button.
It's recommend restarting your Pi to ensure that the changes to take effect. Click on the Pi Start Menu > Preferences > Shutdown. Since we just need to restart, click on the Restart button. The system will reboot. When it comes back up, log in and enter the following command
ls /dev/*i2c*
The Pi should respond with
/dev/i2c-1
Which represents the user-mode I2C interface. There is a set of command-line utility programs that can help get an I2C interface working. You can get them with the apt package manager. Enter the following command
sudo apt-get install -y i2c-tools
In particular, the
i2cdetect
program will probe all the addresses on a bus, and report whether any devices are present. Enter the following command in the command line. The-y
flag will disable interactive mode so that you do not have to wait for confirmation. The1
indicates that we are scanning for I2C devices on I2C bus 1.i2cdetect -y 1
You will get an output from your Raspberry Pi similar to the output below.
This map indicates that there is a peripheral at address 0x49, and according to the AS7263 datasheet, device address is 49 hex.
-
2. Hardware
05/30/2023 at 04:51 • 0 commentsIn this chapter I show you the main features of Raspberry Pi 4B, Qwiic pHAT module and AS7263 sensor.
Raspberry Pi 4B
This product’s key features include a high-performance 64-bit quad-core processor, dual-display support at resolutions up to 4K via a pair of micro-HDMI ports, hardware video decode at up to 4Kp60, up to 4GB of RAM, dual-band 2.4/5.0 GHz wireless LAN, Bluetooth 5.0, Gigabit Ethernet, USB 3.0, and PoE capability (via a separate PoE HAT add-on). The dual-band wireless LAN and Bluetooth have modular compliance certification, allowing the board to be designed into end products with significantly reduced compliance testing, improving both cost and time to market.
- Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.8GHz
- 1GB, 2GB, 4GB or 8GB LPDDR4-3200 SDRAM (depending on model)
- 2.4 GHz and 5.0 GHz IEEE 802.11ac wireless, Bluetooth 5.0, BLE
- Gigabit Ethernet
- 2 USB 3.0 ports; 2 USB 2.0 ports.
- Raspberry Pi standard 40 pin GPIO header (fully backwards compatible with previous boards)
- 2 × micro-HDMI ports (up to 4kp60 supported)
- 2-lane MIPI DSI display port
- 2-lane MIPI CSI camera port
- 4-pole stereo audio and composite video port
- H.265 (4kp60 decode), H264 (1080p60 decode, 1080p30 encode)
- OpenGL ES 3.1, Vulkan 1.0
- Micro-SD card slot for loading operating system and data storage
- 5V DC via USB-C connector (minimum 3A*)
- 5V DC via GPIO header (minimum 3A*)
- Power over Ethernet (PoE) enabled (requires separate PoE HAT)
- Operating temperature: 0 – 50 degrees C ambient
AS7263 NIR Sensor
The AS7263 Near Infrared (NIR) Spectral Sensor brings spectroscopy and makes it easier to measure and characterize different materials absorb and reflect different wavelengths of light. The Sparfun AS7263 Breakout has the ability to communicate by both an I2C interface and serial interface using AT commands. Hookup is easy, thanks to the Qwiic connectors attached to the board.
The AS7263 spectrometer detects wavelengths in the visible range at 610, 680, 730, 760, 810 and 860nm of light, each with 20nm of full-width half-max detection. The board also has multiple ways for you to illuminate objects that you will try to measure for a more accurate spectroscopy reading. There is an onboard LED that has been picked out specifically for this task, as well as two pins to solder your own LED into. The I2C address of the AS7263 is 0x49 and is hardware defined.
- 6 near-IR channels: 610nm, 680nm, 730nm, 760nm, 810nm and 860nm, each with 20nm FWHM
- NIR filter set realized by silicon interference filters
- 16-bit ADC with digital access
- Programmable LED drivers
- 2.7V to 3.6V with I2C interface
Below you can see the spectral responsivity of this sensor.
SparkFun Qwiic pHAT v2.0
The SparkFun Qwiic pHAT connects the I2C bus (GND, 3.3V, SDA, and SCL) on your Raspberry Pi to an array of Qwiic connectors on the HAT. Since the Qwiic system allows for daisy-chaining boards with different addresses, you can stack as many sensors as you’d like. The Qwiic pHAT V2.0 has four Qwiic connect ports (two on its side and two vertical), all on the same I2C bus. It also add a simple 5V screw terminal to power boards that may need more than 3.3V and a general-purpose button. This pHAT is compatible with any Raspberry Pi that utilizes the standard 2x20 GPIO header.
- 4x Qwiic Connection Ports
- 1x 5V Tolerant Screw Terminal
- 1x General Purpose Button
- HAT-compatible 40-pin Female Header
-
1. Introduction
05/30/2023 at 04:27 • 0 commentsOptics
I assume you already have basic knowledge of optics. Optics is the study of light. Optics describes how light is created and how it travels. An important part of optics is the study of what happens when light hits different surfaces. When light hits a surface, it may be reflected, refracted, or absorbed.
- Reflection occurs when light hits a surface and bounces back. Reflected light makes images appear in mirrors and in other smooth, shiny surfaces.
- Refraction happens when light changes direction, or bends, when it moves from one material to another. For example, light traveling through the air refracts when it hits water. This can make a straw in a glass of water look bent at the surface of the water.
- Some surfaces absorb, or take in, light. This causes the surface to heat up. For example, a sidewalk heats up on a hot, sunny day because it is absorbing light.
Spectrophotometry
Spectrophotometry is the quantitative measurement of the interaction of ultraviolet (UV), visible, and infrared (IR) radiation with a material and has an impact on a wide field of science and technology. Spectrophotometry uses photometers, known as spectrophotometers, that can measure the intensity of a light beam at different wavelengths.
Types of spectrophotometers:
- Infrared spectrum: study and identification of chemical substances
- Ultraviolet spectrum: identification of molecules, black light.
- NMR spectrophotometer: atomic/nuclear absorption.
- Reflectance spectrophotometer: this is the spectrum used in paint and body shops to measure color (konica minolta, etc.)
- Double beam spectrophotometer.
- Single beam spectrophotometer.
A double-beam spectrophotometer compares the light intensity between two light paths, one path containing a reference sample and the other the test sample. A single-beam spectrophotometer measures the relative light intensity of the beam before and after a test sample is inserted. Although comparison measurements from double-beam instruments are easier and more stable, single-beam instruments can have a larger dynamic range and are optically simpler and more compact. Additionally, some specialized instruments, such as spectrophotometers built onto microscopes or telescopes, are single-beam instruments due to practicality.