SMALL - espritmodel.com SMALL - Telemetry SMALL - Radio
Reply
Thread Tools
Old Mar 19, 2012, 08:07 PM
Just another user
Dennis Frie's Avatar
Denmark, Capital Region of Denmark, Naerum
Joined Feb 2011
1,080 Posts
Discussion
OpenLRS as spectrum analyzer (with GUI)

The OpenLRS system uses a RFM22B RF chip, which supports a good frequency-range an excellent RSSI-out, and have a pretty good sensitivity. At the price, it's hard to ask for more than that

I wrote a quick sketch and was pretty impressed with the results.
Please note, that the input-filter of RFM22B make it most sensitive around 430 Mhz (Great info Melih, thanks)

Here is a plot of the spectrum used by OpenLRS and TSLRS (OpenLRS top).


I also did a quick test with GoPro, and was able to see a clear difference. Having compared the plot with the spectrum analyzing done more profesionally by ssassen, it seems to have found the same spikes. It might not be as acurate, but being a 60$ receiver I don't complain at all.
http://www.rcgroups.com/forums/showp...5&postcount=15


So, now to the fun part. As I got pretty good results with the first test, I decided to write a little GUI. Not that I don't like Serial output and plotting in Matlab or Excel - but a GUI just makes things a lot easier.

So here goes. It's still an early test version (I started to code a couple of days ago), but it works well and should be a great little tool, if you already have an OpenLRS receiver or transmitter.

Here a plot with the OpenLRS transmitter on:


Again with OpenLRS on but a different plot-style:


Multiple scans and point-plot style. The interesting thing to notice is the frequency-junmping. Only a few of the samples detects the channels used.


TSLRS UHF system:


Just the background noise:


And a scan from 240 mhz - 470 mhz.
No idea what kind of electronic is causing the noise-peaks in the spectrum, but I have quite a bit around me . Get the exact same measurements of I sweep again.




The GUI and necessary software for OpenLRS can be found here:
http://code.google.com/p/openlrs/dow...q=#makechanges
Dennis Frie is online now Find More Posts by Dennis Frie
Last edited by Dennis Frie; Feb 17, 2013 at 06:22 PM.
Reply With Quote
Sign up now
to remove ads between posts
Old Mar 20, 2012, 02:46 AM
MelihK's Avatar
United Kingdom, England, Canterbury
Joined May 2008
1,366 Posts
Subscribed
MelihK is offline Find More Posts by MelihK
Site Sponsor
Reply With Quote
Old Mar 20, 2012, 05:50 AM
Electronics slayer
SouthPawPaul's Avatar
Reading, UK
Joined Jul 2008
494 Posts
With your diy osd and now this, you're doing some excellent work Dennis.
SouthPawPaul is offline Find More Posts by SouthPawPaul
Reply With Quote
Old Mar 20, 2012, 05:54 AM
NDw
Registered User
Ireland, Limerick, Kilmallock
Joined Aug 2010
2,123 Posts
Subbed too. Looks very interesting
NDw is offline Find More Posts by NDw
Reply With Quote
Old Mar 20, 2012, 07:07 AM
Just another user
Dennis Frie's Avatar
Denmark, Capital Region of Denmark, Naerum
Joined Feb 2011
1,080 Posts
Quote:
Originally Posted by NDw View Post
Subbed too. Looks very interesting
Quote:
Originally Posted by SouthPawPaul View Post
With your diy osd and now this, you're doing some excellent work Dennis.
Thanks
Any good ideas for improvements? I'll add resolution/step-size later today.
Dennis Frie is online now Find More Posts by Dennis Frie
Reply With Quote
Old Mar 20, 2012, 08:12 AM
Electronics slayer
SouthPawPaul's Avatar
Reading, UK
Joined Jul 2008
494 Posts
I'm in uncharted territory here, but my uneducated off the wall suggestion is maybe an aerial tuning wizard?

So you specify frequency and maybe it could give you some indication of how well the antenna is?

Like I say, I'm a complete noob when it comes to this so this request could be like asking a microwave to knit a jumper
SouthPawPaul is offline Find More Posts by SouthPawPaul
Reply With Quote
Old Mar 20, 2012, 08:19 AM
Just another user
Dennis Frie's Avatar
Denmark, Capital Region of Denmark, Naerum
Joined Feb 2011
1,080 Posts
Quote:
Originally Posted by SouthPawPaul View Post
I'm in uncharted territory here, but my uneducated off the wall suggestion is maybe an aerial tuning wizard?

So you specify frequency and maybe it could give you some indication of how well the antenna is?

Like I say, I'm a complete noob when it comes to this so this request could be like asking a microwave to knit a jumper
I have changed the name "Spectrum analyzer / Antenna measurement" to OpenLRS spectrum analyzer - just forget it when I took the screenshots.

I have another project with antenna-measurements, but that's another story
http://fpvlab.com/forums/showthread....ll=1#post72819

You can use the spetrum analyzer to tune for best RSSI, but that's more or less just look at the spectrum analyzing and go for the highest value
Dennis Frie is online now Find More Posts by Dennis Frie
Reply With Quote
Old Mar 20, 2012, 08:51 AM
Just another user
Dennis Frie's Avatar
Denmark, Capital Region of Denmark, Naerum
Joined Feb 2011
1,080 Posts
I have added step-size, works great and allows very fast scans, but with less precision/samples

Edit; And step-size changed at OpenLRS to 10khz to get maximum possible resolution if needed.
Dennis Frie is online now Find More Posts by Dennis Frie
Last edited by Dennis Frie; Mar 20, 2012 at 09:13 AM.
Reply With Quote
Old Mar 20, 2012, 09:57 AM
Just another user
Dennis Frie's Avatar
Denmark, Capital Region of Denmark, Naerum
Joined Feb 2011
1,080 Posts
With 10khz step-size and 500 average





Dennis Frie is online now Find More Posts by Dennis Frie
Reply With Quote
Old Mar 20, 2012, 01:40 PM
Just another user
Dennis Frie's Avatar
Denmark, Capital Region of Denmark, Naerum
Joined Feb 2011
1,080 Posts
Guess it's time for an available test-version

This code should be copy-pasted into OpenLRS. It's a mess, I'll clean it later

#define SPECTRUM_ANALYZER 1

Quote:
Originally Posted by Code View Post
// ================================================== ================================================== ====
// Spectrum-analyzer part
// ================================================== ================================================== ====

#if (SPECTRUM_ANALYZER == 1)

unsigned char read_serial =0;
char serial_buf =0;
int temp_buf[4] = {0,0,0,0};
unsigned char buf_index =0;

long totalreading;
int rssi_max = 0;
int rssi_min = 255;
long number_average = 100;

int start_freq = ((430-240)/10);
int end_freq = ((440-240)/10);

int step_size = 5;

// When running frequency scanning we want 50 khz between each channel, meaning 200 channels = 10 mhz.
_spi_write(0x7a, 0x01); // 50khz step size (10khz x value)

// Run infinite loop..
while (1==1) {

// Empty line when a full scan is completed
Serial.println();

// Scan from 240 mhz to 470 mhz.
for (unsigned int k = start_freq; k<end_freq;k++) {

for (unsigned int o =0; o<5; o++) {

// 0x40 = 240 mhz.
// 0x41 = 250 mhz
// 0x42 = 260 mhz.

unsigned int center_frequency = 0x40+k;
unsigned int sub_frequency = 0x32*o;
_spi_write(0x75, center_frequency);
_spi_write(0x76, sub_frequency);
_spi_write(0x77, 0x00);

// Scan 200 x 50 khz = 10 mhz.
for (unsigned int i =0; i < 200; i+=step_size ) {
_spi_write(0x79, i);
delay(1);

if (_spi_read(0x0C)==0) {RF22B_init_parameter(); to_rx_mode(); }// detect the locked module and reboot

totalreading=0;
rssi_max = 0;
rssi_min = 255;

// Used to average readings and find max if using frequency-hopping transmitter.
for (unsigned int j =0; j < number_average; j++) {

// Always check for incoming serial-data:
if (Serial.available()) {
serial_buf = Serial.read();

if (serial_buf == 35) {
read_serial =1;
}

else if (read_serial == 1) {

if (serial_buf == 44) {
buf_index++;
}

else if (serial_buf > 47 && serial_buf < 58){
temp_buf[buf_index] = temp_buf[buf_index]*10 + (serial_buf-48);
}

else if(serial_buf == 10) {
j=30000;
k=30000;
i=30000;
o=30000;

read_serial =0;
start_freq = (temp_buf[0]-240)/10;
end_freq = (temp_buf[1]-240)/10;
number_average = temp_buf[2];
step_size = temp_buf[3];

temp_buf[0] =0;
temp_buf[1] =0;
temp_buf[2] =0;
temp_buf[3] =0;
buf_index =0;

delay(100);

/*
Serial.print("Start_freq: ");
Serial.print(start_freq);
Serial.print("End_freq: ");
Serial.println(end_freq);
*/
}
}


}





Rx_RSSI = _spi_read(0x26); // Read the RSSI value
totalreading += Rx_RSSI;

if (rssi_max < Rx_RSSI) {
rssi_max = Rx_RSSI;
}

if (rssi_min > Rx_RSSI) {
rssi_min = Rx_RSSI;
}

rx_reset();
delayMicroseconds(250);
}

//Serial.print("Channel: ");
Serial.print(24000+k*1000+o*200+i*1);
Serial.print(",");

totalreading = totalreading / number_average;

Serial.print(rssi_max);
Serial.print(",");

Serial.print(totalreading);
Serial.print(",");

// Serial.print(i);
// Serial.print("\t");
//Serial.print(" RSSI min:");
//Serial.print(rssi_min);

//Serial.print(" RSSI max:");




Serial.print(rssi_min);
Serial.println(",");

//Serial.print(" RSSI avg:");




}

}
}

}

#endif

// ================================================== ================================================== ====
// Spectrum-analyzer part END
// ================================================== ================================================== ====
Dennis Frie is online now Find More Posts by Dennis Frie
Reply With Quote
Old Mar 20, 2012, 03:06 PM
Registered User
SW England
Joined Aug 2009
800 Posts
@ Dennis,

Downloaded and will try to do some test tonight...

It makes more sense for the start & end scanning frequency to be 430 - 470 MHz in your code (for standard OLRS modules) as I understand they do not work so well outside these frequencies (tuned circuits on the RFM22B module).

I'm really most interested in what the frequencies around where I'm operating are like - as in how much spurious RF soup is there on/near my frequencies.

Great work so far !

Nigel.
Devonboy is offline Find More Posts by Devonboy
Reply With Quote
Old Mar 20, 2012, 04:05 PM
Project Tormentor is flying!
United States, WA, White Salmon
Joined Nov 2005
2,066 Posts
Great work! I'm especially interested in seeing this used to detect noisy equipment to be used on a LRS equipped FPV plane. Such as ESCs, cameras, video switchers, and so on. I suspect some of these devices are horribly noisy on the 433mhz spectrum.
philthyy is online now Find More Posts by philthyy
Reply With Quote
Old Mar 20, 2012, 06:04 PM
Just another user
Dennis Frie's Avatar
Denmark, Capital Region of Denmark, Naerum
Joined Feb 2011
1,080 Posts
Quote:
Originally Posted by Devonboy View Post
@ Dennis,

Downloaded and will try to do some test tonight...

It makes more sense for the start & end scanning frequency to be 430 - 470 MHz in your code (for standard OLRS modules) as I understand they do not work so well outside these frequencies (tuned circuits on the RFM22B module).

I'm really most interested in what the frequencies around where I'm operating are like - as in how much spurious RF soup is there on/near my frequencies.

Great work so far !

Nigel.
As default the scan is set to 430 mhz - 440 mhz. But as it's only a matter of putting in start and end frequency in the GUI, it should be pretty easy to change .

Quote:
Originally Posted by philthyy View Post
Great work! I'm especially interested in seeing this used to detect noisy equipment to be used on a LRS equipped FPV plane. Such as ESCs, cameras, video switchers, and so on. I suspect some of these devices are horribly noisy on the 433mhz spectrum.
So far I have only tested shortly on GoPro, but I would like to see your scans from different components
I'll probably test a few in my setup, you can count on that
Dennis Frie is online now Find More Posts by Dennis Frie
Reply With Quote
Old Mar 20, 2012, 07:06 PM
Registered User
United States, TX, Mansfield
Joined Jan 2012
529 Posts
awesome project! subscribed
CTvxl is offline Find More Posts by CTvxl
Reply With Quote
Old Mar 20, 2012, 09:46 PM
Registered User
United Kingdom, Bath
Joined Apr 2007
193 Posts
Wow I had exactly the same idea: Cheap UHF spectrum analyzer using RFM22 module

Great minds think alike?

I was inspired by OpenLRS to make my own UHF system based on the RFM22, it was very useful to have a spectrum analyzer for debugging, range and antenna tests.

Although OLRS is cheap, I realized that the actual cost of the PCB and components are less then $20 if I make my own. At this price I can afford to put UHF systems in all my RC things! So far I am very impressed with the RFM22 module.
zitron is offline Find More Posts by zitron
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Sort of DIY 2.4Ghz Spectrum Analyzer village_idiot DIY Electronics 11 Feb 23, 2008 12:55 PM
Discussion RF measurement using spectrum analyzer and a Bird meter dalbert02 Radios 34 Nov 04, 2007 03:29 PM
DIY wide band receiver 100khz to 1.3Ghz/Spectrum Analyzer lazy-b DIY Electronics 6 Sep 15, 2004 07:23 AM