I’m excited to introduce my latest project, Garden Robot. This compact robotic system is designed to autonomously navigate around the garden and detect slugs using computer vision. Upon detection, it precisely sprays an organic garlic-based solution to prevent them from reaching and damaging plants.
The robot is built using a Raspberry Pi 5 as the primary processor, alongside an Arduino Nano 33 BLE Sense as a secondary controller for sensor integration and real-time responsiveness. The vision model was developed and trained using Edge Impulse, enabling efficient and accurate on-device detection.
This project combines robotics, embedded systems, and AI to create a practical, eco-friendly solution for garden pest management.
This project employs a Raspberry Pi 5 as the primary controller for slug detection, with an Arduino Nano 33 BLE Sense serving as the secondary controller responsible for robot control operations.
Edge Impulse was utilised to train the object detection model, which was subsequently exported and deployed to the Raspberry Pi 5 as an EIM (Edge Impulse Model) for real-time inference.
For deploying the vision trained model into Raspberry Pi5, we need to follow the below steps.
Steps1. Getting Started with Raspberry Pi5
2. Device connection
3. Model Training in Edge Impulse
4. Hardware deployment
5. Running the trained Eim model in raspberry Pi
Getting started with Raspberry Pi5Follow the same steps mentioned in below link for setting up the raspberry Pi5
Device connectionOnce you set up the raspberry Pi Os, Use Raspberry Pi connection connect
to take remote of your device.
Open the terminal in raspberry Pi and run the below command to connect your edge Impulse account.
edge-impulse-linux
Once the device is connected, navigate to the Data Acquisition section.
This project requires two distinct datasets for model training — one comprising images of slugs on grass and another consisting of plain grass field images without any slugs, ensuring improved detection accuracy.
Plain grass fields with no label
Please make sure that the dataset ratio is 80:20 for training and validation.
In Create Impulse section, select the learning block as 'Object detection'
Then generate the features and visualise to get high level overview
In the NN settings, configure the training cycles as 100 and learning rate as 0.1.
I have chosen mobileNetV2 SSD FPN-Lite pre trained model.
The model can able to detect the slug from new datasets, but in some cases it detects more than one bounding box for single Slug, It is more than sufficient for our use cases.
After successfully verifying the trained model, deploy it back to the Raspberry Pi5.
Select the Linux (x86) ( EIM) as deployment.
In our project, We need to run the application to control the robot and indicate the robot to spray "garlic water solution " on the grass.
Run this command to download the project and entire SDK in raspberry Pi.
edge-impulse-linux-runner
It will download the python SDK and you can clone it from the below link as well
you can keep the downloaded Eim file in this location in Raspberry Pi5
To add the application over the Object detection model, You have to follow the below steps:
Open the terminal and run the below commands.
sudo apt-get install libatlas-base-dev libportaudio2 libportaudiocpp0 portaudio19-dev
pip3 install edge_impulse_linuxThis will take few hours to install.
Clone this repository to get the examples:
git clone https://github.com/edgeimpulse/linux-sdk-pythonThen download the Edge Impulse model file.
edge-impulse-linux-runner --download modelfile.eimIf the modelfile.eim is downloaded in the desktop location in your Raspberry Pi. Open the terminal, Root back to the -> linux-sdk-python/examples/image
and run the below command to run the model.
python3 -m venv ei
source ei/bin/activate
python3 classify.py /home/username/Desktop/modelfile.eim 0Note: Replace the username with your username of the Raspberry Pi.
Then you will get an output like this.
On top of the existing Classify.py, I have modified to include GPIO controls, The GPIO pins will be used to communicate to Arduino Nano for stopping the Garden rover and actuating the "Garlic solution " spray
In the next version, The prototype will have the Qualcomm Rubik Pi as a single controller.
ConclusionThis Object detection model using Edge Impulse tool, automates the slug detection and prevent it from damaging the plants. In agriculture, there are N number of use cases where we can use Vision based ML to improve efficiency.











Comments