Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
devansh_tangri
Published © GPL3+

Keyboard Controlled Wi-Fi Bot/Spy Bot

Keyboard keys controlled Spy Bot using ESP8266 as a Wi-Fi communication medium between Serial Monitor software PuTTY and Arduino.

IntermediateFull instructions provided1,319

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
Any Arduino Board would work
×1
ESP8266 ESP-01
Espressif ESP8266 ESP-01
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
SparkFun Breadboard Power Supply 5V/3.3V
SparkFun Breadboard Power Supply 5V/3.3V
×1
DC motor (generic)
×2
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE
PuTTY

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Connection Diagram

Connection Diagram Fritzing File

Code

Arduino Code

Arduino
const int i1 = 2;
const int i2 = 3;
const int i3 = 4;
const int i4 = 5;
int i;
void setup() {
  Serial.begin(115200);
  pinMode(i1, OUTPUT);
  pinMode(i2, OUTPUT);
  pinMode(i3, OUTPUT);
  pinMode(i4, OUTPUT);
}

void loop() {
  if(Serial.available()) {
    i = Serial.read();
    Serial.println(i);

    if(i == 115) {
      digitalWrite(i1, HIGH);
      digitalWrite(i2, LOW);
      digitalWrite(i3, LOW);
      digitalWrite(i4, HIGH); 
    }
    else if(i == 119) {
      digitalWrite(i1, LOW);
      digitalWrite(i2, HIGH);
      digitalWrite(i3, HIGH);
      digitalWrite(i4, LOW);      
    }
    else if(i == 97) {
      digitalWrite(i1, HIGH);
      digitalWrite(i2, LOW);
      digitalWrite(i3, HIGH);
      digitalWrite(i4, LOW);
    }
    else if(i == 100) {
      digitalWrite(i1, LOW);
      digitalWrite(i2, HIGH);
      digitalWrite(i3, LOW);
      digitalWrite(i4, HIGH);
    }
  }
  else {
    delay(600);
    i = 0;
    digitalWrite(i1, LOW);
    digitalWrite(i2, LOW);
    digitalWrite(i3, LOW);
    digitalWrite(i4, LOW);
  }
}

ESP8266 Code

Arduino
#include <ESP8266WiFi.h>

#define STASSID  "your SSID"
#define STAPSK   "your Password"

const char* ssid      = STASSID;
const char* password  = STAPSK;

WiFiServer wifiServer(1234);

void setup() {
  Serial.begin(115200);
  delay(1000);
  WiFi.begin(ssid, password);
  WiFi.mode(WIFI_STA);
  while(WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi");
  }
  Serial.println("Connected");
  Serial.print("Local IP Address : ");
  Serial.println(WiFi.localIP());
  wifiServer.begin();
}
void loop() {
  WiFiClient client = wifiServer.available();

  if(client) {
    while(client.connected()) {
      while(client.available() > 0) {
        Serial.write(client.read());
      }
      delay(10);
    }
    client.stop();
    Serial.println("Client Disconnected");
  }
}

Credits

devansh_tangri
2 projects • 10 followers
I'm a 17 yo student, making Arduino Projects and Electrical Circuits is my favorite hobby. I have been making circuits for about 8 years.
Contact

Comments

Please log in or sign up to comment.