Introduction: Serial Port Over WiFi

About: I'm a mechanical engineer, and I like computer programming, mechanics, electronics and specially the robotics.

Data communication between electronic devices is inevitable in many electronic projects and brings a lot of advantages to your project i.e. connecting your microcontroller to PC and monitor data on a large colorful display instead of small monochrome LCD. When talking about connecting a device to PC, the most obvious way of communicating is USB port. But transmitting data over USB requires lots of programming. Another easy way is Serial Port (aka COM) and RS232 protocol that only needs a tiny electronic circuit to convert voltage levels and a little programming. So I made an RSS232-TTL UART adapter and published here to uses in all of my projects. But I faced a new problem, new motherboards and laptops have no COM port. Then I decided to make a USB-TTL UART adapter using famous FT232 IC for my projects. It works very well, but long wires from devices to PC are annoying me. Is it possible to have the serial port on the air like wireless mice and keyboards? Of course, it can be done using lovely WiFi module ESP8266, and by using WiFi you have not to make a dongle yourself and also you can have a serial port over the internet. Wow, I just wanted a wireless serial port, now I also have a serial port over the web. That's very exciting.

The video shows controlling an E-waste CNC (3D printer) using this device.

I want to share this project with you. If you like it, follow me.

Step 1: Things You Need

  • 1x ESP8266-01 module
  • 1x 78L05 voltage regulator
  • 1x LF33CV voltage regulator
  • 1x BC547 transistor
  • 3x 100uF electrolyte capacitor
  • 1x 100nF MKT capacitor
  • 1x 4.7K resistor
  • 6x 10K resistors
  • 1x 1N4148 diode
  • 2x Small push buttons
  • 8x Female pin headers
  • 1x Power connector (female)
  • 1x Power connector (male)
  • 1x 3.5mm stereo audio connector (male)
  • Some wires
  • Some copper board
  • PCB making tools (sandpaper, glossy paper, laser printer, PCB file, acetone, ferric chloride etchant, plastic container, etc.)
  • Soldering tools (iron, wire, flux, wire cutter, etc.)
  • Some unusable plastic cards and glue to make a case

Step 2: Making the PCB

Print the PCB file with a laser printer on an A4 glossy paper without scaling. Cut some copper board, clear it with sandpaper, pour some acetone on the board, put printed papers on it and press them about 10 seconds and wait till it dries. Remove the papers, if there are parts that circuit does not reflect well fix them with a CD marker. Then soak board in ferric chloride etchant and wait till no copper parts can be seen. Wash the board with water, dry and clear it with sandpaper, then drill the holes. There are a lot of Instructables to show you how to make a PCB.

Step 3: Soldering Components

Solder components according to the text on the board and schematic diagram. Notice the direction of voltage regulators, transistor, diode, and electrolyte capacitors. There are a lot of Instructables to teach you how to solder. Notice that anode is at the center of power connector while connecting it to the board. Connect 3.5mm audio connector to the RX, TX and GND terminals on the board according to its diagram. Solder female pin headers to the place of the ESP8266 module.

Step 4: Programming ESP8266

Search this website for flashing ESP8266 with Arduino. You can find useful articles. I flashed it using my USB-TTL UART adapter and a small board that I made for flashing and testing ESP8266-01 (If you want to make it, download its files from this step and make your ESP8266 flasher). Download below code and flash your ESP8266. Then put it in its place on your board. The LF33CV voltage regulator prevents attaching ESP8266 module in a wrong direction.

Step 5: Making the Case

I cleared some useless plastic cards with sandpaper and made a case for this device by gluing them together. Don’t forget to make holes for cooling LF33CV.

Step 6: How to Use

I placed two connectors for the power supply (one male and one female) to be able to put this device easily between AC adapter output and the set that must connect to the serial port, so you have not to prepare another power source for this device. According to LF33CV datasheet, you can power this device from 3.5VDC to 18VDC.

Connect 3.5mm audio connector to the serial port of target device, and male power connector to the power supply of target device. Plug AC adapter output into "Serial Port over WiFi” DC input connector.

On your PC connect to “dihavSerialPort_XXXXXX” access point, device IP address in access point mode is “”.

Download the Windows application I uploaded here, and execute it on your PC. Type device IP, choose baud rate, stop bit, data bits, parity and click "Connect" button. Click “Allow access” button on “Windows Security Alert” window. You can send data by typing it into the box below "Disconnect" button as ASCII, hex or decimal and press related "Send XXX" button. Sent and received data will display in six boxes below "Send XXX" buttons.

There is an HTML-based interface that makes it possible to access serial port in a web browser on any OS. To access it type “” in the address bar of your internet browser and hit enter.

Step 7: Serial Data Forwarding

In many applications, there is a software that must connect to a device via serial port. To make this possible download com0com and install it on your PC. Create a pair of virtual ports choose one of them as the serial port in "dihav SerialPort over WiFi” software and select other in the software that controls your device. To establish connection press connect button.

Step 8: Connecting to a Router

You can also connect this device to a router instead of using it as an access point. To do this just browse to device settings page by typing “” into the address bar of your internet browser. On this page, you can change the device name, access point password and specify the router you want this device to connect to by typing its name and password. It is recommended to assign a static IP address to this device if you want it to connect it to a router. To find out how to do this just search the internet for “Assign static IP address ”. Note that if you connect this device to a router, the IP address is not "" anymore. To reset all these settings hold "Reset Passwords" button on the device for about 2 seconds.

Step 9: Serial Port Over Internet

Now we reached to the exciting part. To access serial port over internet search the internet for “IP forwarding ” to find out how to do this. Then forward ports 80 and 2321 of the device you made on the internet. Assigning static IP to this device will help you a lot in this step. Search for "My IP" in the Google, you can see your IP at the top of search results. It is the IP address that you must use it to access serial port from the internet.

Step 10: Directly Use WiFi in Your Program

If you want to make a program that directly connects to this device without using the software downloaded from step 6, use the following protocol, I've made for this device.

  1. Each [] is a byte.
  2. Baud rate on port 2321 is a 4-byte value that most significant byte will be sent first.
  • Connect:
    • HTTP (Port 80):
      • Request: POST con
      • bdrt=####&dbt=#&sbt=#&prty=#
      • Response: OK or ER
    • Port 2321:
      • Request: [1][bdrt][bdrt][bdrt][bdrt][dbt][sbt][prty]
      • Response: [0] or [1]
  • Disconnect:
    • HTTP (Port 80):
      • Request: GET dis
      • Response: OK
    • Port 2321:
      • Request: [2]
      • Response: [1]
  • Receive Data:
    • HTTP (Port 80):
      • Request: GET rec
      • Response: or ER
    • Port 2321:
      • Data bytes will be sent to a server created on the PC on port 2321.
  • Send Data:
    • HTTP (Port 80):
      • Request: POST snd
      • Response: OK or ER
    • Port 2321:
      • Request: [3][datasize(max255)]
      • Response: [0] or [1]
  • Test Connection:
    • Port 2321:
      • Request: [4]
      • Response: [44]