
Understanding your WiFi network and how to successfully get your IoT device on to your network can be tricky for the uninitiated. In this guide you’ll learn some networking basics to help you along.
WiFi and Wireless, what’s the difference?
Wireless is a generic term that just means there’s no wires. The term “wireless” tends to be used to describe a requirement i.e. “it needs to be wireless”, whereas WiFi is a particular standard, and one of several others like Bluetooth or Zigbee, for example.
Access Point Mode or Station Mode?
Typically devices can run in one of 2 modes: Access Point Mode or Station Mode (often called Client Mode). Station Mode (STA) is what most people would consider the normal mode for a WiFi device. A device uses Station Mode to join a network that already exists, exactly like your smartphone does when its connects to your WiFi network at home. In this instance your phone is running in Station Mode.
In Access Point Mode (AP) the device is the Access Point and so becomes an entity that everything else can connect to, rather than it connecting to a network.
In an industrial IoT context, Access Point Mode is generally for set up and then once configured the unit will exit AP mode and run in Station Mode for the rest of the IoT application.
Demystifying IP addresses
An IP address is a string of digits that define the location of a device on a network. The address comprises of 4 groups of numbers separated by dots and it is very much like a street address in that it must be unique.
IP addresses can be static or dynamic (more on this later). In a domestic scenario, typically when a device connects to your home network it is dynamically assigned one by the router from the addresses currently not in use.
IP addresses have banded designations: a numerical range of addresses that have been reserved for specific uses.
What does DHCP mean?
DHCP stands for Dynamic Host Configuration Protocol. It is a network protocol that allows a server to automatically assign an IP address to a device from a defined range of addresses. Basically, when a device logs on to your network and requests an IP address from the Access Point, it will be assigned one automatically from the remaining free addresses.
At some point this IP address may get reassigned to another device, depending on network traffic – it’s not fixed. It may last for a couple of days or a couple of weeks depending on your network. However, if the device is being used every day it will likely keep the same IP address.
Most networks have DHCP enabled and so during setup of Define Instruments products with Wifi modules, if the “Use DHCP” checkbox in the WorkBench configuration software is ticked then your device can automatically be assigned a unique IP address.
What are Port numbers?
If your IP address is like a street address, a port is like a cubbyhole at that address where incoming mail is sorted: one for bills, another for letters, another for junk mail, etc. Different ports for different types of communications.
For example: for Modbus, generally port 502 is used. That’s because this port number has been purchased by the Modbus Organization for exclusive use with devices using Modbus communications.
Port numbers range from 1 to 65,535. A list of commonly known and registered ports numbers can be found on Wikipedia.
Where do I find which port number to use?
Generally, this is determined by the protocol you’re using, e.g. MQTT has a specific port number (port 1883) and so do websites (port 80 for http) refer to the above link for guidance on the standard port assignations.
Otherwise, talk to your System Admin and they can help you identify a port that is not in use by any other protocol on your network and can be dedicated to your IoT application.