Wireless Communication
This page describes different wireless network topologies and includes suggestions on system design.
Last updated
This page describes different wireless network topologies and includes suggestions on system design.
Last updated
System Requirements
30+ motor drivers (nodes) on the same network
Minimal latency
Nodes should be able to leave and join the network without affecting the operation
Internet connection through a gateway/router
Here, you will find the descriptions of the technical terms used in wireless communication.
A typical Wireless Communication System can be divided into three units: the transmitter, the channel and the receiver. Below, block diagram of a wireless communication system in more details can be found.
The Transmission Path
The Transmission path consist of encoder, encryption, modulation and multiplexing.
Signal from the source is passed through the source encoder first, which converts the signal coming from the soruce into a convinient form to appyle signal procesing techniques. In this process, reduntant information is removed from the signal in order to maximise the utilization.
This signal is then encrypted so that the signal and the information is secured and doesn’t allow any unauthorised access.
Channel encoding is a technique that is applied to the signal to reduce the impairments like noise, interference, etc. During this process, a small amount of redundancy is introduced to the signal so that it becomes powerful against noise.
Then the signal is modulated using a suitable modulation technique (like PSK, FSK and QPSK etc.), so that the signal can be easily transmitted using antenna.
The modulated signal is then multiplexed with other signals using different Multiplexing Techniques like Time Division Multiplexing (TDM) or Frequency Division Multiplexing (FDM) to share the valuable bandwidth.
The Channel
The channel indicates the medium of transmission of the signal. In nature, the channel is random, highly variable and so unpredictible. As a result, passing through the channel, signal may scatter, distorted or become noisy and the final signal may be filled with errors.
The Reception Path
The purpose of the reception path is to collect the signal from the channel and reproduce it same as the source signal. The components of thi path are demultiplexing, demodulation, channel decoding, cecryption and source decoding. It is obvious from the names that the reception path works as an inverse version of the transmission path.
The signal from the channel is received by the demultiplexer and is separated from other signals.
The individual signals are demodulated using appropriate demodulation techniques and the original message signal is recovered.
The redundant bits from the message are removed using the channel decoder.
Since the message is encrypted, decryption of the signal removes the security and turns it into simple sequence of bits.
Finally, this signal is given to the source decoder to get back the original transmitted message or signal.
There are several options of network topologies that should be considered. Ignoring the most simple two connections (point to point and daisy), other topologies are mentioned with their advantages and disadvantages below.
This topolgy consists of one cable runnning from one end to another. Each node is connected to a central cable. A signal transmitted from the source node, travels in both directions to all nodes until it reaches the destination node, which accepts the data. If the address of the delivered signal doesn’t match that of the receiving node, the data portion of the signal is ignored.
Very simple to arrange.
Nodes can be added easily since the system only requires a coaxial cable.
Cheap to use.
Entire system depends on one cable, a problem in the cable causes the entire system to fail.
Although the nodes can be easily added, since transmission happens via just one cable, data collision and data traffic are high, data transmission speed is low.
Also, using just one cable makes troubleshooting almost impossible.
A star topology is the one in which each surrounding node is connected to a central hub or switch. It is the most commonly used network topology for LAN. The central hub functions as the server for the clients. All the network traffic passes through the central hub and this is the only requirement for the topology to be classified as a star topology; the network doesn’t have to resemble a star in the physical arrangement.
There is no intermediate device between the central device and end devices.
Most common topology for LAN, because it is easy to design and implement.
Allows less cabling.
Whole network can be managed from one-point.
Problem at one node doesn't affect other nodes, so troubleshooting is possible.
New nodes can be added easily.
Opposing the mesh network, not every node must be 'awake' all the time. Nodes outside of the transmission line can stay in the sleeping mode, consuming almost no power.
Fail of the central hub causes the entire system to fail, meaning single point of failure.
The network performance and the overall bandwidth are limited by the technical spesifications of the central hub (may not be a disadvantage, technical spesifications affecting the network will be checked).
A star network is often combined with a bus topology. The central hub is then connected to the backbone of the bus. This combination is called a TREE. Tree is an example of a hybrid connection.
Ring connection is very similar to daisy connection, however nodes are arranged in a closed loop. Data travels through the circle visiting each node until it reaches its destination.
Only one node can transmit data at a time, so packet collisions are reduced and data transmission is efficient.
Troubleshooting is easier compared to the more complicated topologies connecting every node to each other.
If one node fails whole system will go down.
Due to the uni-directional ring, a data must go through all the nodes.
When node number goes up, transmission slows down beacuse the network badnwidth is shared by all devices.
Addition or removal of a node is very hard and may cause a problem in a network activity.
In order to the system to work, all nodes must be turned on.
A mesh topology is one in which the nodes connect directly to the many other nodes. It consists of an elaborate structure of point-to-point interconnections among the nodes. You can have a partial mesh topology, where some nodes have two or more connections, or a full mesh topology, where all nodes are fully connected.
In a mesh topology, central device is connected to intermediate devices which carry the information further to end devices. All the devices except the end devices can communicate with each other.
Mesh structure allows two different methods of data transmission:
Routing - where the nodes use logic to determine the shortest path from source to destination, and
Flooding, where the information is sent to every node in the network.
Very stable and very reliable.
Beacuse of large degree of interconnection, the network is resistant to failure. In other words, there is no single point of failure.
Requires a lot of cabling.
Labor-intensive and expensive.
A hybrid topology is one in which two or more distinct topologies are combined to build a network in such a way that it doesn’t exhibit any of the standard topologies. Any two or more topolgies can be combined to obtain any wanted structure. So much to think about, will be considered later together with tree connection.
The tree topology can be viewed as a hierarchical arrangement of star networks as it has a parent-child hierarchy to how the nodes are connected.
Network expansion and addition of new nodes are easy.
As each network branch can be individually assessed, troubleshooting is easier.
The entire network depends on the central bus, which presents a single point of failure.
Tree topology can be expensive due to the amount of cabling required.
Due to the hierarchical structure, it might be difficult to configure.
Zigbee is a low-power, low data rate, and close proximity (i.e., personal area) wireless ad hoc network.
Ad hoc is a decentralized type of network. The wireless network does not depend on access points. Instead, each node participates in routing by forwarding data to other nodes, so the determination of which nodes forward data is made dynamically on the basis of network connectivity and the routing algorithm in use.
Its range is limited in 10-30 meters. Although Zigbee supports star and tree networks, in order to increse the range mesh configuration with intermediate devices must be used and in IoT applications this option is the more popular one.
A downside is that Zigbee uses different frequency bands in different countries. In USA and in Europe it operates in sub-GHz bands. (?)
Philips Hue Lightbulb uses Zigbee.
a paper on Zigbee mesh network design and implementation
Zigbee has a data throughput of 250 kbps. Ina standard Zigbee network devices divideed into 3 categories. Coordinator, router and end device.
Coordinator (ZC): Coordinator is the source and the starter of the network. There is exactly one coordinator in each network. It selects a PAN ID and a channel to start the network.
Router (ZR): Routers are the intermediate nodes relaying the information.
End Device (ZE): End devices can recieve data from their parents but cannot forward it. And in contrast with others, they do not always have to be turned on.
XBee is the Zigbee protocol developed by Digi company and the name of the wireless communication devices.
Using Digi XCTU software, an XBee network can be tested, analized, configured, updated and range testings on an XBee network can be done.
XBee Module Description & Configuration
Compared to Bluetooth Classic, range and speed is greater in Bluetooth 5. It offers 2 Mbps speed and reaching 700 meters range. The catch is that, not at the same time. When data transfer speed is increased, range is decreased.
There is a Bluetooth range estimator in the link below.
https://www.bluetooth.com/learn-about-bluetooth/key-attributes/range/#estimator
Wi-Fi 5 might not be an option at all beacuse it uses only 5 GHz frequency band. Although data rate is higher congestion is lower in the 5 GHz frequency band, it is the worse when it comes to penetrating through solid objects.
Wi-Fi Alliance claims that HaLow version is designed specifically IoT in mind. It uses 900 MHz license-exempt band to provide extended range Wi-Fi networks, compared to conventional Wi-Fi and Bluetooth networks operating in the 2.4 GHz and 5 GHz bands. So, given the same transmission and the antennas, range of HaLow is much more higher.
The first downside is that, there is no global standard for 900 MHz unlike 2.4 GHz used everywhere in the world.
The second, and the biggest downside is latency. If we use sub - 1 GHz frequencies, data rate will be low, resulting in very big latencies compared to a Wi-Fi, Bluetooth or Zigbee connected device.
too much information on HaLow
The latest Wi-Fi standard offers faster data transfer speeds. If Wi-Fi router is used with a single device, maximum potential speeds should be up to 40% higher with Wi-Fi 6 compared to Wi-Fi 5. This is accomplished through more efficient data encoding, resulting in higher throughput. So, more data is packed into the same radio waves.
Wi-Fi 6 is also claimed to be work better in crowded areas. Since there are a lot of Wi-Fi connected devices in malls, it usually slows down. However, Wi-Fi 6 will improve each user’s average speed by “at least four times” in congested areas with a lot of connected devices.
How?
Wi-Fi 6 can now divide a wireless channel into a large number of subchannels. Each of these subchannels can carry data intended for a different device. This is achieved through something called Orthogonal Frequency Division Multiple Access. The Wi-Fi access point can talk to more devices at once. The goal behind OFDMA is to reduce latency and increase network efficiency--especially in high-demand environments like stadiums, conference halls, and other public spaces
The new riderless standard also has improved MIMO—Multiple In/Multiple Out. This involves multiple antennas, which let the access point talk to multiple devices at once. With Wi-Fi 5, the access point could talk to devices at the same time, but those devices couldn’t respond at the same time. Wi-Fi 6 has an improved version of multi-user or MU-MIMO that lets devices respond to the wireless access point at the same time.
Wireless access points near each other may be transmitting on the same channel. In this case, the radio listens and waits for a clear signal before replying. With Wi-Fi 6, wireless access points near each other can be configured to have different Basic Service Set (BSS) “colors.” This “color” is just a number between 0 and 7. If a device is checking whether the channel is all clear and listens in, it may notice a transmission with a weak signal and a different “color.” It can then ignore this signal and transmit anyway without waiting, so this will improve performance in congested areas, and is also called “spatial frequency re-use.”
As always, both the sender and the receiver need to support the latest generation of Wi-Fi for us to gain the advantages.
Wi-Fi 6 also brings lower latency, more simultaneously deliverable data, and improved power efficiency.
Wi-Fi 4 can be both used in 2.4 and 5 GHz frequency bands.
The ESP module enables microcontrollers to connect to 2.4 GHz Wi-Fi, using IEEE 802.11b/g/n. This module includes both Wi-Fi and BLE, and they can work perfectly together.
ESP Mesh networking system allows numerous devices (nodes) spread over a large physical area (both indoors and outdoors) to be interconnected under a single WLAN.
Normally, Wi-Fi network is a multi point-to-point structure with one Access Point and every other node connected to that. This causes limited coverage area and limited number of nodes depending on the capacity of the AP.
In the ESP-Mesh stucture this is not the case. Nodes do not have to connect to a central node. Instead, nodes are allowed to connect with neighboring nodes. Nodes are mutually responsible for relaying each others transmissions. This allows an ESP-Mesh network to have much greater coverage area as the nodes can still achieve interconnectivity without needing to be in range of the central node.
Total number of nodes in an ESP-MESH network is dependent on the maximum number of layers permitted in the network, and the maximum number of downstream connections each node can have. Both of these variables can be configured to limit the size of the network.
Nodes in this tree network can be stationary, softAP or both. Stationary nodes are only allowed to have one upstream connection while SoftAP nodes are allowed to have one upstream connection and multiple downstream connections.
Root Node : The root node serves as the only interface between the ESP-Mesh network and an external IP network. The root node is connected to a Wi-Fi router and relays packets to/from the external IP network to nodes within the ESP-Mesh network. There can only be one root node and the root node’s upstream connection may only be with the router.
Leaf Nodes: A leaf node is a node that is not permitted to have any child nodes (no downstream connections). Therefore a leaf node can only transmit or receive its own packets, but cannot forward the packets of other nodes. If a node is situated on the network’s maximum permitted layer, it will be assigned as a leaf node. This prevents the node from forming any downstream connections thus ensuring the network does not add an extra layer.
Intermediate Parent Nodes: Connected nodes that are neither the root node or a leaf node are intermediate parent nodes. An intermediate parent node must have a single upstream connection (a single parent node), but can have zero to multiple downstream connections (zero to multiple child nodes). Therefore an intermediate parent node can transmit and receive packets, but also forward packets sent from its upstream and downstream connections.
Idle Nodes: Nodes that have yet to join the network are idle nodes. Idle nodes will attempt to form an upstream connection with an intermediate parent node or attempt to become the root node under the correct circumstances.
Every node in ESP-Mesh that is able to form downstream connections (i.e. has a softAP interface) will periodically transmit Wi-Fi beacon frames. By means of beacon frames other nodes can detect a node's presence and know its status. Idle nodes listen to beacon frames to detect potential parent nodes which it will have an upstream connection with. RSSI indicates the signal strenght of a potential upstream connection. There is a threshold mecanism implemented in ESP-Mesh to prevent weak connections. When an idle node detecks a signal below the preconfigured threshold, it ignores that node and does not form an upstream connection with it. Also an RF shielding object can be placed in front of a potential parent node to block a connection.
Diagram above demonstrates the automatic parent node selection of an idle node. The idle node has 2 criteria while choosing the parent node:
Layer of the potential parent node. This ensures keeping the layer count as minumum as possible.
Number of child nodes the potential parent has. This balances the number of child nodes of the parent nodes at the same layer.
Within the range, the idle node will choose a parent in the lowest layer and has a fewer number of child nodes.
User may also define an algorithm for selecting a preferred parent node, or force a node to only connect with a specific parent node.
Each node in the ESP-Mesh network has a routing table including MAC addresses of its own and the nodes in its subnetwork. Whether a coming packet should be forwarded upstrem or downstream is decided as follows:
If the packet’s destination MAC address is within the current node’s routing table and is not the current node, select the subtable that contains the destination MAC address and forward the data packet downstream to the child node corresponding to the subtable.
If the destination MAC address is not within the current node’s routing table, forward the data packet upstream to the current node’s parent node.
Node Mission Selection:
The assignment of the missions can be made manually by the user or automatically. In the automatic root node selection process voting is done among the idle nodes. Each idle node will transmit their MAC addresses and router RSSI values via Wi-Fi beacon frames. The MAC address is used to uniquely identify each node in the network whilst the router RSSI is used to indicate a node’s signal strength with reference to the router.
Each node will then simultaneously scan for the beacon frames from other idle nodes. If a node detects a beacon frame with a stronger router RSSI, the node will begin transmitting the contents of that beacon frame (i.e. voting for the node with the stronger router RSSI). This result in the beacon frame with the strongest router RSSI being propagated throughout the network. After all iterations, each node will individually check for its vote percantage. If the percantage is larger than a threshold (%90 default), the node becomes the root node.
Setting a low vote percentage threshold can result in two or more nodes becoming root nodes within the same network leading to the building of multiple networks. If such is the case, ESP-MESH has internal mechanisms to autonomously resolve the root node conflict. The networks of the multiple root nodes will be combined into a single network with a single root node. However, root node conflicts where two or more root nodes have the same router SSID but different router BSSID are not handled.
While selecting the root node manually, selected root node connects to the router directly and other nodes go through a election process. It can be seen from the above figure that after a root node is selected, other nodes choose and connect to their preferred parent node layer by layer. The nodes at the maximum layer become leaf nodes, which are not allowed to have downstream connections.
Parent node selection can also be made automatically by the ESP-Mesh, a criteria for selecting the parent node can be defined by the user or the user can configure the nodes to have certain parent nodes.
Asynchronous Power-on
Nodes do not have to power-on simultaneously. In this case, there are some rules that ESP-Mesh network follows.
If a root node already exists in the network, delayed network do not attemp to be a root node even if it has a stronger RSSI with to router. It acts as any idle node joining the network.
A node can join the network later, become an intermediate parent node and be a preferred parent node. This causes parent node switching.
If an idle node has a designated parent node which is delayed, the idle node will not attempt to form any upstream connections in the absence of its designated parent node. The idle node will remain idle indefinitely until its designated parent node powers-on.
Figure below shows an example network configuration with delayed nodes.
The synchronous power-on network layout can still be reached if the user manually switches the root node.
Node Failures
If a root node breaks down, second layer nodes will start an election process. The one with the strongest RSSI will become the new root node and de remaining second layer nodes will form an upstream connnection with it. If root and multifle downstream layers break down, shallowest layer that is still working will initialize the election process.
If the root node is designated by the user, when it breaks down no election process will be started.
If an intermediate parent node breaks down, the disconnected child nodes will initially attempt to reconnect with the parent node. After multiple failed attempts to reconnect, each child node will begin to scan for potential parent nodes. If other potential parent nodes are available, each child node will individually select a new preferred parent node.
If a child node's parent is designated bu the user, when the parent node breaks down, child node does not attempt to connect to any other parent node.
The performance of a ESP-Mesh network is evaluated based on network building time, healing time, per-hop latency, network node capacity. For example, with the following test conditions,
Number of test devices: 100
Maximum Downstream Connections to Accept: 6
Maximum Permissible Layers: 6
the results are:
Network Building Time: < 60 seconds
Healing time:
Root node break down: < 10 seconds
Child node break down: < 5 seconds
Per-hop latency: 10 to 30 milliseconds.
All ESP32 development boards and modules of Espressif:
https://docs.espressif.com/projects/esp-idf/en/stable/esp32/hw-reference/modules-and-boards.html
Development boards of some other popular brands and comparisons:
https://makeradvisor.com/esp32-development-boards-review-comparison/
-Why ESP32 not ESP8266?
The ESP32 is dual core 160MHz to 240MHz CPU whereas the ESP8266 is a single core processor that runs at 80MHz (faster Wi-Fi).
More GPIO on ESP32. (17 on 8266 / 30-36 on 32)
Touch, temperature and hall effect sensors are available on ESP32.
An ESP32 coordinator device can know the time using NTP (Network Time Protocol) since it will be connected to the internet.
NTP is a standard Internet Protocol (IP) for synchronizing the computer clocks to some reference over a network. The protocol can be used to synchronize all networked devices to Coordinated Universal Time (UTC) within a few milliseconds precision (50 milliseconds in the public Internet and under 5 milliseconds in a LAN environment).
An article named 'Relative Location Estimation in Wireless Sensor Networks'. Can't tell if it is useful.
It can easily be seen that ESP32 is cheaper. The first two lines of the table above are the prices of ESP32 chip + development board together, ready to hookup to a computer or an Arduino. Xbees are expensive and their development boards (Explorer) are sold seperately which are hard to find in Turkey. Also, we need different Explorers for different connections. Explorer USB is easy to find, for example, but in order to connect the Xbee to an Arduino, Explorer Shield is necessary, which I couldn't find a store in Turkey that sells them.
In order to achieve longer ranges more stably with ESP32, a mesh configuration must be used. For the time being, connecting a group of devices that are working together and close to each other to the root node point-to-point seems to be a good option. After that, -since a mesh network can only have one root node- parent devices (which will work as routers) can be used to carry the signal from the root to the other nodes at relatively far distances from the root device. This kind of a network topology is called a tree topology, which is effective for us since we do not wish the end devices (leaf nodes or parent nodes without any child nodes) to be talking to each other. In this network only the root node will be connected to the internet (via the router in the store), recieving and relaying the information to other nodes.
If Zigbee protocol is decided to be used, an Xbee - Wi-Fi device is most sensible option since it can connect to the router device of the store without needing any other hub or a gateway to make the two different communication protocols compatible with each other. However with or without the Wi-Fi addition, they all are too expensive and hard to find in Turkey.
When Zigbee networking system with Xbee devices and Wi-Fi networking system with ESP32 devices are compared, ESP32 has decisive advantages over Xbee, some of them are being price and accessibility.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/mesh.html
In this manual, firsly, internal_communication in the esp-idf library is being worked on. The operating system used is MAC OS.
After all the steps are done until Step 5 in the link -https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/index.html#get-started-connect-, the following commands are entered to the terminal.
Then, device is connected and the port is checked by below command. Device name is the one starting with /dev/cu and the one appeared second.
Configuration can be done by entering the commands below.
menuconfig command pops up a screen with many options in order to configure the mesh, internal clock, wifi SSID & password etc.
Http communcation between two ESP32s is failed. The codes are named HTTPClient&HTTPServer. Several methods that were tried are:
Instead of server choosing its own IP, manually assigning an IP address.
Creating a DNS for the customized IP and putting that into the 'begin' command in the client code.
In both methods the error was the same. Although server can be reached from any browser, it cannot get any http request from the client device. Also, the client sends requests to addresses, except for the one that was created by the server.
Feature
Bluetooth Classic
Bluetooth 4.x
Bluetooth 5
IEEE 802.15.4 - ZigBee
IEEE 802.11ah - HaLow
Radio Frequency (MHz)
2400 to 2483.5
2400 to 2483.5
2400 to 2483.5
868.3, 902 to 928, 2400 to 2483.5
900
Distance/Range (meters)
Up to 100
Up to 100
Up to 200
Up to 150
Up to 1000
Medium Access Technique
Frequency Hopping
Frequency Hopping
Frequency Hopping
CSMA/CA
Restricted Access Window
Nominal Data Rate (Mbps)
1-3
1
2
0.02-0.25
0.15-7.8
Latency (ms)
<100
<6
<3
<4
̃1000
Network Topology
Piconet, Scatternet
Star-bus, Mesh
Star-bus, Mesh
Mesh
Star-bus
Multi-hop Solution
Scatternet
Yes
Yes
Yes
Up to 2 hops
Profile Concept
Yes
Yes
Yes
Yes
No
Nodes/Active Slaves
7
Unlimited
Unlimited
Unlimited
Unlimited
Message Size (bytes)
Up to 358
31
255
100
100
Certification Body
Bluetooth SIG
Bluetooth SIG
Bluetooth SIG
ZigBee Alliance
IEEE
Product
Price
ESP32 Wi-Fi + Bluetooth Module
ESP32 Wi-Fi + Bluetooth Module
Xbee Wi-Fi Module (PCB Antenna)
Xbee Wi-Fi Module (RPSMA Antenna)
Xbee Explorer USB