Andriy Baranov
Published © GPL3+

High Sensitive WiFi Fish Bite Alarm With NodeMCU ESP8266

High sensitive WiFi Fish Bite Alarm with NodeMCU ESP8266 and vibration sensor. Now you can not miss a fish bite with your smartphone!

IntermediateFull instructions provided2 hours9,001
High Sensitive WiFi Fish Bite Alarm With NodeMCU ESP8266

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
SW-420 Normally Closed Vibration Sensor Module
×1
LED (generic)
LED (generic)
×1
SparkFun Solder-able Breadboard - Mini
SparkFun Solder-able Breadboard - Mini
×1

Software apps and online services

Arduino IDE
Arduino IDE
MIT App Inventor
MIT App Inventor

Story

Read more

Custom parts and enclosures

.apk file to install on your smartphone

If you do not need any changes just install this .apk file on your smartphone

.aia file to open in MIT App Inventor

Open this file in MIT App Inventor If you want to change any parameters

Schematics

fishalarm_cd_OrqsVoUcUo.jpg

circuit diagram

Code

FishAlarm_v3.ino

Arduino
#define vibsensorPin  5
#define ledPin  13
#include <ESP8266WiFi.h>

const char* ssid = "Redmi";
const char* password = "";
boolean bite = false;

WiFiServer server(80);

void setup() {
  Serial.begin(115200);
  delay(10);

  pinMode(ledPin, OUTPUT);
  pinMode(vibsensorPin, INPUT);
  digitalWrite(ledPin, LOW);
  
  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  
  WiFi.begin(ssid);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  
  // Start the server
  server.begin();
  Serial.println("Server started");

  // Print the IP address
  Serial.println(WiFi.localIP());
}

void loop() {
  
  long fishAlarm = pulseIn(vibsensorPin, HIGH); 
  if (fishAlarm > 100) 
  {
    bite = true;
    Serial.println(fishAlarm);
    Serial.println(bite);
  }
 
   
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
  
  // Wait until the client sends some data
  Serial.println("new client");
  while(!client.available()){
    delay(1);
  }
  
  // Read the first line of the request
  String req = client.readStringUntil('\r');
  Serial.println(req);
  client.flush();
  
  // Match the request
  int val;
  if (req.indexOf("/stop/0") != -1)
    val = 0;
  else if (req.indexOf("/start/1") != -1)
    val = 1;
  else {
    Serial.println("invalid request");
    client.stop();
    return;
  }

  // Set GPIO according to the request
  digitalWrite(ledPin, val);
  
  client.flush();

  // Prepare the response
  String s = "HTTP/1.1 200 OK\r\n Content-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n";
  if (bite == true)
   {
    s += "!!!BITE!!!";
    bite= false;
   }

  else
  {
    s += "no bite";
  }

  // Send the response to the client
  client.print(s);
  delay(1);
  Serial.println("Client disonnected");
}

Credits

Andriy Baranov

Andriy Baranov

1 project • 295 followers

Comments