Introduction: WiFi Tank(Esp8266/01 Variant)

About: Singapore Polytechnic student studying in the course of computer engineering. Coding to improve way of life.

Done By Joel Ng from Singapore Polytechnic studying in the course of Diploma in Computer Engineering (DCPE) and my supervisor Mr Teo Shin Jen, i got the parts and know how from him.

SKIP VIDEO TO 47 SECONDS TO SEE OPERATION OF TANK

BACKGROUND

I was thinking of a way to improve the range of a remote controlled device usually by short ranged communications like Bluetooth. I came up of the idea of using WiFi to control as internet is readily available in almost all parts of the world making the range of the control very long. I heard about ESP8266, a WiFi Module, from my supervisor and decided to use it for the project. The project is a proof of concept that a vehicle can be controlled using WiFi as a means of communication.

Step 1: Software

For this project, I'll be using Arduino IDE to program and upload the program to the ESP-01, https://www.arduino.cc/en/Main/Software. To get the ESP8266 "board" in the board manager, go to File>Preferences, under settings tab, copy and paste "http://arduino.esp8266.com/stable/package_esp8266com_index.json" into the Additional Boards Manager URLs then go to tools>board>boards manager then key in "ESP8266" into the search and download the result by ESP8266 community. The boards under tools then must be set to "Generic ESP8266 Module" and the rest as shown.
Android studios was also used to create the Android app to control the Tank.

Step 2: Hardware

1.ESP-01(ESP8266)
2.Android phone for testing
3.Servo(I'm using a modified servo that turns 360°)
4.USB to UART(I'm using CP2102)
5.3v3 power supply(I'm using ywrobot PSU)

connection for CP2102 and ESP-01 to program the ESP-01
RX -- -- TX
TX -- -- RX
VCC -- -- 3V3 (Do not use 3V3 from CP2102 as it will not have enough current)
GND -- -- GND
CH_PD -- -- GND
GPIO0 -- -- GND(To enable programming mode)

RST connected to a push button at normal high. RST is active low meaning when set to Ground, it'll activate.
GPIO0 set to VCC for normal mode meaning it'll run the program that was uploaded and set to GND to run in Programming mode to upload a program. always reset when changing the GPIO0 to change the chip mode.

Sometimes the ESP-01 takes up too much power so i have attached a 220uF Capacitor to the power supply.

If using an external supply, always connect the GND of the external supply to all the GND of the working circuit. Always have a common ground.

The ywrobot board is supplied by a DC barrel plug. input voltage ranging around 6V-12V. Using the little connectors on the power rails to select which voltage output you want.(3V3 or 5V, use 3V3 in our case)

The Arduino Uno's Rx is connected to ESP-01's Tx to receive data from the ESP-01.

For the connection after programming is
ESP-01 -- -- Arduino Uno
Tx -- -- Rx
GND -- -- GND
3v3 -- -- 3v3
And Arduino Uno -- -- Servo
GND -- -- GND
3V3 -- -- 3V3
pin6 -- -- control pin

Step 3: Arduino and Android Programming

The source code for ESP-01, android studio app and Arduino Uno is here https://github.com/joelngpd25/WiFi-Tank/blob/maste... .

It's a simple receive data from connected wifi device and sending the data through Serial connection(Rx Tx) UART.

It receives the Serial data and controls the Servos according to what it receives.

The android code is to send tilt data according to left and right tilt, sends the front, back or release movement data. It has edit texts to key in varying ip address and port number. It displays the tilt data for testing purposes.

Step 4: PORT Forwarding

In order to access the ESP from outside the LAN, port forwarding from the router is required.

What is port forwarding? It is the forwarding of connection from outside the router to inside the router using a port number. For example, I'll use port 80. On my router, i set port 80 to forward to the ip address of my ESP-01 when connected. Then on my android app, i just type in my public ip(Can be found by googling, whatsmyip) and the port which was set to be 80. Search up on port forwarding for more detailed information.

To get to the interface of port forwarding, type in the ip address of your default gateway in your web browser to access the http interface of your router(find the default gateway by window+r then type cmd then press "ok". Key in "ipconfig" into the command prompt and look for Default Gateway).