# Block for Doppler shift correction

**URL:** <https://www.ruby-forum.com/t/block-for-doppler-shift-correction/242841>\
**Category:** GNU Radio\
**Created:** [August 1, 2015, 10:19am UTC](https://www.ruby-forum.com/t/block-for-doppler-shift-correction/242841 "2015-08-01T10:19:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [August 1, 2015, 10:19am UTC](https://www.ruby-forum.com/t/block-for-doppler-shift-correction/242841/1 "2015-08-01T10:19:17Z")

</div>

Hi,

I’ve recently needed to correct some satellite signals for Doppler  
shift. I found that there was no easy way to do this yet - so I’ve  
created a small block that takes the Doppler shift information from  
Gpredict and populates a variable in GNU Radio with it any time the  
doppler shift changes. It allows for easy shift correction by mixing  
the signal, I’ve added an example flowgraph to do so as well.

You can find it here: [GitHub - wnagele/gr-gpredict-doppler: GNU Radio Gpredict Doppler shift correction block](https://github.com/wnagele/gr-gpredict-doppler)

Let me know what you think.

Cheers,  
Wolfgang

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Nagele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e495f1/32.png) [@Wolfgang\_Nagele](https://www.ruby-forum.com/u/Wolfgang_Nagele)\
**Post date:** [August 1, 2015, 10:33am UTC](https://www.ruby-forum.com/t/block-for-doppler-shift-correction/242841/2 "2015-08-01T10:33:53Z")

</div>

Hi Wolfgang,

You Wrote:

On 01/08/15 09:17, Wolfgang Nagele wrote:

> Hi,
> 
> I’ve recently needed to correct some satellite signals for Doppler  
> shift. I found that there was no easy way to do this yet - so I’ve

Interesting. The way I did it was the following (using predict, rather  
than gpredict):

```
a) Add a XMLRPC Server block to my flowgraph
b) Write a piece of python glue code which:
   i) Gets the normalised doppler info from predict via UDP 1210
   ii) Calculates the correct doppler for the s/c frequency
   iii) Sends it onto gnuradio to set a variable, which twiddles

```

a FIR filter by the correct amount rather than mixing via a multiply  
block.

Here is a version of the whole thing used for tracking Funcube-1  
aka AO-73. I use similar scripts for doppler correcting the NOAA birds  
as well, and do have a version which handles multiple spacecraft on one  
flowgraph

#!/usr/bin/env python

import sys  
import time  
import socket  
import xmlrpclib

# Create UDP Socket

predsock = socket.socket(socket.AF\_INET, socket.SOCK\_DGRAM)

# Create XML Object

s = xmlrpclib.Server(“[http://localhost:8080](http://localhost:8080)”);

# Get Satellite object or name

s\_c = str(sys.argv[1]);

doppler\_msg = "GET\_DOPPLER " + s\_c

while True:

# Get Doppler from Predict

predsock.sendto(doppler\_msg , (“127.0.0.1”,1210))  
doppler\_str,predaddr = predsock.recvfrom(24)

# Adjust for correct frequency

dopp\_float = float(doppler\_str)  
dopp\_freq = (145.935/100.000)\*dopp\_float  
print dopp\_freq , dopp\_float

# Send to grc

try:  
s.set\_dopp\_freq(dopp\_freq)  
except socket.error:  
pass

# Sleep

time.sleep(1)

All the Best

Iain

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Nagele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e495f1/32.png) [@Wolfgang\_Nagele](https://www.ruby-forum.com/u/Wolfgang_Nagele)\
**Post date:** [August 2, 2015, 4:28am UTC](https://www.ruby-forum.com/t/block-for-doppler-shift-correction/242841/3 "2015-08-02T04:28:13Z")

</div>

Hi,

Yes - I found that example but found it a bit complicated to use.

Basically I already plan my satellite recordings using Gpredict so  
attaching that to my GNU Radio flowgraph seemed like the simple next  
step.

I also thought about using [GitHub - nsat/pypredict: Spire port of predict open-source tracking library](https://github.com/nsat/pypredict) to have  
it all in GNU Radio.

Cheers,  
Wolfgang
