Meteor M-N2 Images

Sunday, 7 June 2015

Transmitting video with a HackRF Blue

Picture of the video of my garden transmitted by my HackRF Blue
In the UK much digital amateur television (DATV) is transmitted using the DVB-S standard. This is the standard used in Europe to transmit standard definition satellite television.

Eventually I aim to transmit video through my local DATV repeater. What I have done is to prove the feasibility of using a HackRF Blue to act as the radio frequency part of the system.

I have drawn a diagram showing the individual components I used and I will go on to describe each in more detail.
Camera
I have used a standard DV video camera (Canon MV450i). It is possible to substitute this for a standard webcam. 

Computer
I use a 4 core Intel Core i5-2400, 3.10GHz CPU with 4Gb of memory. Operating system is xubuntu 14.04.

dvgrab
This software is used to grab the DV stream from the Firewire port that the DV camera is connected to. If you use a webcam then it is not necessary to use this program. It can be installed from the Ubuntu Software Centre or via the Kino pages.

ffmpeg
ffmpeg is used to convert the raw video stream grabbed by dvgrab into an MPEG-2 transport stream. If you are using a webcam you will need to change the parameters for the input source and the input video codec. It can be installed from the Ubuntu Software Centre or from the ffmpeg site.

The output from ffmpeg is sent to a fifo file to be consumed by the gnuradio program.

gnuradio
I have gnuradio installed via pybombs and am currently running version 3.7.7. Ron Economos has written the gnuradio blocks to enable DVB-S to be transmitted. You will need to download & install these from github. Included in the download is a gnuradio-companion flowgraph. Open this in gnuradio-companion to verify that you have installed the DVB-S gnuradio blocks in the correct place. If blocks show up as red then you haven't. However, Ron's code does not use a HackRF so I have changed the output sink to be a HackRF. You may also want to change the input to be a mpeg-2 transport stream file for testing and/or to reflect the location of the fifo file on your system.

You can download my HackRF version of the transmit program from here and edit it to change the reference to the directory I used for my fifo file to the one on your machine.

Example commands

One off commands

  • mkdir ~/dvb-s
  • cd ~/dvb-s
  • mkfifo mpeg2.fifo

Command to run dvgrab and ffmpeg

cd ~/dvb-s

dvgrab - | ffmpeg -re -thread_queue_size 1000 -i /dev/stdin -vcodec rawvideo -f alsa -i hw:0,0 -acodec mp2 -s 640x480 -r 25 -b:v 2M -minrate:v 2M -maxrate:v 2M -bufsize:v 1.4M -ac 2 -b:a 48k -mpegts_transport_stream_id 1025 -mpegts_service_id 1 -mpegts_pmt_start_pid 0x0fff -mpegts_start_pid 0x0121  -muxrate 2M -f mpegts -y mpeg2.fifo

I suspect that some of these parameters are surplus to requirements but these are what worked for me.

To use a webcam remove "dvgrab - |" from the start of the line and substitute "-i /dev/stdin -vcodec rawvideo"  with "-i /dev/video0 -vcodec mpeg2video"

To test that this step is working you can use mplayer to consume the video feed from the fifo file:
mplayer mpeg2.fifo

To transmit the video stream open another terminal window
cd ~/dvb-s
./dvbs_tx_hackrf.py

The transmission looks like this when received by gqrx on another HackRF.



How to receive the signal.

I used a standard DVB-S satellite TV receiver. However, these use an LNB which mixes the 10/11GHz signal with a 9750 MHz (or 10700 MHz) local oscillator (LO) to produce a signal around 1000-1250 MHz. In this case we do not use the LNB but connect an antenna directly to the input port where the LNB usually connects. 

WARNING: the antenna port has 13/18 Volts on the centre core. Do not allow your makeshift antenna to short across the inner and outer of the antenna port or you may damage your receiver.

In my example I have the HackRF Blue transmitting on 1000 MHz. I set the receiver to receive on 10750 MHz. As the LO is at 9750 MHz, 9750 plus 1000 = 10750. You need to know the LO your LNB is using (it is normally marked on them or try both values). So, I set the satellite receiver to scan for a signal on 10750 MHz. 

The other value the receiver needs to know is the symbols/second value. In the gnuradio program I have set it to 2 million symbols/second. Most satellite receivers will receive a minimum of 2m sym/sec, and this is the value you need to set in the receiver (or 2000k sym/sec). FEC can also be specified but my receiver set this to 'AUTO'.

Antenna

My satellite receiver is located underneath the television in an adjacent room to my study. Due to the use of a dummy load the transmission can only be received if the antenna from the satellite receiver is close to the dummy load. I used a length of satellite co-axial cable long enough to reach between both rooms, terminated one end with a F-type plug to fit the antenna socket of the satellite receiver. At the other end I connected the inner core of the co-ax to the driven element of a 1296 MHz beam I made recently. The outer core I taped up with insulating tape to ensure that it was not going to short to the inner conductor.

I haven't tried this but if you expose 7.5 cm of the centre conductor having cut back the outer sheath, the outer shield of copper and the inner dielectric (taking care not to short the inner and outer conductors) this should work as a quarter wave antenna at 1000 MHz. You will probably have to hold it very close to the dummy load connected to the HackRF Blue to receive the signal. 

WARNING: Wrap the centre conductor you expose in insulating tape to prevent accidental shorting as there is still 13/18V on the centre conductor.

With my 23 cm beam pointing at the dummy load I was able to receive the signal about 5 metres away.
 
References

Explanation of the ffmpeg parameters here and here.

Details of transmitting DVB-T using a webcam here.

Legal advisory

It is illegal to transmit on radio frequencies for which you do not possess a valid licence issued by your government. I hold an amateur radio licence so am allowed to transmit on a set of defined frequencies. However, for this experiment I transmitted into a dummy load, meaning that the transmission was not radiated more than about 3 metres.

For more information on becoming a radio amateur please contact your national amateur radio organisation. See the list here.

The small print

If some or other part of this doesn't work for you please don't send me a curt email saying "It doesn't work". It works for me on my system so try and understand why it doesn't work and adapt it to your environment.

Saturday, 25 April 2015

Meteor M-N2 reception with a HackRF


If you've got a HackRF you can easily use it to receive pictures from weather satellites in low earth orbit without tracking antennas, just like the one above (NB. the two thick black lines are a fault with the spacecraft and not with my reception!). NOAA have several LEO weather satellites in operation but these only transmit an older, lower resolution picture. The newer NOAA satellite had a problem which means that it does not transmit in the VHF frequencies.

However, the Russian satellite - Meteor M-N2 - is operational transmitting LRPT in the 137 MHz band.

There is a method of receiving these pictures on Linux using cheap RTL dongles (there are also methods on Windows which I will not cover) and I have adapted this method to work with the HackRF. Specifically I have also moved the receive frequency of the satellite away from the centre frequency the HackRF is tuned to. This avoids the centre DC spike and associated problems.

In the UK the satellite band is very close to wide area pager frequencies, this leads to considerable breakthrough of pager transmissions into the very weak satellite signals. This interference causes the couple of yellow and blue lines in the image above. What I have found is that this method of reception with the HackRF is much less susceptible to pager problems that when using an RTL dongle. It is also more sensitive compared to my RTL dongle leading to images received to lower elevations (where the signal is weakest).

The GNUradio program I have adapted is available here. Of course, you will need GNUradio installed (if you have a HackRF you presumably already do!)

You will find reference to my home directory in it which you will need to change first, and also make it executable chmod +x meteor_qpsk_rx_hackrf.py

Then simply run it by typing ./meteor_qpsk_rx_hackrf.py from the directory that you copied it into.

When you are receiving the satellite it helps to adjust the PLL Alpha slider on the QPSK constellation window to lock onto the signal (with the four clusters on the constellation) and when lock is achieve to move this slider to its minimum setting. With no signal the constellation should look iike this:






When the satellite is close I see a spectrum like the screen shot above, and the constellation like the screen shot below.



To work out when Meteor M-N2 is going to be nearby use the GPredict satellite tracking program.

Once the soft symbol.s file has been received using this program then it is time to open Oleg's LRPTOffLineDecoder program to produce the image. This is a Windows program but runs well under Wine in Linux.


The image above is a part of the window of Oleg's program. 
  • Click the "72k" button (as the satellite is sending data at a symbol rate of 72k but it has also sent at 80k).
  • Navigate to the place on your hard drive where the .s output file from the GNUradio program is stored, select the file and click ok.
  • You should see the two progress bars start to move and the constellation of the received signal show in the top left hand side of the window.
  • This step can take some time. 
  • If the image can be decoded the infrared/visible channels received will be shown to the right hand side.
  • Click "RGB" to generate a false colour image, you need to select the RGB drop down lists to correspond to the wavelengths that were received otherwise you will just get an all white or black image. You can also change the RGB settings to change the colouration of the image. At this point you can also save the image.
Oleg's website has other examples of images received plus links to the software etc. You can see other images I have received here.

NB: for nightime images only the infrared wavelength is usable (normally 10.5-11.5) so set the RGB settings all to 10.5-11.5. To achieve an image you can make sense of you will need to load the resulting image into GIMP and flip it horizontally, flip it vertically then invert the colours. Then adjust the contrast and brightness to bring out the land/sea by trial and error.

The image below is a night time image. This has not been rectified to take out the curvature of the earth as the image at the top of this post has.



The best antenna to use is a QFH, this link has details of how to build one. However, you could use a Crossed dipole, egg-beater (really!), or a simple quarter wave. You will receive something on a good overhead pass on a quarterwave or an amateur 2 metre antenna but don't expect images like the ones on this page. Of course, whatever antenna you use it should be as high and as in the clear and outside as possible. Having said that my QFH is pushed up through the branches of a tree. I also use an old 2 metre pre-amplifier to give the signal an added boost.