Thursday, May 22, 2014

How Antenna Gain affects Range in FPV

http://blog.oscarliang.net/how-antenna-gain-affects-range/

How Antenna Gain affects Range in FPV

circular-fpv-antenna
To increase the range of the reception range of the radio system, there are two ways: either to increase the power of the transmitter or the power gain of the antenna.
As RC hobbyist we usually try to avoid modifying the transmitter to increase the power, or use a high power one, because that would add more weights to the plane. So that left us with the second option – increasing the gain of the antenna. However there are always misunderstanding about the concept of antenna gain.

Understand Antenna Gain

The gain or loss of antenna is measured by decibel (dB), which is equal to 10*log(Pout/Pin). Every 3dB increase in the gain, it doubles the range of the Antenna. However, here is the thing, it does not really “double” the range but more like taking the range from other direction and focus on the desired direction.
To make it easier to understand, imagine we have a balloon and the amount of air in it is like the power of the system (the range) which is constant. The reason we are getting a larger range is because we are “pressing the balloon” and the shape of the balloon is changed (the increase of intensity of the radio signal toward certain direction). This way we sacrifice coverage of some direction to increase the range of other direction, but the total covered area is the same.
antenna gain
Although the range becomes narrower when increase the gain, we can put a multiple channel diversity controller to put more antenna in. This way we have more signal coverage and the system will pick the antenna that has the strongest signal to use.

Radiation Pattern

That was a very rough description of the idea. The actual shape of the radio frequency signal coverage changes irregularly with the antenna gain.
A radiation pattern of the hypothetical isotropic antenna at 0db.
antenna-gain-0db
This is a standard omnidirectional 3 dB rubber duck antenna.
antenna-gain-3db
8dB Patch directional antenna
antenna-gain-8db

Conclusion

By increasing Antennas Gain do not magically create extra power but simply focus the radiated radio frequency into narrower space, so the signal coverage can reach out further in the required direction. Remember that by gaining distance the effective angle will be lost.
So when choosing antenna, unless you know what you are doing, you should choose a low dB omnidirectional antenna since the airplane is moving around in all directions, so you don’t lost connectivity when turning. Alternatively if using high db antenna, also use a diversity controller and add more antenna to cover more space. Check out my post about how polarization affects the performance of an antenna.
On the receiver side, you can consider using a patch antenna which allows you fly further in one direction, and you can turn it around to face your airplane to maximize the reception. If you plan on flying around yourself, a 3dBi omnidirectional or something similar would be safe.

Make a DIY Cloverleaf Antenna

http://blog.oscarliang.net/make-diy-cloverleaf-antenna/

Make a DIY Cloverleaf Antenna

cloverleaf-antenna-wire-soldering7

What is a Cloverleaf Antenna

The cloverleaf antenna is a circular polarized antenna which is way better than the cheap whip antenna that comes with most transmitters. In fact it is one of the best FPV video transmitter antennas available to hobbyists at the moment. I explained the benefits of a circular polarized antenna over a linear one if you are not sure what are the differences. The Cloverleaf is a closed loop antenna which the signal and ground wires are connected. The cloverleaf antenna has 3 loops at 120 degree apart, and they are titled at 45 degree.

cloverleaf-antenna-angle-diagram

Good and bad things about Cloverleaf Antenna

Circular polarized antennas are great for FPV video streams because they’re good at rejecting phase shifted signals (distorted signal). The cloverleaf antenna has an excellent radiation pattern and very low gain. It’s possible to achieve a 1.0 SWR which is the perfect efficiency in signal transmission.
It is not the ideal receiver antenna however, because the reverse polarization rejection pattern is very erratic. You need to choose other types of antennas for the receiver.
Also it’s not easy to make, pretty fragile, takes up space, affected by wind, and not possible to tune to the desired frequency after it’s made.

Let’s get started!

Parts you will need

  • 0.8mm copper clad welding wire, it’s stiff and easy to solder (some people used 0.6mm also worked fine)
  • RG316 coax cable (or RG405)
  • Soldering tool
cl1
build-cloverleaf-antenna

Measuring and Cutting the antenna wires

The size of the antenna (the length of the wires) does not follow the rule of “the bigger the better”. The length of the antenna wires affects what signal frequency you can receive. The length you need for your desired frequency can be calculated using mathematical equations. Generally the length of wires would be smaller for higher frequency signals.
To make it easier for our readers, you can use this tool to calculate the required length of the wires.
Enter the frequency (for example 5.8 GHz = 5800 Mhz)
MHz
Cut wires to:
mm
Use this tool to calculate where to bend the wires.
Enter the frequency  (for example 5.8 GHz = 5800 Mhz)
MHz
Bend wires at:
mm
As an example, for the most common 5.8 GHz FPV system (5800 Mhz), the length of the wires should be 52.93mm, and it should be bend at 13.2mm. This is what the shape and measurements should look like.
cloverleaf-antenna-wire-measurement
Measure and cut 3 pieces of the calculated length, cut them a bit longer (marked as optional above, so you have the extra length to solder to the main wire. Trim both ends so they are flat. Pretty straightforward, I followed this youtube video.
cutting-antenna-wire
cloverleaf-antenna-wire-cutting

The 3D design diagram with angles

cloverleaf-antenna-angle-diagram3
cloverleaf-antenna-angle-diagram2

Soldering

Cut your coax cable open like this, so the ground and signal wires are exposed and ready to be soldered.
build-cloverleaf-antenna2
build-cloverleaf-antenna3
Solder the wires to the coax cable one by one about 120 degree apart.
cloverleaf-antenna-wire-soldering
cloverleaf-antenna-wire-soldering2
And tilt the wires to the right 45 degree. This will make the antenna “right handed” polarized, since this is a more common configuration.
cloverleaf-antenna-wire-soldering4
cloverleaf-antenna-wire-soldering3
Now bend the wires, so the tip of the wires can reach the signal wire of the coax cable.
cloverleaf-antenna-wire-soldering5
cloverleaf-antenna-wire-soldering6
And finally solder all the tips together to the signal wire.
cloverleaf-antenna-wire-soldering7

Other Polarized Antenna Design

Skew Planar Wheel Antenna (4 lopes)
medium
Virevent Antenna (4 lopes)
Virevent-antenna
Windmill Antenna (5 lopes)
windmill-antenna

Conclusion

It’s been suggested that the circular polarized antenna at the transmitter side works better with a helical antenna at the receiver. But of course it’s your choice and the results vary from case to case.
circular-fpv-antenna
The key factor of making a successful FPV antenna is to be precise with measurement. The more accurate you can make the antenna the better it will perform.

Flash KK2.0 KK2.1 1.6 Firmware Update Upgrade Using Arduino

http://blog.oscarliang.net/flash-kk20-16-firmware-upgrade-arduino/

Flash KK2.0 KK2.1 1.6 Firmware Update Upgrade Using Arduino

Arduino-KK20
Who says you have to have an USBasp AVR programmer to flash the KK2.0 or KK2.1? I have flashed ATTiny microcontrollers before using Arduino as the ISP programmer, so why not try that on the KK2.0? And I happen to have a couple of Arduinos hanging around, so I decided to give it a try. I will show you how I flash KK2.0 flight controller using the Arduino. 
These instructions should work for both the Arduino Uno and the Arduino Mega. it saves you money buying extra parts when you have the Arduino available.

Note that this tutorial also works with KK2.1, the latest KK2 board.

Preparation for Flashing the KK2 board with Arduino

Software wise, you need follow these steps first.
You will need the following hardware components.
  • Hobbyking KK 2.0 flight controller board.
  • One of the Arduino Board such as Arduino Uno, Nano, or Mega.
  • A 10 uF Capacitor (optional)
  • Some female to female and Male to Female jumper wires.

Arduino Setup and Wire Connection

Do not power up anything just yet.
First you need to connect your Arduino to your PC using USB cable, in the IDE open up the example sketch in File->Examples->ArduinoISP. Upload this sketch to your Arduino, it will make your Arduino an ISP programmer.
Connect the Arduino and the KK2.0 board according to the following pin layout
KK2.0 ISP AVR header Pin
click picture to enlarge.
Arduino flash kk2
Arduino Uno / Nano
Arduino Pin 10 – SS / Reset
Arduino Pin 11 – MOSI
Arduino Pin 12 – MISO
Arduino Pin 13 – SCK
Arduino Mega 
Arduino Pin 50 – MISO
Arduino Pin 51 – MOSI
Arduino Pin 52 – SCK
Arduino Pin 53 – SS / Reset
Do not power the KK 2.0 with your arduino, and avoid sharing the same power source. You might failed if you do that. The easiest thing to do is, power your Arduino with the USB cable from the computer, and use external power source to power your KK board, for example an ESC 5V BEC from your quadcopter.
Now power up your KK2.0 board.
Next you need to put a 10 uF capacitor between the SS/Reset pin and the GND (I flased two KK2.0 without this, and it seems working fine). Check the below picture for more details. Basically, the long leg of the capacitor should be connected to the Reset side and the shorter leg should be connected to the GND.
connect kk20 arduino

Let’s Start Flashing in Command Line

Don’t get freaked out by command line, all you need to do is to type the following lines in the CMD and check whether the output is the same as mine.
Please double check your ISP pin connections before you proceed. Now that everything is powered and connected, we can run the following command to check if everything is ready to be flashed.
Arduino Uno
D:\kkflashtool\lib\avrdude\windows\avrdude.exe -P COM3 -p m324pa -c arduino -b 19200
Arduino Mega 2560
D:\kkflashtool\lib\avrdude\windows\avrdude.exe -P COM3 -p m324pa -c avrisp -b 19200
Replace COM3 with the port on which your Arduino is connected to.
The output should be similar to this.
flash-kk20-with-Arduino
If it says “Ok”, then we are ready to flash the KK2.0 board. If the Device signature is all zeros, you’ve probably connected the ISP pins on the KK board the wrong way around. Just double check and plug it in other way.
To start the firmware flash, execute the following commands.
Arduino Uno R3
D:\kkflashtool\lib\avrdude\windows\avrdude.exe -P COM3 -b 19200 -c arduino -p m324pa -v -e -U flash:w:"D:\KK2_1V6\KK2_1V6\kk2.hex":i
Arduino Mega 2560
D:\kkflashtool\lib\avrdude\windows\avrdude.exe -P COM3 -b 19200 -c avrisp -p m8 -v -e -U flash:w:"D:\KK2_1V6\KK2_1V6\kk2.hex":i
  • Replace COM3 with the port on which your Arduino is connected to.
  • Replace “D:\kk2.hex” with the full path to your firmware file.
The output should be something like this.
flash-kk20-with-Arduino-done
Please note that the screen will become white during and after flashing, this is normal.
After it’s done and you see “Thank you” on the screen, restart KK2.0 and you should see the new firmware number which means you have upgraded the firmware successfully. Enjoy flying! :-)

Firmware on KK2.1

I heard the 1.6 Firmware has bugs on the KK2.1, kind people have been working hard to provide new firmware to fix these bugs, check out Stevei’s KK Firmware.
Also notice the KK2.1 has a different chip, which is m644p, so you need to use a different command to flash it.
C:\Users\Oscar>D:\flash\lib\avrdude\windows\avrdude.exe -P COM1 -b 19200 -c avr
isp -p m644p -v -e -U flash:w:"D:\kk2\KK2V1_1V11S2.hex":i

Possible Errors When Flashing Firmware

avrdude.exe: Expected signature for for ATmega8 is 1E 93 07
Double check chip, or use -F to override this check.

You need to change the original command to
C:\Users\Oscar>D:\flash\lib\avrdude\windows\avrdude.exe -P COM1 -b 19200 -c avr
isp -p m644p -v -e -U flash:w:"D:\kk2\KK2V1_1V11S2.hex":i
1

Circular or Linear Polarized Antenna For FPV

http://blog.oscarliang.net/linear-circular-polarized-antenna-fpv/

Circular or Linear Polarized Antenna For FPV

medium
The antenna directly affects the FPV range. There have been discussions about what type of antenna and how much gains should be used for RC airplane, quadcopter or multicopter FPV, so we are going to explore the types of antenna, the difference between them and the pros and cons of these options. Check out my previous post about how Antenna gain would affect the range.
Also here is how you can make your own DIY cloverleaf antenna.

Common Types of Antenna

The dipole – This is the antenna to which all others are compared. This is typically the stock whip antenna that comes with most transmitters.
0001800_quad_band_cellular_duck_antenna_sma_600
Skew-Planar Wheel – this antenna is circularly polarized and has excellent multipath rejection capability.  This antenna is used for general purpose flying where aerodynamic drag (e.g. wind) is not a critical factor. While generally regarded as a receive antenna, it works well as a transmit antenna too.
medium
The Cloverleaf – this antenna is an improvement to the skew-plannar mainly as a transmitter. It is larger so it’s affected by aerodynamic drag more. It can be coupled with a Skew Planar wheel for long range or obstacle penetration.
cl13

Types of Polarization

Polarization means the way the radio signal travels in space, it is related to the performance of your radio system (both transmitter sticks and FPV system). There are 2 types of Polarization: Linear and Circular.

Linear Polarization

Normal antenna uses linear Polarization, such as most of the original transmitter stick antenna. Basically the linear polarized signal oscillate horizontally or vertically in one plane while travelling.
0001800_quad_band_cellular_duck_antenna_sma_600
This type is affected by the antenna alignment. When the receiving antenna is placed in the same alignment as the transmitting one, the signal is transmitted at maximum effectiveness. But if you turn one of the antenna 90 degree, you will only get a small overlapped area (an 90 degree polarization angle) and the signal strength becomes bad (30 dB loss). This is referred to cross polarization.
Because our airplane is moving constantly, if it is tilted to the left, you have a larger polarization angle and therefore reduce the signal strength. To solve this problem, we have circular polarization.
p1
p2

Circular Polarization

In this type of polarization, we are transmitter the signal on both horizontal and vertical planes with 90 degree phase shift, therefore instead of having a sine wave signal, we now have a corkscrew-like signal.
medium
However the rotating direction also matters. For example if we have a right-handed polarized transmitter antenna and a left-handed polarized receiver antenna, it would result in a 30 dB signal lost (cross polarization)
p51

Pros and Cons of both Polarization

One of the good reason we use circular polarized antennas is because of multipath interference.
Multipath interference is the most common reason for bad video quality. It happens when the signal is reflected back from something and it gets distorted or might change its polarization. Both the good (direct) and the bad (reflected) signals are received which could cause a bad image. The distortion could be shown as a color change, large bars, scrambling image even drop-outs.
The causes of multipath could be the position of your antenna, or obstacles and objects in your flying environment, so there are ways to prevent it.
VideoCrypt-signal
Linear polarization is more common because of its simplicity. The antennas tend to be smaller, cheaper and easier to build. It is capable of longer range than circular polarization, but is more susceptible to multipathing. The range advantage is seldom realized due to multipath interference.
Not only the advantage on multipath interference with the circular polarization, it also does not lose its polarization when a plane roll to turn.
Here are some of my personal ideas on when to use which type.

When to use circular polarization

  • your receiver is close to large obstacles such as trees, or buildings (within 30meters)
  • acrobatic flying (constantly changing the position of the plane)
  • low altitude flying
  • flying very high altitude (you need a directional antenna)

When to use linear polarization

  • flying out in the open field with no obstacles
  • very stable fly, does not roll or pitch a lot
  • long distance flying
  • standing on top of a hill
  • have no space for large antenna

Conclusion

Polarized antenna tends to be quite expensive, and it’s not very straigh-forward to make either. So i will try to write a post about that.

What is RSSI Transmitter Receiver – RC Quadcopter

http://blog.oscarliang.net/what-rssi-transmitter-receiver-quadcopter/#more-3263

What is RSSI Transmitter Receiver – RC Quadcopter

what is rssi-quadcopter-explained

Understand RSSI in RC

RSSI is a measurement of how good your radio signal is, which stands for Received Signal Strength Indication. It is an important safety feature as it allows you to judge how the radio link is performing before a control signal failure occurs, that could crash you quadcopter.
When it comes to the hobby RC world, RSSI usually is a telemetry data from the RC Receiver, which means the RSSI value is sent from the receiver back to the transmitter as telemetry data (two way communication). You can also read the RSSI value from receiver and feed it to the OSD, and display it on your FPV screen.

In most cases, the RSSI value is not a voltage level that indicate the strength of the controlling radio link, it’s a PWM signal that used in servos and ESCs. Next I will talk about how to use this signal.

How to use RSSI PWM signal

Simplest thing is to get a RC transmitter (or transmitter module) and receiver that are able to do telemetry and output RSSI. Some receiver don’t provide a pin to the RSSI, but requires DIY mod and additional resistors and soldering to obtain the RSSI information.
For example what I am using is the FrSky DJT module and D8R-XP receiver. The pair provides 1.5 km range, telemetry, including RSSI. I simply connect the RSSI pin to my OSD module, and the RSSI value shows on my FPV screen.
The RSSI is not output just as a voltage, it is a pulsed width modulated signal (PWM) with variable high-low ratio depending on signal strength. It can be converted to a voltage easily using a low pass filter (Resistor-Capacitor filter).
250px-1st_Order_Lowpass_Filter_RC.svg
Some OSD module or flight controller accept direct connection to the PWM RSSI output, probably because they have a low pass filter built in, and an analogue input reads the voltage to determine the value.
Most OSD, even the most basic ones support voltage level input, so you can see your battery voltage level on screen. With that in mind, we can feed this converted analogue voltage to the OSD. Usually the range of the RSSI value is 3.7V to 0V (100% to 0%). I did this mod with my Hobbyking E-OSD. It has two voltage inputs, I use one to monitor my battery voltage, the other one to monitor RSSI, which works great!
Another good thing about this Frsky transmitter and receiver is, the TX module alarm beeps when the signal is getting weak, as it gives me great peace of mind to know I always have a strong signal while flying. I don’t need to look at the RSSI info unless I have absolutely nothing to do.

For the geeks, What actually is RSSI?

Additional Info for those who like to study, but not needed to use RSSI.
RSSI is actually not an absolute value like voltage or temperature but a number that indicates the ratio of the signal to some initial “good” value. It is in dB and is the same measuring system used for audio levels. dB is a logarithmic measure not linear. What this means is that any increase of 6 means the signal has doubled in strength. So a change of +12 in the RSSI means the signal has increased in power by 4 times, by +18 means the signal has increased in power by 8 times, and so on.
For the FrSky system the RSSI should read about 110 at 1m and every time you double the distance between the transmitter and receiver, the RSSI level should drop by 6. Theoretically at about 100 meters you should get an RSSI value of about 70 in ideal conditions.
A good way to see this effect is to use Range Test mode. In range test mode the Transmitter module operates at 1/30 full power. Note where the beeps appear for all three levels. In real flight the distance will be 30 times more.

Xbee Alternative XRF Wireless RF Radio Module And Arduino

http://blog.oscarliang.net/xbee-alternative-xrf-wireless-rf-radio-arduino/

Xbee Alternative XRF Wireless RF Radio Module And Arduino

remote-XRF-to-Arduino-connections 8
In this post I will show you how to connect the XRF with Arduino, and will show you a example application with two Arduinos talking to each other using the XRF wireless module.

Bought The XRF Wireless RF Radio Modules

As part of the DIY Custom Remote Control, I will be using wireless modules for remote communication. There isn’t much choice, either Radio Transceiver or Xbee. Both are great but quite expensive. Later on I stumble on an cheaper Xbee Alternative calledXRF Wireless RF Radio Module, that claims it has the same pin configuration as the Xbee, the way it’s used is also the same, and the range can reach up to 1 Km (although some feedbacks said it’s more like 300m but it’s still great). More importantly, it’s only half of the price of a Xbee module.

I think the main difference is that this module transmits data at lower frequency (868 and 915 MHz) than the Xbee (2.4G Hz), and that partly explains why the transmit distance is longer.

Problems Right Away

remote-XRF-to-Arduino-connections 9
I bought the break out boards (XBBO) with wireless modules too, and I only found out that the ones I bought are called “Passive XBBO” which doesn’t accept 5V power supply but only 3.3V (not 5V signal as well because of that). Only “Active XBBO” would accept 5V and convert the voltage for you. I didn’t notice that when purchasing (should have been more careful and read the description), So, it didn’t work when I just simply connect everything. My first thought was the TX/RX data line voltage on the Arduino is too large (5V) for the XRF (3.3V).
I tried so hard searching on Google, there isn’t much information about this, even not much about the XRF module working with Arduino. So I decided to take the risk by following tutorials about the Xbee, since they are similar devices, and it did work!

A Not-So-Perfect Solution

I found this image about Xbee and arduino:
remote-XRF-to-Arduino-connections1
I noticed the potential divider on it and I thought, that this might be it! Because on the break out board, we have already have the capacitor, so we can ignore that (it still works without it anyway).
I don’t have any 15K resistors, so I am using a 4.7K in series with a 10K resistor. (Ignore the LEDs and the blue resistors, I was too lazy to remove them from the last project).
remote-XRF-to-Arduino-connections2
IMAG0711
Okay, it’s great that it works finally. But it’s kind of annoying having to setup the potential divider every time. So I made a small strip board with the potential divider soldered on, and it also has a female to female connection, so it’s easier to work with as well with the Arduino.
remote-XRF-to-Arduino-connections 6
Here is the new result:
remote-XRF-to-Arduino-connections 4
remote-XRF-to-Arduino-connections 7
remote-XRF-to-Arduino-connections 5
Although it’s cheap and easy enough to work around it, but I still would suggest to get a proper break out board with voltage conversion and additional functionality like power and data transmission indication.

Two XRF and Arduino Test Application

To verify they are working, I made this test application. There are two Arduino involved, both will be using the XRF modules to send and receive data. Arduino1 will be sending data – 0, 1, 2, 3, 4…. 8, 9, with an interval of one second. Arduino2 will receive these data, when received data is 1, the LED on pin13 (built-in LED) will light up for one second and then goes off, otherwise nothing will happen.
So in theory if everything is working, we should see the LED on Arduino2 light up every 10 seconds.

Code For the Sender – Arduino1

1int num = 0;
2 
3void setup(){
4    // start serial port at 9600 bps:
5    Serial.begin(9600);
6    pinMode(13, OUTPUT);
7 
8}
9 
10void loop(){
11    if (num++ >= 9)
12        num = 0;
13    delay(1000);
14 
15    Serial.write(num);
16}

Code For the Receiver- Arduino2

1int num;
2 
3void setup()
4{
5    // start serial port at 9600 bps:
6    Serial.begin(9600);
7    pinMode(13, OUTPUT);
8 
9}
10 
11void loop(){
12    if (Serial.available() > 0) {
13 
14        // get incoming byte:
15        num = Serial.read();
16 
17        if(num == 1){
18            digitalWrite(13, HIGH);   // set the LED on
19            delay(1000);              // wait for a second
20            digitalWrite(13, LOW);    // set the LED off
21        }
22 
23    }
24}
If you want to discuss or share your ideas, you can post something in our forum here.