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 HERE.
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 vice-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 the installation. The screen is 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.
Afterward, 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.
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.
||// Network name|
||// Wireless channel – “0” scans all channels|
||// Passphrase for WPA networks
||// Passkey for WEP networks|
||// Auto-join stored network settings on boot|
||// Save these settings|
||// Restart and connect!|
Note the IP address that is assigned to your WiSnap after connecting (or use the “
ip” command). You’ll need it for the next step.
WiSnap boot-up messages and entering command mode (below-left). The "
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 at 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 HERE.
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:
-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.