Close

3. Getting Started

A project log for Plant Foliage Health Monitor

Spectrophotometer To Determine Normalized Difference Vegetation Index (NDVI) Built With Raspberry Pi And NIR Spectral Sensor

guillermo-perez-guillenGuillermo Perez Guillen 05/30/2023 at 05:020 Comments

In 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.

image

Once the pHAT is plugged in, you can start plugging in AS7262 6-channel Visible Light Sensor.

image

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.

image

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*

image

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

image

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. The 1 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.

image

This map indicates that there is a peripheral at address 0x49, and according to the AS7263 datasheet, device address is 49 hex.

image

Discussions