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.
How to send data from serial port over wifi? I have also connected WiFi USB adapter to CuBox. How can I create a virtual serial port that relays data over ssh? Plug AC adapter output into 'Serial Port over WiFi. Create a pair of virtual ports choose one of them as the serial port in 'dihav SerialPort over WiFi. UCreating a virtual COM port U. Before you can use your wireless router to communicate with the serial WiFi adapter you first need to.
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 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 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. 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. Attachments. 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 “dihavSerialPortXXXXXX” access point, device IP address in access point mode is “192.168.4.1”. 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 “192.168.4.1” in the address bar of your internet browser and hit enter. Attachments. 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 “192.168.4.1/set” 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 '192.168.4.1' anymore. To reset all these settings hold 'Reset Passwords' button on the device for about 2 seconds. 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.
Each is a byte. 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: 1bdrtbdrtbdrtbdrtdbtsbtprty.
Usb Serial Port Adapter
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: OK.data(hex).
Serial Port Adapter Driver
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.data(hex). Response: OK or ER.
Port 2321:. Request: 3datasize(max255).data.
Response: 0 or 1. Test Connection:. Port 2321:. Request: 4. Response: 44.
This page demonstrates how a COM-to-TCP connection can be made from a PC to the WiSnap RS232 adapter. The first step is to install the Null-modem emulator (com0com) application, which installs and works as a driver for a pair (or many pairs) of virtual COM ports. You can download the com0com installer.
You can create as many pairs of virtual COM port as you like, and use any pair to connect one application to another. The COM port pairs will be given names starting at CNCA0 and CNCB0. These names can be changed, but the default convention begins with “CNC,” followed by the A-B pairing, and the final digit at the end represents the number of the pair.
All data sent from the “A” port will be mirrored on the “B” port of the same pair, and vise versa. Null-modem Emulator Installation Running the “setup.exe” begins installation as a standard wizard. Click “Next ” through the dialog screens and agree to the license to complete installation. The screen shown below and to the right asks if you would like to install shortcuts in the Start Menu, and if you would like to add a default pair of COM ports during installation. Afterwards, Windows may bring up the “Found New Hardware Wizard.” This is because the virtual COM ports were detected. Allow Windows to search and install the software drivers automatically.
NOTE: This should happen twice, since two COM ports are being installed. Setting up the WiSnap Configuring the WiSnap over RS-232 You can configure WiSnap settings with the RS-232 interface to an open serial port on your PC, or by using an USB-to-Serial adapter like the one.
Once connected, launch your Terminal program, such as JavaTerm, PuTTY, TeraTerm, or HyperTerminal. Configure the port for 9600 baud, 8 data bits, 1 stop bit, no parity, and no flow control. Powering the WiSnap unit will print out a few boot messages to the terminal, if configured properly. Configuring the WiSnap over ad-hoc Wi-Fi If RS-232 is not available, you can connect to the WiSnap’s ad-hoc network, and configure it wirelessly. The default network SSID that the module creates is named “WiSnap-xxxx,” where xxxx is a unique identifier number. Once connected to the WiSnap's ad-hoc mode, you may need to assign an IP address to your computer in the same subnet, so that you can use telnet to log into the device for configuration. The device has an IP address of 169.254.1.1 and uses port 2000.
Use this command to open a connection: telnet 169.254.1.1 2000 The device should reply with.HELLO., indicating that you are connected. Whether using RS-232 or telnet over Wi-Fi, send three “dollar signs” ($$$) to the WiSnap to enter command mode and you should see the reply “CMD.” You can set up the WiSnap to join your existing wireless network with a few simple commands. Set wlan ssid mynetwork // Network name set wlan chan 0 // Wireless channel – “0” scans all channels set wlan phrase secretpassword // Passphrase for WPA networks set wlan key abcd1234 // Passkey for WEP networks set wlan join 1 // Auto-join stored network settings on boot save // Save these settings reboot // Restart and connect!
Note the IP address that is assigned to your WiSnap after connecting (or use the “get ip” command). You’ll need it for the next step. WiSnap boot-up messages and entering command mode (below-left) The 'get ip' command shows the WiSnap's IP and port, among other info (below-right) Opening a TCP/IP connection to the WiSnap We’re now ready to beginning communicating with the WiSnap over Wi-Fi. Open a terminal connection to communicate with our virtual COM port “CNCB0” that was installed in the beginning of this guide, but instead with these settings: 115200 baud, 8 data bits, 1 stop bit, no parity, and no flow control.
Download and extract the “com2tcp testapp,” that can be downloaded from. Open a command prompt (cmd.exe) and navigate to the com2tcp folder that was extracted. Use the following command to initiate a TCP connection to the WiSnap: testapp -c. CNCA0 -t n -h 169.254.1.1 -p 2000 ('CNCA0' is the COM port desired, 169.254.1.1 is the IP address of the WiSnap, and 2000 is the port number of WiSnap. Run testapp.exe without parameters to see all options.) NOTE: After running the command above, if you see the message: “DSR is OFF,” you will need to change the DSR line on the com0com Null-Modem Emulator. Head to your Start Menu’s list of programs, and run the Setup application located in the com0com folder (Also located at 'C: Program Files com0com setupg.exe') We will need to inverse the DSR line so that it can be used for communication.
Double click the green dots on both sides of the DSR line, to look like the example on the right. Make sure that you close any open connections to the virtual ports (like the CNCB0 connection from earlier) that we’ve adjusted before clicking “Apply,” and closing the program. Once the DSR line has been set, you may re-open the connection to the CNCB0 port and use testapp again to open a connection. This time, you should see “DSR is ON.” Once the connection is established, you will see '.HELLO.'
in the terminal window that is connected to CNCB0. Now you should be able to send and receive data between CNCB0 and the WiSnap device! You can use any other application to access the port, not just JavaTerm!.Some Windows applications do not recognize the CNCB0 port (or other Virtual Ports).
You can rename the COM ports to more conventional names using the com0com setup app shown earlier, in the fields at the top of that window. Please see the for setup instructions and a full command reference., or to order.