Search This Blog

Friday, December 26, 2014

Listening to Digital Radio Mondiale

The versatility of the Software Defined Radio doesn't seem to have boundaries. While exploring the HF bands, I tried to decode the occasionally received signal from Vatican Radio (, which as of this writing was the only station I could identify as sometimes transmitting in DRM.

DRM is pretty interesting compared to conventional analog AM. Using 10 KHz of RF bandwidth it can carry between 14.8–34.8 kbit/s of data stream. This is enough for encoding reasonably high quality audio, far above analog AM for the same occupied bandwidth, if an appropriate codec such as AAC+ is used.

There are a few shortcomings however. One is the fact that it doesn't deal with signal fading very well. If the signal level drops to a point where it is closer to the noise floor, complete loss of audio decoding occurs, instead of the "graceful" degradation of a conventional AM signal that we are used to. This is an important point given the fact that fading is very frequent in HF transmissions that rely on the ionosphere propagation to reach the other end. As a natural phenomena that it is, propagation conditions vary largely over a small amount of time.

Another problem is the limited popularity of the technology, meaning that there are very few commercial receivers prepared to receive and decode in this mode.

Below is a piece decoded audio from Vatican Radio:

And below as a means of comparison is an AM analog audio transmission at a similar HF frequency:

Wednesday, December 3, 2014

SDR - going higher in the wavelengths

While a 22 - 1400 MHz band coverage is pretty cool (given the price of the hardware), there is still more beyond (and below) these bands. In particular LF, MF and HF bands are interesting for a number of reasons:
  • Long distance, worldwide transmissions can be heard, including broadcast radio, military communications, weather reports, weather fax, radio teletype and HAM radio;
  • Experiments with low frequency RF can be sampled and studied;
  • Given the fact that the ionosphere reflects these frequencies, radio signals (and their reflections) in these frequencies can be used to analyse this outer layer of the earth's atmosphere, and ultimately to characterize the Sun and its influence on the Earth;
  • There are several digital communications in these frequencies that are interesting to attempt to decode through computer software, including Digital Radio Mondiale which is a standard for broadcast of FM-quality audio using the frequencies and bandwidth normally used for analog AM radio broadcasts, which as you know have very modest quality characteristics;
As such I went on and decided to buy a device known as an upconverter. Basically what it does is pre-selecting the 0-30 MHz frequency range, mixing it with a 100 MHz carrier, amplifying it across a Low Noise Amplifier and delivering an RF output that can be tuned in the RTL-SDR dongle. All the user has to do is tune the radio in the range between 100 and 130 MHz. The real frequency of the stations is simply the tuned frequency subtracted by 100 MHz.

As the device is delivered simply as the PCB board, I looked forward to put it inside a proper enclosure, to protect it physically and shield against local sources of interference. As such I used another of the extruded aluminium enclosures I had previously bought on Dealextreme. In my previous post you may see that it is the same type of enclosure I used for putting the RTL-SDR boards.

I have added some elements to the panel, namely a power switch to turn the upconverter on and off, a push button to select the mode of operation (bypass or HF upconversion), and a potentiometer to adjust the RF gain of the LNA. LEDs were also added to indicate the power on state and the mode of operation.

As living in an apartment doesn't allow for getting carried away with antenna setups, I've been researching compact antenna solutions, instead of the more conventional several tens of meters loop antennas that HAMs with lots of real estate tend to use for HF operation. As such I have found the mini-whip designs to be pretty interesting: with a surface area of only 30mm x 45 mm, one such antenna can quite strongly (above the noise floor) pickup signals from remote stations with a performance comparable to the large loops. A few links with an explanation behind the science of these antennas:


The secret resides in picking up only the electrostatic component of the RF emission, which as long as the antenna is kept outside of the buildings (where walls act as shields to the electrostatic noise), the desired signal can be picked up well above the noise floor. If the antenna would also be sensitive to the magnetic component, this would not be true because walls are transparent to the magnetic fields.

I have tried a slight variation of these designs by using the more common BF960 MOSFET as the pickup transistor and a 2N2222 as the second amplifier transistor:

So far the results have been approaching the expectations, allowing for the reception of many chinese broadcast stations, some weather/aircraft/military communications, and some HAM radio, including morse and rtty. The location where the antenna have been tested is sub-optimal (in the middle of a balcony, with metal parts all around), which allows me to expect much greater performance once it is attached outside the building.

Saturday, October 18, 2014

Again with the SDR (Software Defined Radio) craze

After I bought my first RTL-SDR dongle (regarding which I made this post covering APT satellite (weather) image reception: ), it's been sitting on the bench without much use. More recently I found extra stuff that could be interesting to take a look at, such as ADS-B reception (decoding commercial aircraft transponder signals) and less earthly things such as a doing some radio-astronomy, which includes for example trying to detect the 1420 MHz hydrogen line RF signal emitted from within our galaxy (it's a very exact frequency almost as accurate as our atomic clocks).

But for some of these things I needed another slightly more capable dongle. My first RTL-SDR dongle (which by the way is just a re-purposed DVB-T television USB dongle) had a Fitipower FC0013 tuner, which is limited to the 22-1100 MHz range. Besides this limitation, it did a pretty good job

Meanwhile a new tuner chip appeared in the market, the Rafael Micro R820T, with many USB dongles using it (most of these currently). I decided to buy one (for only 10 €, the typical cost of these gadgets). It has a greater spectrum coverage than the Fitipower (24 - 1766 MHz), and the interval is free of gaps (some other dongles exclude bands used by GSM/3G in some contries).

These dongles are not perfect (even though for the price we cannot complain much). One of the issues is bad image rejection in the lower frequencies (i.e. strong stations appear replicated in multiples of its frequency). This is mostly caused by the fact that the RF frontend is poor in band pre-selection/filtering.

Another issue is the plastic enclosure, which does not offer any shielding against local interference. Also, these devices are a bit optimistic in respect to line interference, by not providing much line filtering on the USB power rail.

One last issue, which for now I am not much concerned about, is the clock stability. These devices use the cheapest clock option, by being driven from a single 28.8 MHz crystal, and a couple of capacitors. This is a very temperature sensitive setup, drifting as the environmnet heats up or cools down. Also the production tolerances are high, leading to large offsets from the expected frequency (therefore requiring calibration). A solution for this problem is to replace the crystal with a TCXO (temperature compensated crystal oscillator) of the same frequency. This is however a costly option which I will leave to the side, and get back to it only if needed. For the kind of stuff I am doing now, it is fine as is.

In order to address the local RF interference and line interference related to these dongles, I went for the relatively radical solution of stripping the PCBs off the plastic enclosures and put these inside an extruded aluminium enclosure:

The original PAL antenna connectors, the USB plug and the IR receivers were removed. Regarding the later it was both because of being useless for the intended application, and for its eventual contribution to increase noise (however marginal it may be).

The antenna connectors were replaced with proper BNC connectors, that in spite of being 50 Ohm instead of 75 Ohm it shouldn't make a very significant difference (the same would not be true if the module would be a transmitter as well).

The line filter adopted consisted of a choke of about 8 turns in each of the two coils, and 27 pF ceramic capacitors between the 5 Volts rail and the GND in both sides of the choke:

As I wanted to have the ability to power the two SDR's from either the USB port or an external DC source, I have added a panel switch, to allow the user to select the desired power source. By enabling the device to be powered from an external DC supply, a better low noise DC source can therefore be selected. In either case, the common mode filter stays in the power rail, to even further diminish line induced noise.

Because two dongles are put in the same enclosure, it wouldn't make sense to have two USB cables leaving the enclosure, one for each dongle. As such I have bought a cheap 4-port USB hub (the smallest I could find in a local store), stripped its PCB outside of its original enclosure, dessoldered the USB sockets and 2-socket daughterboard, and placed the bare PCB of the hub over the base PCB, right next to the choke filter:

To keep interference to a minimum, especially between adjacent PCB's, a two wall shield was built, in order to electromagnetically separate the three circuit boards:

This shield is in contact with the enclosure, providing a GND reference for the signals. It only has the gaps for allowing the necessary cabling to pass between the boards.

Even though I did not established a reference for comparing the before and after the change, I could perceive a noticeable decrease in the background noise, by looking at the FFT waterfall display of the radio application.

Besides the functional quality improvements, the physical robustness of the setup could this way also be improved, in which case the SDR's are well protected inside the solid aluminium enclosure. Also it is more convenient and a less cluttered solution than having multiple dongles protruding from the PC USB ports.

Tuesday, August 26, 2014

Optical test

Moving on with the tests on my latest lens the Samyang 500 mm f/6.3, here is a very objective comparison to give an idea of the level of magnification and optical performance this cheap lens is capable of. 

The photo below is a 100% crop from Castelo de São Jorge in Lisbon at a distance of 700 meters (taken from the Miradouro da Arco da Rua Augusta) showing the portuguese flag on the left and the city hall flag on the right. It was taken with a 35mm f/1.8 Nikon AF-S G prime lens (for DX). The settings were ISO 100, f/8 aperture and an exposure time of 1/250 seconds.

The photo below shows the same two flags but taken with the Samyang 500 mm f/6.3 at a distance of 6250 meters (measured with the Google Earth ruler). This last photo was taken during a calm windless night with the 2x teleconverter, yelding a focal length of 1000mm and an aperture of f/12.6. The selected sensitivity was ISO 200, and an exposure time of 20 seconds was used.

By comparing the pixel coverage of the same objects in both crops we can see that in spite of the 10x greater distance, these objects appear 3x larger. By doing simple math this means that we have roughly 30x magnification in respect to the 35 mm lens. 

If we calculate from the lens reported focal lengths, we get Mag = 1000 / 35 = 28,57x. This is quite close to the first estimate based on the distances and pixel coverages.

Even though it is not a fair comparison putting side by side entirely different lenses and commenting the different levels of sharpness (it is like comparing a scalpel to a chain saw in terms of cutting accuracy), I must say that given the low cost of the Samyang lens, the contribution of atmospheric artifacts, and the large magnification, the overall result is very sharp given the dimension of the challenges that are implied in photographing under these conditions.

Saturday, August 23, 2014


Satisfaction with the 500mm reflex lens increases as I explore its potential in different situations. This time I took a number of shots holding it by hand during an afternoon next to the Lisbon international airport main runway. It was quite a challenge because of the moving targets, the lens being a pain to focus, and the fact that the camera was being held by hand. But the results seem to tell the rest...

To finish this topic full circle, here is a bit of cruise ship spotting, from the comfort of my balcony. These photos and videos were taken with a tripod and the 2x teleconverter added, resulting in a focal length of 1000 mm:

Wednesday, August 20, 2014

World Photography Day

Coincidentally, after having purchased an exotic lens for my camera and some days of wait for the F-Mount adapter, yesterday during the World Photography Day, I finally managed to test the lens. Aware of the shortcomings of this lens, still I was very pleased with the results, which I must say, open doors to different types of photographic work.

The lens is a Samyang 500mm f/6.3 mirror prime:

It doesn't have autofocus, zoom or diaphragm. It is a pretty frugal design, just like a catadioptric telescope with a camera mount instead of an eyepiece. It is hard to focus given its small depth of field for the focal distance and the travel range of the focus ring. Many people don't like it's donut shaped bokeh. But still I found it a very interesting lens for its focal length, size and reasonable speed. It basically can do what no other 150 Euro lens can do. And sometimes getting a great shot is not about the bokeh, the sharpness, contrast, etc, but about simply getting the shot, capturing the moment, telling the story.

While not having had much time to perfection the shooting, I have made a few shots taking advantage of the view around my balcony, which covers a little bit of Almada, the Tagus river and Lisbon.

Train station, at about 600 meters of distance:

Old Almada, about 3 Km away:

Panteão Nacional (mausoleum), about 7 km away:

Soccer field lamp, 500 meters away:

Church inside Lisbon, about 7 km far:

In the field of astrophotography the lens capabilities are yet to be tested. The area where I live is complicated because of the heavy light polution of the cities nearby.

Saturday, June 14, 2014

Reflashing a quad ESC to BLHELI firmware in an attempt to solve pancake motor cogging issues

Ever since I've switched motors and ESC's on my "primary" quadcopter, I have been running on problems keeping it reliable. Every now and then it would crash, once because of a motor connection that got broken, and other times in a unpredictable manner without  a cause that I could identify. More recently I decided to spend more time around the problem, and after testing a single motor spinning up and down a propeller aggressively, to my surprise I realized that it would cog with relative ease, even from intermediate throttle levels to full throttle or moderate throttle variations. This gave me a strong indication that something was wrong with the ESC - motor system. I had knowledge that pancake motors were more prone to cogging issues (including ESCs flashed with SimonK), so my only chance here would be to try a different firmware.

As this quadruple ESC is based on Silabs MCUs, using SimonK would be out of question as it is only developed for Atmel AVR MCU's (besides of course its bad reputation in respect to pancake motors).

The only option would be BLHELI, a project initially aimed for conventional helicopters, turning cheap ESCs into more efficient and functional speed controllers (including governor mode, which is a very interesting feature for conventional single rotor, collective pitch helicopters, ensuring a constant head speed).

As with the reflashing of many other commercial products, doing this would engage me in a point of no return, as the original firmware is read protected. If the BLHELI would not work for some reason it would be another part into the electronics scrap parts bin.

Doing this however would be no easy treat, as first of all I had no Silabs specific programming tool. After researching I found that with a piece of arduino software called owsilprog (, I could get away with using some board with a atmega MCU on it. The only one I had laying around was broken KK flight controller board with its atmega 168.

Another challenge was the fact that the tool to flash Silabs MCUs "owsilprog" is closed source and the only binaries for atmega168 would require a 16MHz clock. The KK board relied on the MCU internal clock which tops at 8 MHz. I had to somehow stuff a 16 MHz crystal and a couple of capacitors into the board:

All that to at the end find out that I could and shoud have used the BLHeli-Setup tool (, which has a atmel firmware for 8 MHz operation, and also manages the configuration of the later BLHELI versions:

I ended up having to use this tool anyway, as owsilprog was too old to handle the newer versions of BLHeli, in respect to configuring the parameters.

For my case I blindly tweaked only three parameters:

 * PWM frequency - set to "Low", to avoid heating problems with the FETs;
 * Motor timing - set to "Medium-high" (from Medium), to better prevent cogging issues;
 * PPM max throttle - increased to 1948 us to be according to the flight controller.

Anyway I left the leads soltered to the programming pads accessible from the outside, so that it is easy to reflash the ESCs in the future.

Everything else was left as is. The firmware was already preloaded with settings more appropriate for multicopters (e.g. governor mode disabled).

So far I have repeated the aggressive throttle test on a single propeller, and no cogging occured. At the same time the motors seem more responsive, wich is a great sign. Tomorrow I will do more thorough testing with a few flights hopefully.