An even simpler 2.4g spectrum analyser / band scanner

Any old or new electronic projects on the go
Tobe
Posts: 239
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

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

Post by Tobe » 19 Jun 2020, 16:15

Question:
can I swap around at my leisure A2 A3 A4 A5? Reason is then when I stuck the on top of each others I can turn the OLED 180 deg w/o the need to turn the RF-Nano upside down

Mike_K
Posts: 372
Joined: 16 Feb 2018, 06:35

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

Post by Mike_K » 19 Jun 2020, 16:56

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: 239
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

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

Post by Tobe » 19 Jun 2020, 21:09

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

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

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

Post by Phil_G » 29 Jun 2020, 20:11

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.


IMG_20200629_200907_046.JPG
Frsky D8 Sprengbrook Precision 6

tstar_tech_rfnano.jpg
Tstar Tech red RF-Nano.
Attachments
nRF24L01ScannerOled_tstarRFNano_notplus.zip
(7.49 KiB) Downloaded 8 times

Tobe
Posts: 239
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

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

Post by Tobe » 30 Jun 2020, 16:19

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?

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

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

Post by Martin » 30 Jun 2020, 17:24

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: 239
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

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

Post by Tobe » 30 Jun 2020, 17:36

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

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

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

Post by Martin » 01 Jul 2020, 11:22

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 5 times

Tobe
Posts: 239
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

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

Post by Tobe » 01 Jul 2020, 14:42

Thank You Martin, it sure works nicely, highly appreciated

Post Reply