Search

Smart Agriculture Application using Himax WE-I Plus EVB Endpoint AI Development Board

Smart Agriculture Application Himax WE-I Plus EVB Endpoint AI Development Board Featured Image
This application includes the use of the Himax WE-I Plus Board with SparkFun’s Qwiic sensors on farms or plantations for Machine Learning (ML) based crop detection and to simultaneously obtain PHT, CO2, VOC data required in order to monitor the proper growth of plants.

The ML model is made on a very simple, convenient yet powerful platform Edge Impulse.

Description of Components

The SparkFun Environmental Combo Breakout boards described below are used to get PHT, CO2, VOC etc. environmental data. This environment data is further transmitted by using the LoRa RYLR896 module for further analysis.

SparkFun Qwiic Environmental Combo Breakout Board – CCS811/BME280 helps determine: 

  • Total Volatile Organic Compound (TVOC) sensing from 0 to 1,187 ppb
  • eCO2 sensing from 400 to 8,192 parts per million
  • Temp Range: -40C to 85C
  • Humidity Range: 0–100% RH, =-3% from 20–80%
  • Pressure Range: 30,000Pa to 110,000Pa, relative accuracy of 12Pa, absolute accuracy of 100Pa and many more.

 

SparkFun (SparkX) Qwiic Pressure/Humidity/Temp (PHT) Sensor – MS8607 features:

  • Temp Range: -40 to 85°C
  • Humidity Range: 0 – 100%
  • Pressure Range: 10 – 2000mbar

The Himax WE-I Plus EVB Board

The Himax WE-I Plus board was chosen for its Compact Size, Ultra-low Power Application, High Resolution HM0360 AoSᵀᴹ VGA Camera and Powerful AI-based object recognition capabilities. Himax WE-I Plus board available at: https://www.sparkfun.com/products/17256

The board also features a 3-axis accelerometer, 2x microphones (L/R), 2x user LEDs (RED/GREEN), An I2C master and 3x GPIOs expansion headers and many more.

Himax WE-I LoRa SparkFun connections

Make the Hardware connections between the Himax WE-I Plus and the SparkFun Environmental Combo Board as shown in the image. Connections the will be same for the MS8607 sensor board.

Red  3.3V  J3 Pin 1
Yellow SCL J3 Pin 5
Blue  SDA J3 Pin 6
Black GND J3 Pin 7

And between the Himax WE-I Plus and LoRa as

Orange  3.3V  J3 Pin 1
Green WEI TXD \ LoRa RXD J3 Pin 2
Red WEI RXD \ LoRa TXD J3 Pin 3
Black GND J3 Pin 7

LoRa models used here are REYAX RYLR896 [LoRa AT command guide] 

Setting up the Prerequisites

First of all download/clone and extract the application GitHub Repository from: https://github.com/HimaxWiseEyePlus/WE_I_Plus_User_Examples/tree/main/SmartAgriculture-example

This will be your main work directory for this application.

Himax WE-I Plus Main Work Directory

You’ll notice that a ‘settings.h’ file exists in which we can set exactly which sensor board we are using i.e. either SparkFun Qwiic Environmental Combo Breakout Board – CCS811/BME280 or SparkFun (SparkX) Qwiic Pressure/Humidity/Temp (PHT) Sensor – MS8607.

Next, Docker is required to compile the custom made application model.

A flash tool is also required to burn the generated .img file to the board for which you can use:

The application output can also be viewed here by the HIMAX WE1 EVB Debug UART port.

  • Using Edge-Impulse-CLI Himax flash tool –  This tool comes with Edge-Impulse-CLI and just a firmware path needs to be mentioned. The Edge-Impulse-CLI also includes an Impulse runner for a studio built library and a Data forwarder for numeric output.

 

Note: To deploy the Already Compiled Application (for CCS811/BME280 sensor board) skip directly to the Flash Image section. However, to achieve greater accuracy, it is recommended to follow the complete procedure.

ML Model on Edge Impulse

Refer the Getting Started with Himax WE-I Plus EVB Endpoint AI Development Board article to set up Edge-Impulse and to connect the Himax WE-I Plus board.

Himax WE-I Plus Edge Impulse Dashboard

Step 1.1: Data Acquisition

In the data acquisition step, either you can record new data using the board or use an existing database for the model. Here, we used an agriculture crop images dataset from https://www.kaggle.com/aman2000jaiswal/agriculture-crop-images?select=kag2

Edge Impulse Data Aquisition

Edge Impulse Wheat

Edge Impulse Sugarcane Edge Impulse Maize

Step 1.2: Impulse design for Himax WE-I Plus EVB Board

This should be the impulse design

Edge Impulse Impulse Design

Input Image data

  • Image width = 96
  • Image height = 96
  • Resize mode = Squash

Output features

  • 3 (Maize, Sugarcane, Wheat)

Make sure you choose grayscale color depth in the impulse design image tab.

Himax WE-I Plus Edge Impulse Image

Complete generate features and transfer learning tabs

Himax WE-I Plus Edge Impulse Transfer Learning

Himax WE-I Plus Edge Impulse Transfer Learning model

You can also perform live classification and check the model before deployment.

Step 1.3: Deploy the model

In the deployment section, Select the Quantized(int8) C++ library using EON™ Compiler. Click Build.

Himax WE-I Plus Edge Impulse Deployment

Himax WE-I Plus Edge Impulse Deployment EON

This will download a zip file. Extract and copy these files in the main work directory. Make sure you do not copy the CMakeLists.txt

The main work directory should now look like this:

Himax_WE-I_Plus_final_folder_structure

Docker Build

Open a terminal window in the main work directory and run the following Docker commands.

sudo docker build -t himax-build-gnu -f Dockerfile.gnu .
mkdir -p build-gnu

sudo docker run –rm -it -v $PWD:/app himax-build-gnu /bin/bash -c “cd build-gnu && cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.gnu.cmake ..”

sudo docker run –rm -it -v $PWD:/app:delegated himax-build-gnu /bin/bash -c “cd build-gnu && make -j && sh ../make-image.sh GNU”

Please run these commands line by line.

This process may take some time for the first run.

Himax WE-I Plus Docker Build 1

Himax WE-I Plus Docker Build 2

The Generate Image Done message at the end marks the completion of the process.

Note: To built for another sensor board, make corresponding changes in ‘settings.h’ file and follow from this step again. 

Flash Image to Himax WE-I Plus Board

The file in .img format that needs to be flashed to the board will be stored in image_gen_linux folder as out.img

Himax WE-I Plus flash image_gen_linux

The last step is to flash this .img file for which you can use any flash tool described in the prerequisites section.

Here, we used the himax-flash-tool on edge-impulse-cli as it was installed on the Windows OS.

Himax WE-I Plus flash himax-flash-tool

Output of Application

The output as seen on TeraTerm software by listening to the serial port.

  • L.H.S – Sender (Himax WE-I Plus Board)
  • R.H.S – LoRa Receiver
  • LoRa Sender module (connected to Himax WE-I Plus Board) has Address = 1
  • LoRa Receiver module has Address = 2

With SparkFun Qwiic Environmental Combo Breakout Board – CCS811/BME280 :

The format of Receiver data is Co2 Value|Temperature|Humidity|Pressure

Here the [maize] crop is seen to be accurately detected.

Himax WE-I Plus output_CCS811

With SparkFun (SparkX) Qwiic Pressure/Humidity/Temp (PHT) Sensor – MS8607 :

The format of Receiver data is Co2 Value(always 0000)|Temperature|Humidity|Pressure

The PHT data is obtained

Himax WE-I Plus output_MS8607

Video demonstrating the application:


Thus, creating a Smart Agriculture Application using Himax WE-I Plus which obtains farm environment data from sensor boards for agricultural analysis. The ML model used in this application is for basic crop detection. The same can be extended to weed detection or to perform certain tasks or agricultural activities with combined input from Environmental sensors.

Check out some more interesting applications using Himax WE-I Plus EVB Endpoint AI Development Board here.

Leave a Reply

Discover more from Open Cloudware

Subscribe now to keep reading and get access to the full archive.

Continue reading