Networking and Communication¶
Wireless communication¶
Range vs Power
Signal Penetration
3G-4G
Antennas¶
- Radiation pattern
Antenna based on the frecuency
Video of wavelenght penetration comparison
Monopole¶
Monopole antenna is the simplest form of antenna, which is basically just a piece of un-shielded wire. It’s very common in radio receivers because they are cheap and easy to repair. However they are not as effective as Dipole antennas.
Calculation of wire length for antenna
If the antenna is a quarter wave monopole antenna, then its length should be a quarter of the signal wavelength.
Length (m) = c / frequency / 4
The more precise wire length is, the better signal you should get ideally. If you are using Coaxial Cable, it doesn’t matter how long the cable is with shielding, all that matter is the exposed wire (the part that is without the shielding). Alternatively if you are using a wire like copper wire, just cut it to the calculated length and you have a monopole antenna :)
Dipole antenna¶
Dipole antennas has a simple design. It’s basically just a monopole antenna with a ground sleeve at under the active element. The ground sleeve can supposedly boost the performance considerably
Half Wave dipole antenna¶
A half-wave dipole antenna consists of two quarter-wavelength conductors placed end to end for a total length of approximately L = λ/2
Helical antenna¶
Helical antennas are spring-shaped, directional circular polarized antennas. The number of turns of coil determines the gain of the antenna.
Patch antenna¶
Patch antennas are also directional, and can be found in linear and circular polarization. They generally have less directionality than Helical, and smaller foot-print.
Make your own antennas¶
Antenna step by step build tutorial
Range-Power-Dbi Gain¶
Power - range is exponential
You often hear “higher gain antenna has longer range”, but don’t be fooled! Antennas doesn’t amplify radio signals, but rather just changes the radiation pattern, which is a trade-off between coverage and range. Antenna gain is a reflection of the maximum range you can get.
We should avoid blindly increasing the power of video transmitter to achieve longer range, simply because it might not be legal, and it will consume more power and generate more heat. Always start with upgrading your antennas when trying to improve range :)
What is dB?
dB means decibels, we use this unit to measure the level of sound, but in radio we also use dB to measure signal strength.
dB is on a non-linear, logarithmic scale. For example, by increasing dB by 3, the signal strength doubles. (note: signal strength, not range)
Apart from signal strength, both antenna gain and VTX power can be expressed in dB too.
Why use dB you might wonder. Well, for some applications, dB is much easier to work with, because the math is simpler. You just add or subtract numbers, there is no multiplication or division.
Radio TX datasheet examples
The best thing to remember is, every 3dB increase, will double the signal strength, but an increase of 6dB is required to double the range. From this you can ascertain that replacing a 200mW VTX with a 400mW will NOT double your range, but increase it by approximately 50%. It is also worth noting that as the power goes up, the rate at which dB increases goes down, further diminishing returns.
Caculation of FREE SPACE PATH loss
Distance = 10^((FSPL-LM-32.44)-20*log10(f))/20)
Where:
- FSPL (Free Space Path Loss) = TX Antenna Gain + RX Antenna Gain + TX Power – RX Sensitivity
- LM = Link Margin
- f = frequency in MHz (mega hertz)
Understand Antenna Gain
Antenna gain is the measure of antenna power in decibel (dB), which is equal to 10*log(Pout/Pin).
Don’t worry about it, just remember that the higher the gain, the more directional an antenna is – more range, narrower beam width.
Every 6dB increase in antenna gain, should in theory, doubles the range. However, as mentioned, directional antennas are not amplifiers. It’s only focusing all the energy into a narrower beam.
A radiation pattern of the hypothetical isotropic antenna at 0db gain. It’s a nearly perfect sphere in both vertical and horizontal axis.
This is a standard omni-directional 3dB rubber duck antenna. Notice it has significant signal loss on the top and bottom (90/270 degree).
And here we have a directional antenna of 8dB (a patch antenna). As you can see, majority of the signal are focus on one direction to the right (0 degree) just as we expected from a directional antenna. But we are not getting much signal on the other direction (180 degree).
Frecuencies¶
Frecuency spacing
Professional HAM radio datachannel list
AM-FM-SIGNAL
Radio jamming
Jamming gun
Antenna Connectors¶
SMA, RP-SMA, MMCX and U.FL are the three types of connectors.
Some people find it difficult to get their heads around the different types. Even manufacturers could sometimes get it wrong. When buying FPV equipment with a SMA connector, we urge you to double check if the product description matches product image. If not, confirm with the seller to avoid surprises. Differences of RP-SMA and SMA Antenna Connectors
SMA and RP-SMA connectors are the original connectors used in FPV equipment. They are still very common thanks to their robustness and versatility. However they are also fairly bulky and heavy.
Another advantage of SMA is the 500+ mating cycles, which a lot more than MMCX and U.FL. All the receivers I’ve come across use SMA or RP-SMA and rarely use other connectors, because weight and space is not really an issue on the receiving side.
SMA stands for Sub-Miniature Version A. These are coaxial RF connectors developed in the 1960s.
RP-SMA stands for Reverse Polarity SMA). It is a variation of the SMA connector which reverses the gender of the interface.
There is no difference with video/signal quality between these connectors, but you’ll read further down why we even have these 2 different types. Generally speaking, SMA appears to be more popular choice of connector especially in the mini quad (racing drone) industry.
Here is a comparison table of the SMA antenna and RP-SMA antenna connectors.
SMA MALE-FEMALE
SMA MALE-FEMALE
U.FL Connectors
As known as IPEX connectors sometimes, U.FL has been a popular connector choice in many small size video transmitters and antennas. They are also very popular in radio receivers due to their compact sizes.
The connector has no thread, it’s attached by popping them together. They are a lot more fragile than standard SMA/RPSMA connectors and they have a very limited mating cycle, only about 30+, according the datasheet.
MMCX Connectors
SMA is too big and heavy, U.FL is too fragile, and the MMCX is the great balance of the two!
MMCX connectors are slightly smaller and lighter than SMA connectors, but much tougher than U.FL. Rated for 100+ mating cycles, more and more VTX and antennas are picking up this connector
Polarisation¶
NRF24-Communication¶
Caution working voltaje of : 3 ~ 3.6V Max
The NRF24L01 integrates an RF transceiver (transmitter + receiver) at a frequency between 2.4GHz to 2.5GHz, a free band for free use. The transmission speed is configurable between 250 Kbps, 1Mbps, and 2 Mbps and allows simultaneous connection with up to 6 devices.
The NRF24L01 also incorporates the necessary logic to make communication robust, such as correcting errors and forwarding data if necessary, freeing the processor of this task. The control of the module is done through the SPI bus, so it is easy to control it from a processor such as Arduino.
The band of frequency is of 2400 to 2525 MHz, being able to choose between 125 channels spaced at the rate of 1MHz. It is recommended to use the frequencies from 2501 to 2525 MHz to avoid interference with Wi-Fi networks.
But before starting with the example, you have to know that the NRF24L01 module is a transceiver and not a receiver transmitter.
A receiving transmitting equipment can send radio messages and receive them simultaneously because both circuits, although very similar, are isolated from each other and can be operated independently.
- Wiring
The first thing you have to do is download the latest version of the RF24 library and import it into your Arduino IDE, for this in the menu bar go to Sketch> Import Library> Add Library
The following example shows the sending of a text string from an Arduino sender to an Arduino receiver, which upon receiving the text shows it by serial port.
Sender Code
```
include ¶
include ¶
include ¶
include ¶
const int pinCE = 9; const int pinCSN = 10; RF24 radio(pinCE, pinCSN);
// Single radio pipe address for the 2 nodes to communicate. const uint64_t pipe = 0xE8E8F0F0E1LL;
char data[16]=”Hola mundo” ;
void setup(void) { radio.begin(); radio.openWritingPipe(pipe); }
void loop(void) { radio.write(data, sizeof data); delay(1000); } ```
Receiver
```
include ¶
include ¶
include ¶
include ¶
const int pinCE = 9; const int pinCSN = 10; RF24 radio(pinCE, pinCSN);
// Single radio pipe address for the 2 nodes to communicate. const uint64_t pipe = 0xE8E8F0F0E1LL;
char data[16];
void setup(void) { Serial.begin(9600); radio.begin(); radio.openReadingPipe(1,pipe); radio.startListening(); }
void loop(void) { if (radio.available()) { int done = radio.read(data, sizeof data); Serial.println(data); } } ```
More tutorials
HC12-Communication¶
The HC-12 is a half-duplex wireless serial communication module with 100 channels in the 433.4-473.0 MHz range that is capable of transmitting up to 1 km.
The HC-12 is a half-duplex 20 dBm (100 mW) transmitter paired with a receiver that has -117 dBm (2×10-15 W) sensitivity at 5000 bps.
Paired with an external antenna, these transceivers are capable of communicating up to and possibly slightly beyond 1 km in the open and are more than adequate for providing coverage throughout a typical house.
-
Setup & Configuration AT Serial Commands
-
Wiring
Pro´s
- Control and communication over Serial. Able to use simple software serial protocols.
- A receiving transmitting equipment can send radio messages and receive them simultaneously because both circuits, although very similar, are isolated from each other and can be operated independently.
Con´s
- Not able to resolve lost package data
- Usually expensive setup
More and more
Example Code Send-Receive
``` /* HC12 Send/Receive Example Program 1 By Mark J. Hughes
Connect HC12 “RXD” pin to Arduino Digital Pin 4 Connect HC12 “TXD” pin to Arduino Digital Pin 5 Connect HC12 “Set” pin to Arduino Digital Pin 6
Transceivers must be at least several meters apart to work.
*/
include ¶
const byte HC12RxdPin = 4; // Recieve Pin on HC12 const byte HC12TxdPin = 5; // Transmit Pin on HC12
SoftwareSerial HC12(HC12TxdPin,HC12RxdPin); // Create Software Serial Port
void setup() { Serial.begin(9600); // Open serial port to computer HC12.begin(9600); // Open serial port to HC12 }
void loop() { if(HC12.available()){ // If Arduino’s HC12 rx buffer has data Serial.write(HC12.read()); // Send the data to the computer } if(Serial.available()){ // If Arduino’s computer rx buffer has data HC12.write(Serial.read()); // Send that data to serial } } ```
BlueTooth Communication - HC08¶
Both classic Bluetooth and low-energy Bluetooth apply the Adaptive Frequency Hopping (AFH) feature that detects interference from. For example, a WLAN device 802.11 b, g, n that transmits nearby, if such interference is detected, the channel is automatically placed in the blacklist. In order to handle the temporary interference, an implemented scheme retries the channels of the blacklist and if the interference has ceased the channel can be used. AFH prevents Bluetooth from interfering with other nearby wireless technologies.
- The hardware that makes up the Bluetooth device is made up of two parts:
- a radio device, responsible for modulating and transmitting the signal. - a digital controller, consisting of a CPU, a digital signal processor (DSP - Digital Signal Processor) called Link Controller (or Link Controller) and interfaces with the host device.*
The LC or Link Controller is responsible for the processing of the baseband and the handling of the ARQ and FEC protocols of the physical layer; In addition, it handles both asynchronous and synchronous transfer functions, audio coding and data encryption.
Low-energy Bluetooth, also referred to as Bluetooth LE, Bluetooth ULP (Ultra Low Power) and Bluetooth Smart, is a new digital radio (wireless) interoperable technology for small devices developed by Bluetooth.
Master-Slaves
BlueTooth devices can act as Masters or as Slaves. The difference is that a BlueTooth Slave can only connect to a master and nobody else, instead a BlueTooth master, can connect to several Slaves or allow them to connect and receive and request information from all of them, arbitrating information transfers (up to a maximum of 7 Slaves).
- Wiring:
WiFi¶
Before moving into the specifics of the code, it is important to know who is who.
From the ESP8266WiFi library docs: devices that connect to Wi-Fi network are called stations (STA). Connection to Wi-Fi is provided by an access point (AP), that acts as a hub for one or more stations. The access point on the other end is connected to a wired network. An access point is usually integrated with a router to provide access from Wi-Fi network to the internet. Each access point is recognized by a SSID (Service Set IDentifier), that essentially is the name of network you select when connecting a device (station) to the Wi-Fi.
In the case of the ESP8266, or ESP32, they can work as:
- Station: station (STA) mode is used to get ESP module connected to a Wi-Fi network established by an access point.
- Soft-AP: An access point (AP) is a device that provides access to Wi-Fi network to other devices (stations) and connects them further to a wired network. ESP8266 can provide similar functionality except it does not have interface to a wired network. Such mode of operation is called soft access point (soft-AP)
- Both station and soft-AP: Another handy application of soft-AP mode is to set up mesh networks. ESP can operate in both soft-AP and Station mode so it can act as a node of a mesh network.
- Client: in this mode, the module can access services provided by servers in order to send, receive and process data. In this case, we can request a site from a server, and do something with it.
- Server: in this mode, the module can provide functionality to other devices, or simply serve a website:
WiFi Broadcast¶
Wifibroadcast is a project aimed at the live transmission of HD video (and other) data using wifi radios. One prominent use case is to transmit camera images. In contrast to a normal wifi connection wifibroadcast tries to mimic the advantageous properties of an analog link (like graceful signal degradation, unidirectional data flow, no association between devices).
Wifibroadcast puts the wifi cards into monitor mode. This mode allows to send and receive arbitrary packets without association. Additionally, it is also possible to receive erroneous frames (where the checksum does not match). This way a true unidirectional connection is established which mimics the advantageous properties of an analog link.
Extending range¶
ESP32 OVER 10KM JUST WITH ANTENNA MODIFICATIONS!