An even simpler 2.4g spectrum analyser / band scanner

Any old or new electronic projects on the go
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

An even simpler 2.4g spectrum analyser / band scanner

Post by Martin »

This is an update to the old scanner project which is here: http://mode-zero.uk/viewtopic.php?f=9&t ... canner#p18
With the arrival of the RF-Nano a scanner can be built using just an RF-Nano, a cheap ebay OLED , a PP3 battery and a few short pieces of wire - its the simplest project to build yet is incredibly useful for displaying the spectral output of any 2.4g transmitter.
The RF-Nano is available from Aliexpress: https://www.aliexpress.com/item/32980796969.html
OLEDs are plentiful on ebay, eg: https://www.ebay.co.uk/itm/1-3-OLED-LCD ... 2967389693
If you buy the 1.3" version there are no code changes to make, just load the sketch as is.

If you want to use the smaller 0.96" display you need to edit the file SSD1X06.h
You can do this in the IDE by clicking on the tab labelled "SSD1X06.h"

The as-is settings for the 1.3" OLED are:

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
For the 0.96" OLED move the // comment slashes so it reads 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
Save the file and recompile. This is only necessary for the 0.96" screen, the 1.3" needs no changes.
The photos show a 1.3" display:


IMG_20200611_194010_201.JPG

IMG_20200611_195055_237.JPG

IMG_20200611_195645_040.JPG

IMG_20200611_195831_182.JPG

screen.jpg

scanner.jpg

IMG_20200414_190516_607.JPG



Heres - the diagram - it really is this easy, but check the display annotation as some OLEDs have the
four pins in a different order, as you can see from the photo above :D


scanner_rfnano.jpg


By borrowing the redundant A6 & A7 input-only pins for the power connections, the display can be rigidly mounted on a 4-pin header soldered to A4, A5, A6 & A7 but only IF the order of vcc, gnd, clock & data align correctly: (if not its only 4 wires....)

scanner_rfnano3.jpg


...and the sketch.

This differs from the original only in that the CE and CSN pins are transposed (D9 and D10 swapped):

nRF24L01pScannerOled_RFNano.zip
Version for the 'real' Keywish RF-Nano
(7.34 KiB) Downloaded 265 times

Since this project was posted a different type of RF-Nano has appeared - it has a red PCB and is made by 'Tstar Tech' and has two differences - the CE and CSN pins are changed to 7 and 8, and its not the 'plus' version of the NRF24L01:
nRF24L01ScannerOled_tstarRFNano_notplus.zip
Version for the red Tstar RF-Nano only
(7.49 KiB) Downloaded 218 times

This is the 'universal' version which can be configured for the small 0.91-inch 128x32 or either size 128x64 oled, and any type of RF-Nano, but see notes here on how to configure for other displays and boards:
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 240 times

This is Martins original code from 2016 which suits the original diagram for the separate NRF24L01+ and Nano:
nRF24L01pScannerOled.zip
Martins original code as per the original diagram
(7.22 KiB) Downloaded 214 times
Cheers
Phil
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 »

...as many of you might have noticed I use a lot and often pin heads to stack boards and here I use 2 between A4-A5 and SDA-SCK and in such way I obtain a fix connection between the 2 board.
This scanner is of invaluable help when working/following RF projects, Thank You
unnamed.jpg
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 »

It makes me wonder if it will be possible to program the adjacent analog pins as high and low, and use pins for all four connections?

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

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

Post by Martin »

I don't think it will work, Max, at least for the display shown in Phil's diagram. I think you'd need to use A6 and A7, which are analogue input only.

Different OLED displays have different pin-outs, so if you have one where VCC and GND happen to line up with A2 and A3, then I think your idea will work as those pins can work as outputs - the OLED displays draw about 20mA of power, and this falls within the specification of what an output pin can drive.

It is possible to use pins other than A4 and A5 to drive I2C devices - but this requires a software I2C library that doesn't work as fast as the normal one: the AtMega's built-in hardware for I2C is connected to A4 and A5 and cannot be reassigned.
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 »

Thanks Martin, I should try to remember that, Phil told me exactly the same thing when I asked that same question on my pulse monitor project....... :roll: :roll:

Cheers,
Max.
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 »

Tobe wrote: 12 Apr 2020, 15:43Just don't forget to define the type of oled display used under SSD1X06.h
SSD1106 or SSD1306
I have got a SSD1306 lying around, what exactly do I change? Just search on SSD1X06 in the sketch and replace with SSD1306 ?
Rename the library? Does not seem likely to me, but who knows...
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's in the file SSD1X06.h, Max, lines number 10 and 11. You don't have to rename any files - just make an edit, if neccessary, to the two lines shown below, putting a // at the start of one and removing the // from the start of the other. Then save that file, and recompile the sketch to make a version that works for the other display module.

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
I screwed up with the name of the larger display - the correct name is SH1106 not SSD1106 - but it's only a flag for the compiler, so I never bothered to change it. You could change all occurrences of SSD1106 (in all the files in the sketch folder) to the correct SH1106, or some other name like SALAMANDER, and it would work just the same. :lol:

The way it is above is what you want for the smaller 1306 display. For the slightly larger 1106 display you swap over which line is commented out - the compiler treats everything following // on a line as a comment, so this is a common method of coding compile-time options.

The 1.3" (SSD1106) is the default in the files I uploaded here, so you will need to swap it for your .96" display.

Don't worry about getting it the wrong way round - nothing will be harmed, but you'll either get a blank display or one filled with flickering garbage if you select the display driver option for the opposite type of display. If that happens, just swap over which line is commented out, recompile, upload again, and then it should work.
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

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

Post by bluejets »

Have found the 0.96" Oled to be rather fragile around the lower corners of the screen.

What I have been doing lately is applying a bead of B-7000 glue between the underside edge of the screen and the board......left and right bottom side about the last 5mm and along the bottom edge as the sides seem to be where any crack develops and renders the Oled useless.

Addition of the glue tends to add support in that area, dries a bit like the thread lock they used to use in older electronics ( green stuff originally)
Attachments
B-7000.jpg
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 Max

I've added soft I2C to Martins program and swapped SCL and SDA around in software, configured A2 as ground, A3 as Vcc, A4 as SCL and A5 as SDA so the OLED just goes straight into the RF-Nano and there are only four solder connections to make. About as simple as it gets.

Make sure which way around the supply on your OLED is, I found two OLED in my parts box and one had the pins in the order GND, Vcc, SCL and SDA which is what the order in the program is.

The other OLED pin order was Vcc, GND, SCL and SDA and would need the supply swapping in software.
#define GND 17 //A3
#define Vcc 16 //A2

2.4_Monitor.jpg

In the photo, I'm powering it via the micro USB. It is slightly slower than Martins hardware I2C version, but unless you have them running side-by-side, you wouldn't notice the difference.

Cheers

Mike
Attachments
nRF24L01pScannerOled_Soft_I2C.zip
(10.1 KiB) Downloaded 215 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 »

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
Cheers,

Tobe
Post Reply