Thursday, 30 April 2015

RC Radio Signals






PWM, PPM, SBus, DSM2, DSMX, SUMD
















 

When it comes to radio transmitter and receiver, acronyms are often mentioned: PWM, PPM, SBUS, DSMX and so on. These are the different radio communication protocols and technologies. In this post we will explore the differences of these radio signal types. We will also have a look at some of the technology, and see how it makes flying more reliable and safer.

PWM


This is the most common receiver output signal. In the old days when there were only RC fixed wings planes, the receivers were used to control the servos or ESC directly with standard PWM signal, one channel for each servo. Until today the same technology is still being used. Multirotors require at least 4 or 5 channels (sometimes even more) and you will see the same numbers of servo leads connected between the receiver and flight controller.

PWM radio receiver is the most common and usually the cheapest option.

pwm-receiver-flight controller-connection

PWM stands for pulse width modulation, the length of the pulse specifies the servo output or throttle position. The length of the signal pulse normally varies between 1000 & 2000µs (micro seconds), with 1000µs being the minimum & 2000µs the maximum.

PPM


PPM is also known as PPMSUM or CPPM. The advantage of PPM is that only one signal wire is needed for several channels (typically 8 channels max), instead of a number of individual wires. So you should only connect the ground, power and signal cable.

ppm-receiver-flight controller-connection-one-wire

A PPM signal is basically a series of PWM signals sent one after another on the same wire, but the signal is modulated differently.

PPM is what they call “analog signal in time domain”, channels are sent one after another and not at the same time. Therefore tt’s not as accurate or jitter free as serial communications, but it’s more widely available and supported by many Flight controllers.

Check out this post for a more detail difference between PWM and PPM.

PCM


PCM stands for pulse code modulation, it’s a data types like PPM. However PCM signal is digital (ones and zeros) and the PPM signal is analogue, which is the length of time the signal is on. PCM has the potential of signal error detection even error correction, but this still depends on the product you buy.

PCM is more reliable and less susceptible to interference, but additional conversion is required so the equipment is more expensive in theory. But it looks like PPM is still the mainstream in RC radio at the moment.

Serial


Serial Receiver is a digital loss-less protocol that uses only 3 wires (signal, power, ground) for multiple channels. As the name suggests this type of receiver requires serial port on the flight controller. This includes SBUS, XBUS, MSP, IBUS, and SUMD.

SBUS (S.BUS) – Frsky, Futaba


SBUS is a type of serial communication protocols, shared by Futaba and FrSky, that supports up to 18 channels using only one signal cable.

SBUS is an inverted UART communication signal. Many flight controllers can read UART input, but cannot accept inverted one (such as the Naze32) and an inverted is required. But some FC such as Pixhawks has built-in dedicated signal inverter for this purpose.

XBUS – JR


XBUS is used by JR, which supports up to 14 channels in one signal wire. One of the advantages is the tiny time delay between each channel.

MSP (multiwii serial protocol)


Protocol that was created as part of the multiwii software. Basically it allows you to use MSP commands as the RC input and it supports 8 channels in one signal cable.

Flysky IBUS


IBUS is the new flysky serial protocol. It’s a two way communication: one port for servo data output and one port for sensors.

Graupner Hott SUMD


The Graupner SUMD is a serial protocol like Speksat and SBUS. The channels are encoded into one digital signal and there you have no latency. But we are talking ms of difference, I doubt anyone can tell the difference. Advantages of SUMD:

  • VS SBUS – SUMD doesn’t require signal inverter.

  • VS PPM – SUMD has better resolution and zero jitter while PPM has only 250 steps and always 4ms jitter.


Graupner SumH


SUMH is a legacy Graupner protocol. Graupner have issued a firmware updates for many recivers that lets them use SUMD instead.

Spektrum DSM2 and DSMX


DSM2 signal is more resistant to noise, interference and other transmitters transmitting on the same frequency. It also finds a backup frequency at start-up in case the primary frequency fails. This lower the chance of losing signal greatly, however if both channels becomes unusable you may still lose the connection.

DSMX was based on and improved from DSM2, which also uses the same econding scheme. The difference is the DSMX signal is able to switch to a new frequency channel in case of cut out within a couple of milliseconds, so in theory you wouldn’t even notice the glitch.

DSM2 is still a popular technology, if you are away from sources of radio interference (such as wifi, microwaves, and wireless security cameras), it should work just as well as DSMX. But DSMX is just more reliable.

Spektrum Satellite


A Spektrum Satellite is an additional antenna and receiver circuit that usually gets connected to the “main” receiver to improve link reliability by providing diversity reception.

Raspberry pi FPV


First, we connect the camera to the intended CSI interface (pictured above) and start the configuration tool of the Raspberry Pi.

pi @ raspberrypi ~ $ sudo Raspi-config

 

Further down the line "Enable Camera" should be visible. If simply press Enter, save, and the Raspberry Pi with "sudo reboot" Yes, restart the computer. If the line is missing, the system must be brought up to date with the following two commands:
pi @ raspberrypi ~ $ sudo apt-get update
pi @ raspberrypi ~ $ sudo apt-get upgrade


Raspberry Pi Camera Configuration


Take pictures


Shot in Jpeg format
pi @ raspberrypi ~ $ raspistill -o image.jpg

 

Shot in PNG format
The -e option you can create the file types jpg, bmp, gif and png.
pi @ raspberrypi ~ $ raspistill -o -e image.png png

 

Without receiving Preview
pi @ raspberrypi ~ $ raspistill -o -n image.jpg

 

Recording on left and right keys (Enter)
Is replaced by image image.jpg% 02d.jpg a new file in the format image01.jpg is created each left and right keys.
pi @ raspberrypi ~ $ raspistill -t 0 -k -o image.jpg

 

Delayed Up (3 seconds)
pi @ raspberrypi ~ $ raspistill -o -t image.jpg 3000

 

Shot in a lower resolution (640x480)
pi @ raspberrypi ~ $ raspistill -o -w 640 -h 480 image.jpg

 

Shot in a lower quality
The reduction of quality saves disk space. Valid values ​​are from 0 to 100 possible.
pi @ raspberrypi ~ $ raspistill -o image.jpg -q 20

 

Time-lapse recording
Use the following command to one hour (-t 3600000) every 5 seconds (-tl 5000) added a picture. The name% 04d is the file name for a four-digit numbering (eg image_0001.jpg).
pi @ raspberrypi ~ $ raspistill -o -t image_% 04d.jpg -tl 5000 3600000

 

The images created can be converted into an mp4 video file with the tool ffmpeg.
pi @ raspberrypi ~ $ ffmpeg -r 5 -qscale 4 -b -i 9600 IMG_% 04d.jpg zeitraffer.mp4

 

Record videos


5 second video in 1080p (1920 x 1080)
The option -t gives you the recording time in milliseconds. For an infinite recording (eg for a stream) simply set the value to 0.
pi @ raspberrypi ~ $ raspivid -o -t video.h264 50000

 

5 second video in 720p (1280 x 720)
pi @ raspberrypi ~ $ raspivid -o video.h264 -t -w 1280 -h 720 50000

 

With individual video bitrate (3.5MBits / s)
pi @ raspberrypi ~ $ raspivid -o video.h264 -t -b 50000 3500000

 

With individual video frame rate (10 frames / second)
pi @ raspberrypi ~ $ raspivid -o video.h264 -t -f 50000 10

 

Send video stream to stdout
pi @ raspberrypi ~ $ 50000 raspivid -t -o -

 

Convert videos


H264 mp4 by
pi @ raspberrypi ~ $ sudo apt-get install gpac
pi @ raspberrypi ~ $ MP4Box -add -fps 30 video.h264 video.mp4

 

LED on / off


1. Method
Add the following line to the file "/boot/config.txt" to and do a reboot. Unfortunately, it can happen that the settings are lost after a reboot.This is related to Kompatibilitätsroblemen some SD cards. If this is the case, edit the file to a different Linux box and use the second method.
disable_camera_led = 1

2. Method
Once deactivated by the above method, the LED on the GPIO 5 can be controlled.
pi @ raspberrypi ~ $ sudo echo "5"> / sys / class / gpio / export
pi @ raspberrypi ~ $ echo "out"> / sys / class / gpio / gpio5 / direction
pi @ raspberrypi ~ $ echo "1"> / sys / class / gpio / gpio5 / value

 

Stream on other Raspberry Pi computer or


Preparing the server
Use the tool Netcat can send the stream generated by raspivid directly to another computer or Raspberry Pi. Therefore one must only know of the receiver (client) IP address. This one shows under Unix with ifconfig and Windows computers with ipconfig.
Example In the following the stream to another Raspberry Pi with the IP address 192.168.178.20 is sent to port 5001:
pi @ raspberrypi ~ $ sudo apt-get install netcat
pi @ raspberrypi ~ $ raspivid -t 0 -o - | nc 192.168.178.20 5001

 

Preparing the Client - Linux
The Raspberry Pi / Linux client of the video player MPlayer in addition to netcat installed later to the stream directly displayed on the graphical interface.
pi @ raspberrypi ~ $ sudo apt-get install mplayer netcat
pi @ nc -l -p raspberrypi ~ $ 5001 | mplayer -fps 31 -cache 1024 -

 

Preparation of the client - Windows
If not already have the tools External link Netcat and External link MPlayer be installed.
The stream is started with the following command in the command prompt.
[Path to nc.exe] nc.exe -L -p 5001 | [path to mplayer.exe] mplayer.exe -fps 31 -cache 1024 -

 

Monday, 20 April 2015

Raspberry pi Spectrum Analyzer

[su_document url="http://www.larsleonhardt.com/wp-content/uploads/2015/04/freq-show-raspberry-pi-rtl-sdr-scanner.pdf" width="520" height="560"]


OSD Programming with Arduino

 

connect-arduino-minimosd

One great feature that we should add to FPV would be flight data on the screen display (OSD). By programming the MinimOSD, not only you get more accurate data on the screen, you can also select, edit what kind of data you want to have on the screen. The Crius AIOP board is supposed to work well with the MinimOSD, so I gave it a try.

I realized that you need a FTDI cable to do the programming, but if you happen to have an Arduino Uno like I do, then it’s your lucky day because you can easily turn your Arduino in to a FTDI programmer. I will show you how after the break. You can buy an Arduino from Newark.

arducam-osd

Connecting Arduino with MinimOSD


How does it work?


A bit of technical background, skip if you like.

The Arduino UNO has an FTDI USB-TTL chip on it to communicate between a PC and the ATMEGA chip on the board. Because all of the necessary pins on the FTDI chip are connected to various pins on the edge of the board, we can just connect the MinimOSD up to the right pins and away we go! No need to spend extra money on the FTDI cable!

Let’s connect them


The connection is very simple. But first of all, if you don’t have an Arduino Uno but other Arduino boards, you need to make sure it has a FTDI chip otherwise I am afraid you are out of luck.

Connect your arduino to the computer, remember what COM port it has been assigned. Then unplug the Arduino from your PC.

Remove the ATMEGA chip from the socket. If yours is soldered directly to the board then you may still be able to continue, but you will also program the ATMEGA chip at the same time which you probably don’t want to do. This way we are just passing the data through the board to the output pins. Removing the chip means you won’t accidentally bugger up the ATMEGA chip.

Connect your MinimOSD to the Arduino board as follows:

Ardunio-MinimOSD

Note that BLK on the MinimOSD is not connected to anything. Also note that TX is connected to TX, RX to RX – you don’t need to reverse them!

Connect the Arduino to your PC again. Your PC should recognize the device as usual and assign it the COM port we noted down earlier.

You should now be able to program the MinimOSD. However the way of programming it depends on the firmware, read on to see how.

Different Firmware for MinimOSD


Here comes the confusing part. There are some many different firmware suggested by people, I had no idea which one to use. After a lot of research, it turned out that we should flash the MinimOSD with different firmware, to work with different flight controller firmware. These firmwares are both open source, so it’s free to get them.

For MegaPirateNG, you should be using ArduCam-OSD, or MinimOSD-Extra. This firmware provides a very handy GUI tool, which allows you to flash firmware, and program the MinimOSD. All you need to do is to select the COM Port, browse to the firmware file, and click “upload firmware”.

For Multiwii, you should be using Rush-OSD. With this firmware you need to use the Arduino IDE to open the firmware files as a sketch, and upload them like you do with a normal Arduino.

It works great with this wiring diagram when using MegaPirateNG. But it just WON’T work with Multiwii for some reason. No matter which Serial port I plug the MinimOSD to, the ST LED didn’t light up, I get no image from the OSD. Although it’s working fine when testing with the Rush-OSD Gui and I can see the ST LED blinking. I think the Crius AIO Board is not talking to the MinimOSD, because the MinimOSD only accept certain data format (maybe telemetry data), and I couldn’t see any settings in the Multiwii config.h file either. After a couple of hours of trying and researching, I decided to leave it there. I don’t need it right now anyway.

Crius-aio-wiring-MPNG

I think that’s it, if I made any mistakes in explaining please let me know because I have only looked into this in the last few hours.

Thoughts about these open source OSD projects


I am sure the developers must have put much efforts and time into these projects, they do this not for money but for the convenience of others, and we are all very grateful.

However It’s not very straightforward to work these things out, because they are not well documented, and what is documented is not user friendly, at all. The “instructions are all over the place, you need to read through some 100-page long forum threads. Most of the time you need to guess, and do lots of trial and errors. After hours of trying only find out it’s not working. Very frustrating.

That is the problem with open source stuff, and sometimes it’s wiser to pay a little bit more and save the troubles.