AgriArmBot is an advanced agricultural robot designed for remote control and real-time monitoring. Featuring a live camera for navigation and a versatile robotic arm, it can perform tasks such as testing soil moisture, measuring ambient humidity and temperature, and executing precise actions like plucking saplings or conducting inspections. This robot allows farmers to manage and monitor their fields remotely, even in challenging conditions like rain or nighttime, providing an additional layer of convenience and efficiency.
Planning
I started with a rough sketch of the idea, then selected the right components and budget, using open-source resources where possible.
Mechanical Arm
Purchased an Acrylic Robot Manipulator Mechanical Arm and assembled it with the necessary components and assembled it.
3D Print Chain Mechanism
For the chain mechanism, I utilized a 3D printing. I sourced an open-source design from the internet that fit the dimensions of my project. The chain mechanism was chosen for its superior traction on agricultural field surfaces.
Assembly
Assembled the 3D-printed parts and made its base plate to secure them using screws.
The arm was fixed with servos, and the screws were securely locked in place.
ESP32 Camera
1. Wi-Fi Module to Motor Driver:
- GPIO Pins -> Motor Driver IN1, IN2 (Motor A Control)
- GPIO Pins -> Motor Driver IN3, IN4 (Motor B Control)
- GND -> Motor Driver GND
2. Motor Driver to Motors:
- Motor A Output -> Motor A Terminals
- Motor B Output -> Motor B Terminals
3. Power Supply Connections:
- 7.2V Battery -> Motor Driver VCC (for motor power)
- Motor Driver GND -> Battery Negative (-)
- 5V from Power Source -> Module 5V
- Power Source GND-> Module GND
4. Programming Steps:
Step 1: Install Software
- Download and install Arduino IDE or PlatformIO.
- Add board support for ESP32 via the board manager.
Step 2: Connect to Computer
- Use a USB cable to connect the module.
Step 3: Prepare for Programming
- Enter programming mode by holding the BOOT button while pressing RESET.
Step 4: Upload Code
#include "esp_camera.h"
#include <WiFi.h>
// WARNING!!! Make sure that you have either selected ESP32 Wrover Module,
// Select camera model
//#define CAMERA_MODEL_WROVER_KIT
//#define CAMERA_MODEL_M5STACK_PSRAM
#define CAMERA_MODEL_AI_THINKER
const char* ssid = "Wifi name"; //Enter SSID WIFI Name
const char* password = "password"; //Enter WIFI Password
#if defined(CAMERA_MODEL_WROVER_KIT)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 21
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 19
#define Y4_GPIO_NUM 18
#define Y3_GPIO_NUM 5
#define Y2_GPIO_NUM 4
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
#elif defined(CAMERA_MODEL_AI_THINKER)
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
#else
#error "Camera model not selected"
#endif
// GPIO Setting
extern int gpLb = 2; // Left 1
extern int gpLf = 14; // Left 2
extern int gpRb = 15; // Right 1
extern int gpRf = 13; // Right 2
extern int gpLed = 4; // Light
extern String WiFiAddr ="";
void startCameraServer();
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println();
pinMode(gpLb, OUTPUT); //Left Backward
pinMode(gpLf, OUTPUT); //Left Forward
pinMode(gpRb, OUTPUT); //Right Forward
pinMode(gpRf, OUTPUT); //Right Backward
pinMode(gpLed, OUTPUT); //Light
//initialize
digitalWrite(gpLb, LOW);
digitalWrite(gpLf, LOW);
digitalWrite(gpRb, LOW);
digitalWrite(gpRf, LOW);
digitalWrite(gpLed, LOW);
camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sscb_sda = SIOD_GPIO_NUM;
config.pin_sscb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_JPEG;
//init with high specs to pre-allocate larger buffers
if(psramFound()){
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 2;
} else {
config.frame_size = FRAMESIZE_SVGA;
config.jpeg_quality = 12;
config.fb_count = 1;
}
// camera init
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf("Camera init failed with error 0x%x", err);
return;
}
//drop down frame size for higher initial frame rate
sensor_t * s = esp_camera_sensor_get();
s->set_framesize(s, FRAMESIZE_CIF);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
startCameraServer();
Serial.print("Camera Ready! Use 'http://");
Serial.print(WiFi.localIP());
WiFiAddr = WiFi.localIP().toString();
Serial.println("' to connect");
}
- Open Arduino IDE.
- Choose the correct board under Tools > Board.
- Select the COM Port in Tools.
- Open the code.
- Click Upload to transfer the code.
- Copy the URL Ip address from serial monitor
FlySky Rx
Bind Transmitter and Receiver:
- Power the receiver and press its bind button to start the binding process.
- When binding is successful, the receiver's LED will switch from flashing to steady.
Connect Servos:
- Attach servos to the receiver's servo ports, ensuring correct placement of signal wires.
Power the Receiver:
- Supply 5V to the receiver using any pin in a row, as these are internally connected in parallel.
Check Connections:
- Verify that all connections are secure and that the receiver is functioning correctly with the transmitter.
Sensors
Integrating Soil Moisture & Humidity Sensors:
Soil Moisture Sensor:
- Mounting: Attached the soil moisture sensor to the robotic arm for better movement.
- Connection:
- Connect the sensor's output pin to any available analog input pin (e.g., GPIOA0).
- Connect VCC to 3.3V or 5V and GND to the ground.
Humidity Sensor:
- Mounting: Place the humidity sensor on the bot where it can accurately measure ambient humidity.
- Connection:
- Connect the data pin to any available digital input pin (e.g., GPIOD4).
- Connect VCC to 3.3V or 5V and GND to the ground.
Upload code:
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>
// Replace with your network credentials and Blynk Auth Token
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
char auth[] = "YourBlynkAuthToken";
// Sensor pins
#define DHTPIN 4 // Pin where the DHT sensor is connected
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
const int soilPin = 34; // Adjust according to your wiring
// Blynk Virtual Pins
#define V_TEMP 1 // Virtual pin for temperature
#define V_HUM 2 // Virtual pin for humidity
#define V_MOISTURE 3 // Virtual pin for soil moisture
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
dht.begin();
}
void loop()
{
Blynk.run();
// Read temperature and humidity
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
// Read soil moisture
int soilMoisture = analogRead(soilPin);
// Send data to Blynk
Blynk.virtualWrite(V_TEMP, temperature);
Blynk.virtualWrite(V_HUM, humidity);
Blynk.virtualWrite(V_MOISTURE, soilMoisture);
delay(2000); // Update every 2 seconds
}
Hardware Update:
Blynk App Integration
Set Up Blynk App:
- Download the Blynk app and create a new project.
- Note the Auth Token provided by the app.
- Open the Blynk app, add widgets for temperature, humidity, and soil moisture, and monitor the data in real-time.
Bot Control Panel
Copy the ip from serial monitor and paste on any browser you can get this panel, its connected within local host.
Conclusion
AgriArmbot can be a valuable ally for farmers, providing assistance in various agricultural tasks. As a prototype model, it demonstrates the potential for further enhancements, such as extending connectivity with long-range signals and improving load capacity. Beyond farming, this bot can operate in hazardous environments or areas with high risks to human safety, showcasing its versatility and potential for broader applications.