An even simpler 2.4g spectrum analyser / band scanner

Any old or new electronic projects on the go
User avatar
Mike_K
Posts: 669
Joined: 16 Feb 2018, 06:35
Location: Hertfordshire

Re: An even simpler 2.4g spectrum analyser / band scanner

Post by Mike_K »

Hi Tobe

You can make them any pin you fancy, with the exception of the pins used for the SPI interface for the nRF24L01+. So avoid 9, 10, 11, 12 and 13. The power pins are defined in the program "Tab", the I2C pins in the SSD1X06.cpp "tab". If you use the analog pins A0 - A5 they are actually digital 14 to 19.

So turn up-side-down and assuming your OLED pin order is GND, Vcc, SCL and SDA you would use:

#define GND 19 //A5
#define Vcc 18 //A4

#define SCL_PIN 17 //A3
#define SDA_PIN 16 //A2

Alternatively, it works on the bottom data pins just as well and what I started with yesterday before moving the OLED to the A2, A3, A4 and A5 pins:

#define GND 2 //D2
#define Vcc 3 //D3

#define SDA_PIN 5 //D5
#define SCL_PIN 4 //D4

Soft_I2C_Scanner.jpg
Mike
Tobe
Posts: 665
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

Re: An even simpler 2.4g spectrum analyser / band scanner

Post by Tobe »

Thank You Mike, you are succeeding to learn an old dog new tricks!
Cheers,

Tobe
User avatar
Phil_G
Posts: 597
Joined: 15 Feb 2018, 23:32
Contact:

Re: An even simpler 2.4g spectrum analyser / band scanner

Post by Phil_G »

I tried one of Tobe's "Tstar Tech" RF-Nanos, the red PCB ones, and it didnt work, just filled the screen up with pixels. From previous troubles I suspected CE/CSN so stuck one under the microscope and traced them and found they're different to a Keywish RF-Nano, Tstar use CSN = D8 and CE = D7.
So I reconfigured Martins scanner sketch & it works fine now, here it is, note this variation of the code is only for the red Tstar Tech board.

Anyone using the Tstar Tech board for other RF projects please note, and remember its not a 'plus' so will not do 250k bps. Your RF24 instance will be:

Code: Select all

RF24 radio(7, 8);  // Tstar Tech red RF-NANO only
For a scanner these boards are ok (just use the attached zip) but if you're buying, I would always suggest the Keywish ones.


Frsky D8 Sprengbrook Precision 6
Frsky D8 Sprengbrook Precision 6

Tstar Tech red RF-Nano.
Tstar Tech red RF-Nano.
Attachments
nRF24L01ScannerOled_tstarRFNano_notplus.zip
(7.49 KiB) Downloaded 181 times
Tobe
Posts: 665
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

Re: An even simpler 2.4g spectrum analyser / band scanner

Post by Tobe »

Work like a charm, thank you. Just a thought, could the "128x32 OLED", the tiny Oled you are utilizing for the pwm monitor be used, thinking if include it in a transmitter as you suggested?
Cheers,

Tobe
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: An even simpler 2.4g spectrum analyser / band scanner

Post by Martin »

It could work. Leave off the number scale and compress the vertical axis a little to fit it in 32 pixels of height instead of 64? Let me know, I have a 128x32 here somewhere so I can quickly modify and test the sketch, once I know how you want the display laid out.
Tobe
Posts: 665
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

Re: An even simpler 2.4g spectrum analyser / band scanner

Post by Tobe »

Appreciate that Martin, I think what you suggested is perfect when installed as monitor in a transmitter, whith a switch of its own it would be possible to choose between monitor my transmitter or the transmitter around

Cheers

Tobe
Cheers,

Tobe
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: An even simpler 2.4g spectrum analyser / band scanner

Post by Martin »

Here you go. I don't have a Tstar tech board to try it with, but I think it should work. I tested it with a Keywish RF-NANO, and I think only the CE and CS pins are different?
scanner.jpg
The attached version should work with the Tstar tech board and the small 128x32 OLED.

I tidied up the code and macros a little to make this version pretty universal for any of the three OLED displays, and any combination of CE and CS pin chosen from 7, 8, 9, 10 - now you only have to specify the pin numbers and the macros do the job of creating the bit-banging constants.

So in the main nRF24L01pScannerOled_20-07.ino file you just change the lines:

Code: Select all

#define CE_pin    7
#define CS_pin    8
...and in SX1X06.h you comment out two of the three display type definitions - here the 'SMALL' display is the chosen one

Code: Select all

//#define SH1106 // most 1.3-inch 128x64 OLEDS
//#define SSD1306 // most 0.96-inch 128x64 OLEDS
#define SMALL128x32  // most 0.91-inch 128x32 OLEDS
Geek notes: Macros are good for specifying options like this - they look complicated but the compiler does all the work at compile time, so the resulting code runs just as fast, and is just as small, as if you'd manually edited the source code to only include the correct options for your particular hardware. I was going to use macros to make the CE_pin and CS_pin be choosable for any pins from 0 to 10 - but I decided that was unnecessarily "clever" just for the sake of it, and would confuse readers of the code even more than the current version! :lol:
Attachments
nRF24L01pScannerOled_20-07.zip
This version is configured for the small 0.91-inch 128x32 OLED with the Tstar tech board, but see notes above on how to configure for other displays and boards.
(7.7 KiB) Downloaded 192 times
Tobe
Posts: 665
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

Re: An even simpler 2.4g spectrum analyser / band scanner

Post by Tobe »

Thank You Martin, it sure works nicely, highly appreciated
Cheers,

Tobe
MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

Re: An even simpler 2.4g spectrum analyser / band scanner

Post by MaxZ »

Hi all,

I made a scanner using a Tstar Tech red board, using the code version that Phil created for it. My oled screen is a SSD1306, specs are here: https://nl.aliexpress.com/item/32977643 ... 4c4dRzsisD.
It came with the header pins soldered, so I mounted it directly onto the A4 and A5 connections of the nano. I borrowed A6 and connected it to 5V, same for A7 to ground, basically following the picture in the first post of this topic, but with Vdd and Gnd swapped as this is how my oled is configured.

I uploaded the sketch successfully (after I found I had to select the "old bootloader" version in the IDE). The result is a totally black screen. I checked the supply pins, and they read about 4.5V

Where did I go wrong?
DSC04056.JPG
DSC04054.JPG
Cheers,
Max.

Edit: My fault, I was convinced I had changed the SSD1X06.h library to my SSD1306 and saved it, apparently not.
Everything is fine now, I can see the spikes of my RF24 tranny :D
I would have liked to see them a bit higher though, even right next to the tx arial they are only a few pixels high.
Last edited by MaxZ on 09 Jul 2020, 12:30, edited 2 times in total.
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: An even simpler 2.4g spectrum analyser / band scanner

Post by Martin »

If you're using Phil's version, you need to edit the file SSD1X06.h, lines number 10 and 11, to suit the SSD1306, so it looks like this:

Code: Select all

//#define SSD1106 // comment out one or other of these lines so as to leave the definition active for the type of display driver you have
#define SSD1306 // comment out one or other of these lines so as to leave the definition active for the type of display driver you have:
Or you could try my 'universal' version from the post on the previous page (page 2) in which case you edit the SX1X06.h file so it looks like this:

Code: Select all

//#define SH1106 // most 1.3-inch 128x64 OLEDS
#define SSD1306 // most 0.96-inch 128x64 OLEDS
//#define SMALL128x32  // most 0.91-inch 128x32 OLEDS
Post Reply