Table of Contents
INTRODUCTION
Robotics is expected to play a major role in the agricultural domain, and often multi-robot systems and collaborative approaches are mentioned as potential solutions to improve efficiency and system robustness. Among the multi-robot approaches, swarm robotics stresses aspects like flexibility, scalability and robustness in solving complex tasks, and is considered very relevant for precision farming and large-scale agricultural applications. This Agribot gives an advance method to harvesting and watering the crops with minimum man power and labor making it an efficient vehicle. Moreover, the vehicle can be controlled through Internet medium using an Android smart phone. The whole process calculation, processing, monitoring is designed with motors & sensor interfaced with microcontroller. Using Internet of things, the robot is controlled. In excess of 40 percent of the population on the planet picks agribusiness as the essential occupation. Lately, expanded interest has been developed for the development of the self-ruling vehicles like robots in the agribusiness. In traditional strategy for farming works, the types of equipment used to perform various activities are costly and badly designed to deal with. In this way, farmers need advanced equipment to perform farming procedures.
PROJECT BUILDING
STEP 1
- Make a right metal chassis required for the project, mount Geared DC motors to the chassis and attach wheels to the motors as shown in figure.
- Also you can attach belt drives instead of wheels to the robot as per your needs.
STEP 2
- Short the polarities of two motors of each side and then connect it to the motor driver, give power supply of 9-12V to the driver.
- Here I had used 12v Lithium battery as a power unit.
- Then connect IN1, IN2, IN3, IN4 of driver to 8,7,4,3 of node mcu and ENABLE A & B to 5,6 of mcu as shown in figure.
- You can use 5V output of driver to power up node mcu.
- The pin diagram is shown below, the code is given in code block section.
STEP 3
Upload the given code to node mcu of the Master Robot using Arduino software.
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <RH_NRF24.h>
#include <EEPROM.h>
RH_NRF24 nrf24(2, 4); // use this for NodeMCU Amica/AdaFruit Huzzah ESP8266 Feather
int deviceID = EEPROM.read(0);
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Softronic";
char pass[] = "sunsoftronic";
bool eventTrigger = false;
BlynkTimer timer;
int m1Clock=D8;
int m1AntiClock=D7;
int m2Clock=D6;
int m2AntiClock=D5;
int m3=D1;
int m4=D3;
int m6AntiClock=D0;
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(m1Clock,OUTPUT);
pinMode(m1AntiClock,OUTPUT);
pinMode(m2Clock,OUTPUT);
pinMode(m2AntiClock,OUTPUT);
pinMode(m3,OUTPUT);
pinMode(m4,OUTPUT);
pinMode(m6AntiClock,OUTPUT);
while (!Serial)
; // wait for serial port to connect. Needed for Leonardo only
if (!nrf24.init())
{
Serial.println("init failed");
}
// Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
if (!nrf24.setChannel(3))
{
Serial.println("setChannel failed");
}
if (!nrf24.setRF(RH_NRF24::DataRate2Mbps, RH_NRF24::TransmitPower0dBm)) {
Serial.println("setRF failed");
}
Serial.println("Transmitter started");
}
int fwd,wat,lft,right,cut,seed;
void loop()
{
Blynk.run();
uint8_t data[7];//int fwd,wat,lft,right,cut,seed;
data[0] = fwd;
data[1] = lft;
data[2] = right;
data[3] = wat;
data[4] = cut;
data[5] = seed;
data[6] = deviceID;
nrf24.send(data, sizeof(data));
nrf24.waitPacketSent();
}
BLYNK_WRITE(V7){
int val=param.asInt();
if(val){
fwd=1;
digitalWrite(m1AntiClock,HIGH);
digitalWrite(m2AntiClock,HIGH);
Blynk.virtualWrite(V0,"Forward Start");
}else{
fwd=0;
digitalWrite(m1AntiClock,LOW);
digitalWrite(m2AntiClock,LOW);
Blynk.virtualWrite(V0,"Forward stop");
}
}
BLYNK_WRITE(V6){
int val=param.asInt();
if(val){
lft=1;
digitalWrite(m1AntiClock,HIGH);
digitalWrite(m2Clock,LOW);
Blynk.virtualWrite(V0,"Left Start");
}else{
lft=0;
digitalWrite(m1AntiClock,LOW);
digitalWrite(m2Clock,LOW);
Blynk.virtualWrite(V0,"Left stop");
}
}
BLYNK_WRITE(V5){
int val=param.asInt();
if(val){
right=1;
digitalWrite(m1Clock,LOW);
digitalWrite(m2Clock,LOW);
digitalWrite(m2AntiClock,HIGH);
Blynk.virtualWrite(V0,"Right Start");
}else{
right=0;
digitalWrite(m2Clock,LOW);
digitalWrite(m2AntiClock,LOW);
Blynk.virtualWrite(V0,"Right stop");
}
}
BLYNK_WRITE(V4){
int val=param.asInt();
if(val){
seed=1;
digitalWrite(m3,HIGH);
Blynk.virtualWrite(V0,"Sedding");
}else{
seed=0;
digitalWrite(m3,LOW);
Blynk.virtualWrite(V0,"........");
}
}
BLYNK_WRITE(V3){
int val=param.asInt();
if(val){
cut=1;
digitalWrite(m4,HIGH);
Blynk.virtualWrite(V0,"Harvester");
}else{
cut=1;
digitalWrite(m4,LOW);
Blynk.virtualWrite(V0,"........");
}
}
BLYNK_WRITE(V1){
int val=param.asInt();
if(val){
wat=1;
digitalWrite(m6AntiClock,HIGH);
Blynk.virtualWrite(V0,"WATER PUMP");
}
else
{
wat=0;
digitalWrite(m6AntiClock,LOW);
Blynk.virtualWrite(V0,"------------");
}
}
STEP 4
Upload the given code to node mcu of the Slave Robot using Arduino software.
#include <RH_NRF24.h>
#include <EEPROM.h>
RH_NRF24 nrf24(2, 4); // use this for NodeMCU Amica/AdaFruit Huzzah ESP8266 Feather
#define DHTPIN D1
//#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
int deviceID = EEPROM.read(0);
int m1Clock=D8;
int m1AntiClock=D7;
int m2Clock=D6;
int m2AntiClock=D5;
int m3=D1;
int m4=D3;
int m6AntiClock=D0;
void setup()
{
// Debug console
Serial.begin(9600);
pinMode(m1Clock,OUTPUT);
pinMode(m1AntiClock,OUTPUT);
pinMode(m2Clock,OUTPUT);
pinMode(m2AntiClock,OUTPUT);
pinMode(m3,OUTPUT);
pinMode(m4,OUTPUT);
pinMode(m6AntiClock,OUTPUT);
if (!nrf24.init())
{
Serial.println("init failed");
}
// Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
if (!nrf24.setChannel(3))
{
Serial.println("setChannel failed");
}
if (!nrf24.setRF(RH_NRF24::DataRate2Mbps, RH_NRF24::TransmitPower0dBm)) {
Serial.println("setRF failed");
}
Serial.println("Transmitter started");
}
int fwd,wat,lft,right,cut,seed;
void loop()
{
// Now wait for a reply
uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (nrf24.waitAvailableTimeout(1000))
{
// Should be a reply message for us now
if (nrf24.recv(buf, &len))
{
Serial.print("got reply: ");
Serial.println((char*)buf);
}
else
{
Serial.println("recv failed");
}
}
else
{
Serial.println("No reply.");
}
int val=buf[0];
if(val){
digitalWrite(m1AntiClock,HIGH);
digitalWrite(m2AntiClock,HIGH);
}else{
digitalWrite(m1AntiClock,LOW);
digitalWrite(m2AntiClock,LOW);
}
int val1=buf[1];
if(val1){
digitalWrite(m1AntiClock,HIGH);
digitalWrite(m2Clock,LOW);
}else{
digitalWrite(m1AntiClock,LOW);
digitalWrite(m2Clock,LOW);
}
int val2=buf[2];
if(val2){
digitalWrite(m1Clock,LOW);
digitalWrite(m2Clock,LOW);
digitalWrite(m2AntiClock,HIGH);
}else{
digitalWrite(m2Clock,LOW);
digitalWrite(m2AntiClock,LOW);
}
int val3=buf[3];
if(val3){
digitalWrite(m3,HIGH);
}else{
digitalWrite(m3,LOW);
}
int val4=buf[4];
if(val4){
digitalWrite(m4,HIGH);
}else{
digitalWrite(m4,LOW);
}
int val5=buf[5];
if(val5){
digitalWrite(m6AntiClock,HIGH);
}
else
{
digitalWrite(m6AntiClock,LOW);
}
}
STEP 5
- Download Blynk IOT app from play store in your mobile.
- Make necessary configurations using SSID network & password.
- Connect the robot to mobile using hotspot network to control the movements.