Balázs Simon
Published © GPL3+

Drone Boat Controlled Through the Internet

You can feed fishes or collect water quality data from anywhere in the world using this drone boat.

IntermediateFull instructions provided2 days5,134
Drone Boat Controlled Through the Internet

Things used in this project

Hardware components

Sparkfun Blynk Board / ESP8266-201 + 3.3V FTDI Serial Adapter Module
+ 3.3V FTDI USB to TTL Serial Adapter Module if you use ESP201
×1
3.3V voltage regulator
×1
Servos (Tower Pro MG996R)
×2
L293D Dual H-Bridge
×1
DC motor (generic)
It needs to be powerful enough
×1
Resistor 1k ohm
×1
Resistor 2.2k ohm
×1
Resistor 6.8k ohm
×1
capacitor 22uF
×2

Software apps and online services

Blynk
Blynk
Arduino IDE
Arduino IDE

Story

Read more

Schematics

Main board schematics

The main board is required for the Sparkfun Blynk Board to control the boat. It regulates the voltage of the battery and adds motor driving capability to the microcontroller.

Blynk project

Main screen of the project

Joystick settings

Cargo button settings

Battery voltage display settings

Code

Drone boat code

Arduino
This is the code that runs on the ESP8266, that controls the boat. It communicates with the Blynk application.
#include <ESP8266WiFi.h>
#include <Servo.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>

#define VREF 1.0
#define R1 9000
#define R2 1000
#define RESOLUTION 1024

#define SERVO_CARGO_PIN 4   //you have to use some other GPIO on Sparkfun Blynk Board. GPIO should work
#define SERVO_RUDDER_PIN 5
#define MOTOR_PIN_1 12
#define MOTOR_PIN_2 13

#define ADC_PIN A0

//This equation is based on the voltage divider and adc value to voltage equations
//If I multiply the ADC's value with convertADCReadToVoltage, I get the battery's voltage
float convertADCReadToVoltage = (VREF * (R2 + R1)) / (R2 * RESOLUTION);

SimpleTimer timer;

Servo servoCargo;
Servo servoRudder;

char auth[] = "YourAuthToken";
char ssid[] = "YourSSID";
char password[] = "YourPassword";

//updating the battery status in the Blynk app
void batteryVoltage()
{
  float voltage = convertADCReadToVoltage * analogRead(ADC_PIN);
  Blynk.virtualWrite(V5, voltage);
}

void setup()
{
  Blynk.begin(auth, ssid, password);
  
  servoCargo.attach(SERVO_CARGO_PIN);
  servoRudder.attach(SERVO_RUDDER_PIN);

  pinMode(MOTOR_PIN_1, OUTPUT);
  pinMode(MOTOR_PIN_2, OUTPUT);

  servoCargo.write(128);  //initial position of this servo
  
  timer.setInterval(1000L, batteryVoltage);
}

//Setting up the angle of the rudder. It receives the angle from the Blynk app's joystick (horizontal movement)
BLYNK_WRITE(V1)
{
  servoRudder.write(param.asInt());
  Serial.println("V1");
}

//Setting the speed of the motor, based on the position of the Blynk app's joystick (vertical movement)
BLYNK_WRITE(V2)
{
  int motorSpeed = param.asInt();

  //by default the received motorSpeed is 0. If you move to joystick up or down, you can modify the speed of the boat
  if(motorSpeed > 0){
    analogWrite(MOTOR_PIN_1, motorSpeed);
    analogWrite(MOTOR_PIN_2, 0);
  }
  else{
    analogWrite(MOTOR_PIN_1, 0);
    analogWrite(MOTOR_PIN_2, abs(motorSpeed));
  }
}

//It opens the cargo door with the servo, then returns the servo arm to the original position
BLYNK_WRITE(V3)
{
  servoCargo.write(30);
  
  delay(1000);
  
  servoCargo.write(128);
}

void loop()
{
  Blynk.run();
  timer.run();
}

Credits

Balázs Simon

Balázs Simon

12 projects • 85 followers

Comments