As an Amazon Associate we earn from qualifying purchases.
Fishing is one of the riskier jobs there is. Boats take on water, small crews work far from the coast, and a call for help often has no one nearby to hear it. The Fisherman Assisting and Rescue System is an Arduino-based project that tackles part of this problem. It watches for water inside the boat, sounds a local alarm, sends an SMS to a saved phone number and scans the area around the boat for obstacles.
This article explains what the system does, which parts it uses, how the circuit and program work, and where its limits are. The full source code is included below.
What the system does
The project combines three simple safety functions in one small unit:
- Flooding detection: a water sensor reads an analog value. When the reading goes above a set threshold, the system treats it as a danger condition.
- Alarm and SMS alert: in a danger condition, a buzzer sounds and a GSM module sends a text message reading "boat on danger" to a stored phone number.
- Obstacle scanning: an ultrasonic sensor mounted on a servo sweeps from 0 to 180 degrees. A row of LEDs shows the direction in which something is detected nearby.
There is also a push switch. A fisherman can press it to trigger the buzzer by hand, even when no water has been detected.
Components used
The program tells us which parts are connected. A typical build needs:
- An Arduino board (the A0 to A5 pin names in the code match an Uno-style board)
- An ultrasonic distance sensor with trigger and echo pins
- A hobby servo to rotate the ultrasonic sensor
- An analog water sensor
- A GSM modem or module that accepts AT commands, with a SIM card
- A buzzer
- A push switch
- Ten LEDs with suitable resistors
- A power supply that can handle the GSM module and servo
Circuit
The circuit diagram shows how the sensors, servo, buzzer, LEDs and GSM module connect to the Arduino. The pin assignments below come from the program.

- Pin 2: push switch, with the internal pull-up enabled. Pressing it reads as LOW.
- Pin 3: servo signal.
- Pin 4: ultrasonic trigger.
- Pin 5: ultrasonic echo.
- Pin 8: buzzer.
- A5: water sensor (analog input).
- Pins 9, 10, 11, 12, 13 and A0 to A4: the ten direction LEDs.
- TX/RX (serial): GSM module, running at 9600 baud.
The GSM module shares the Arduino's hardware serial port with the USB connection. On most boards you should disconnect the module while uploading the program, then reconnect it afterwards.
How the program works
Startup
On startup the program sets up the switch, buzzer, LEDs, servo, ultrasonic sensor and serial port. It lights all ten LEDs for one second as a quick test. It then sends AT+CMGF=1 to the GSM module, which puts it in text mode so messages can be sent as plain text.
The scanning loop
The main loop moves the servo in 20-degree steps from 0 to 180 degrees. At each step it waits a moment, then fires the ultrasonic sensor. The distance in centimetres is calculated by dividing the echo pulse time in microseconds by 58.
If the distance is between 10 and 20 cm, the LED assigned to that servo angle turns on. Otherwise that LED turns off. With ten angles and ten LEDs, the lit LED shows roughly where the object is. These distances suit a small demonstration model. For a real boat you would change them to suit the sensor's range.
Water and alarm checks
Before most servo steps, the loop calls a function named swwater. It reads the water sensor on A5 and works like this:
- If the reading is above 200, the buzzer turns on. The first time this happens, the program also calls the message function to send the SMS.
- If the push switch is pressed, the buzzer turns on.
- If the switch is not pressed and the water reading is below 200, the buzzer turns off.
A flag variable makes sure the SMS is sent only once per power-up, so the phone is not flooded with repeated texts. The flag is not reset, so you need to restart the board to arm the alert again.
Sending the SMS
The message function sends the AT+CMGS command followed by the destination number in quotes, then the text "boat on danger", and finally the Ctrl+Z character (0x1A) that tells the module to send. Replace the phone number in the code with the number that should receive alerts. If you want to explore this idea further, see our Arduino security system with SMS alerts project.
Full source code
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int a=0,y=0,duration;
void setup()
{
pinMode(2, INPUT); digitalWrite(2, HIGH);//switch
pinMode(8, OUTPUT); digitalWrite(8, LOW);//buzzer
displayinit();
displaytest();
myservo.attach(3);
usinit();
serialstart();
}
void loop()
{
swwater ();
myservo.write(0); delay(1000); us();
if(a>10 && a<20){digitalWrite(A4, HIGH); delay(100);} else digitalWrite(A4, LOW);
swwater ();
myservo.write(20); delay(1000); us();
if(a>10 && a<20){digitalWrite(A3, HIGH); delay(100);} else digitalWrite(A3, LOW);
swwater ();
myservo.write(40); delay(1000); us();
if(a>10 && a<20){digitalWrite(A2, HIGH); delay(100);} else digitalWrite(A2, LOW);
myservo.write(60); delay(1000); us();
if(a>10 && a<20){digitalWrite(A1, HIGH); delay(100);} else digitalWrite(A1, LOW);
swwater ();
myservo.write(80); delay(1000); us();
if(a>10 && a<20){digitalWrite(A0, HIGH); delay(100);} else digitalWrite(A0, LOW);
swwater ();
myservo.write(100); delay(1000); us();
if(a>10 && a<20){digitalWrite(13, HIGH); delay(100);} else digitalWrite(13, LOW);
swwater ();
myservo.write(120); delay(1000); us();
if(a>10 && a<20){digitalWrite(12, HIGH); delay(100);} else digitalWrite(12, LOW);
swwater ();
myservo.write(140); delay(1000); us();
if(a>10 && a<20){digitalWrite(11, HIGH); delay(100);} else digitalWrite(11, LOW);
swwater ();
myservo.write(160); delay(1000); us();
if(a>10 && a<20){digitalWrite(10, HIGH); delay(100);} else digitalWrite(10, LOW);
swwater ();
myservo.write(180); delay(1500); us();
if(a>10 && a<20){digitalWrite(9, HIGH); delay(100);} else digitalWrite(9, LOW);
/*
*/
}
void swwater (void)
{
int z= analogRead(A5);
if(z>200){if(y==0)message();y=1;digitalWrite(8, HIGH);}
int x=digitalRead(2);
if(x==0){digitalWrite(8, HIGH);}
if(x==1 && (z<200)){digitalWrite(8, LOW);}
}
void message(void)
{
Serial.print("AT+CMGS=");
Serial.write(0X22);
Serial.print("98952");
Serial.print("41319");
Serial.write(0X22);
Serial.write(0xd);
delay(1000);
Serial.print("boat ");
Serial.print("on ");
Serial.print("danger");
for(int v=0;v<25;v++){Serial.write(Serial.read());}
Serial.write(0x1a);
}
void serialstart(void)
{
Serial.begin(9600);
Serial.print("AT+CMGF=1");
Serial.write(0xd);
}
void displayinit(void)
{
pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT);
pinMode(13, OUTPUT); pinMode(A0, OUTPUT); pinMode(A1, OUTPUT); pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT); pinMode(A4, OUTPUT);
}
void displaytest(void)
{
digitalWrite(9, HIGH); digitalWrite(10, HIGH); digitalWrite(11, HIGH); digitalWrite(12, HIGH);
digitalWrite(13, HIGH); digitalWrite(A0, HIGH); digitalWrite(A1, HIGH); digitalWrite(A2, HIGH);
digitalWrite(A3, HIGH); digitalWrite(A4, HIGH);
delay(1000);
digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); digitalWrite(12, LOW);
digitalWrite(13, LOW); digitalWrite(A0, LOW); digitalWrite(A1, LOW); digitalWrite(A2, LOW);
digitalWrite(A3, LOW); digitalWrite(A4, LOW);
}
void usinit(void)
{
pinMode(4, OUTPUT);// Trigger Pin
pinMode(5, INPUT);// Echo Pin
digitalWrite(4 , LOW);
}
void us(void)
{
digitalWrite(4, HIGH); //sends signal 10 us to excite ultra sonic sensor
delayMicroseconds(10);
digitalWrite(4, LOW);
duration = pulseIn(5, HIGH);//reads duartion pulse in Microseconds
a = duration/58;
}Limits and ideas for improvement
This is a learning prototype, not a certified marine safety device. It should never replace lifejackets, a marine radio, flares or proper emergency beacons. A few limits are worth knowing:
- Network coverage: an SMS can only be sent where the GSM network reaches. Coverage usually fades as a boat moves away from shore.
- No location in the message: the text says only that the boat is in danger. Adding a GPS module and including coordinates in the SMS would make it far more useful to rescuers.
- One alert per start: the flag is never cleared, so a second event needs a restart.
- Waterproofing: the electronics need a sealed, splash-proof enclosure and a stable power source before they go anywhere near a boat.
- Slow scan: each servo step takes about a second, so the obstacle display updates slowly.
The same alert-and-notify pattern appears in our other rescue projects, such as the ambulance rescue system, the black box and accident rescue system and the advanced traffic control and rescue system.
Frequently asked questions
What does the Fisherman Assisting and Rescue System do?
It detects water in the boat with a sensor, sounds a buzzer, sends an SMS saying "boat on danger" through a GSM module, and scans nearby obstacles with a servo-mounted ultrasonic sensor.
Which microcontroller does it use?
The code is written for an Arduino. It uses the Servo library, the hardware serial port for the GSM module, and the analog and digital pins listed in the circuit section.
Will the SMS work far out at sea?
Only within range of a mobile network. For longer distances you would need other communication, such as a marine radio or a satellite-based device.
How do I change the phone number that receives the alert?
Edit the two number strings inside the message function, then upload the program again. Together they form the full number that receives the SMS.