nRfMon - RFM12B forensics

Added by dzach about 1 year ago

nRf Mon is coming of age and now has it's own project page in JeeLabs. The project page will eventually become a guide on how to use the nRf Mon spectrum analyzer. The code is in github .

Sample Display:

Full Control Panel:

Transceiver settings
Quick Settings:

Quick settings

rf12forensics31.png - Transceiver settings (97 KB)

rf12forensics30.png - Quick settings (28.8 KB)

rf12forensics32_c.png (118 KB)


Replies (239)

RE: RfMon - RFM12B forensics - Added by JohnO about 1 year ago

I wonder if we could squeeze this sketch into RF12Demo and then have an analysis mode to flip into.

RE: RfMon - RFM12B forensics - Added by JohnO about 1 year ago

Umh, it doesn't compile with the @tht version of RF12.cpp/h:

rf12mon.ino: In function 'byte getRSSI()':
rf12mon:16: error: void value not ignored as it ought to be

RE: nRfMon - RFM12B forensics - Added by dzach about 1 year ago

I don't think it can be included into RF12Demo, because RF12Demo is supposed to run on its own, while this sketch requires an additional program, nRfMon.
However, I have another version which works with just the serial terminal of the Arduino IDE which could be included into RFDemo, if it's found worth the memory it occupies :-)

rf12mon.ino: In function 'byte getRSSI()':
rf12mon:16: error: void value not ignored as it ought to be

This is an issue with the modified RF12 library. The original returns an uinit16 instead of void in the modified:

original RF12.cpp:

uint16_t rf12_control(uint16_t cmd)

tht's modified RF12.cpp:

void rf12_control(uint16_t cmd)

You may try compiling it with the unmodified RF12 lib. But, for the time being, the version on github is still the very first commit. The newer one is coming soon. I'll report the error.

RE: RfMon - RFM12B forensics - Added by JohnO about 1 year ago

I have it running using the current jeelib library. I am running tcl on
my win7 PC and it all behaves very well - I now just need to appreciate
what it is telling me. A snapshot image button would be nice too.

RE: RfMon - RFM12B forensics - Added by dzach about 1 year ago

Thanks for trying RfMon!

A snapshot image button would be nice too

The snapshot of the waterfall is easy, it is already an image, I just need to find some space to put the button (I tried to avoid using a menu bar, but it would help). The snapshot of the whole RfMon screen, with the cursors, markers and events has to use postscript at the moment, and requires some work with the colors, because they come out on a white background.

I haven't looked at auto-discovering COM: ports for Windows, so one has to know what port is being used by the node. In Linux, the program searches for /dev/ttyUSB* and /dev/ttyACM* ports and presents them in the port combobox.

RE: RfMon - RFM12B forensics - Added by dzach about 1 year ago

JohnO wrote:

I now just need to appreciate what it is telling me.

Unfortunately, with the version on github, the ability to transmit is not there, so you are just monitoring the band, probably seeing noise coming out of nearby electronics or the node itself. Seeing regular node transmissions is difficult because they only last milliseconds and the normal scan time for one line is in the order of 2 sec. To be able to see the signal of a node, I have implemented a 'Continuous Wave, CW' mode where the transmitter is turned on for a good number of seconds so the signal can be displayed on the RfMon.

I could create a 'develop' branch in github to put in the code I'm working on right now, but this requires some more administration time, and I was hoping to have the newer version committed soon.

RE: RfMon - RFM12B forensics - Added by JohnO about 1 year ago

I was very impressed when it allowed me to key in com4.

RE: RfMon - RFM12B forensics - Added by JohnO about 1 year ago

Don't rush anything on my behalf, I am enjoying what you have given
already. Many thanks!

RE: RfMon - RFM12B forensics - Added by JohnO about 1 year ago

Holding the tip of the JeeNode aerial cuts out a huge amount of background signals.

RE: RfMon - RFM12B forensics - Added by dzach about 1 year ago

You are welcome. I'm just scratching my own itch here, but as usual with open source, it might be beneficial to all.

I believe a great number of RFM12B problems may be easier to solve if one can 'see' what happens on the radio waves. Trying to solve radio problems by sending packets is rather unusual, because that involves many unknown or difficult to control parameters. Separating the RF problems from the rest makes it easier to handle them.

RE: RfMon - RFM12B forensics - Added by dzach about 1 year ago

JohnO wrote:

Holding the tip of the JeeNode aerial cuts out a huge amount of background signals.

But unless you see the amplitude of the desired signal, it might cut out every other signal as well.
This is why the CW transmit is an absolute necessity. It helps you see what happens to the desired signal.

RE: RfMon - RFM12B forensics - Added by dzach about 1 year ago

The new version of RfMon will include a waterfall spectrum display in the form of ASCII art, that doesn't require running anything else than a serial terminal or the Arduino IDE. Here is what it looks like (annotated), when receiving a signal from a node 6m away @ 868MHz (ch. 1600), -17.5dB power output attenuation:

1000l 2200u 13z 1s                                                                           <- commands given to start scanning

<0z  l 1000 u 2000 z 13                                                                      <- rf12mon.ino's execution of above commands
<2200u  l 1000 u 2200 z 13
<13z  l 1000 u 2200 z 13
<1s  l 1000 u 2200 z 13
                                                                            .                <- noise
                                                                            .                
                                                                        .   .                
                                                                         .............  . .. <- transmission starts here
. .. ... ....  .....;..  ..;....... ....~~+#=~~;; ......... ..;;.... ..;;.... ..;;.......;;..
; . .........;;.......... ........ ..;;;;~+##~  ;. .......... .. . ..  ..;......... ..;......
...... . ......;........ .............;;; +##+~ ;..;........ .... . ...  ...  .... . .  .. ..
 ..;.. . ....  ....  ..;;...... ..;;...  ~+##~~;; ...........  . .................. ..  . .. 
 . .. .......  .. ..;;.........;;;....;;;~+##~~; ......... .... ....  ...  .. ..;.... .....  
..;;.... ..;;........ ........;.......  ;~+##~~; ....... ..;;.....  . .....  ..;;..  ...  ..;
. .........  . ............;..  ....;.;;~~+##~~;;...... ... . .....;;....... ..;;.. .....;;..
.......  ..;.. ... ..;........ . .....;;;~+##~~;;;..  . ......... .... . .   ..;;............
..;.....  ...  ..;;........ .. . ......;  +##~~;;. ..  ......;.. ....  . ...  . .. . ........
.. .. ..;.. ..;... .......... ..;;.....;;~ ##~~;;....  ..;;........ ........;;........ ......
...  ...... ..;.........  ..;.. ...  ..;.~+##; ;;;........ .. ..;;.  . .....;...;;. .....  ..
. .... .......;;.. ..  . ......... ...;;;~+##~~;;... .....  . .........  . ..  ..  ..;;......
..; . ..... ..... .... ..;.....                                         ;   .;               <- transmission ends here
                                                                       ..   ; .              
                                                                       .    ..               
                                                                        ;   . .              
                                                                            . .              <- noise

This way one may immediately see if there is a signal coming in from the other side (which, running the same sketch, executes a command '30x' to turn on the transmitter for 30 s of CW). The ASCII display can be tuned to different frequency and scan zone width. Here it is scanning from 865 to 871MHz (ch. 1000 - 2200) with a resolution of 13 channels, i.e. 13 x 5kHz = 65kHz. The receiver's bandwidth is set to 67kHz.

And here is how the same signal but with a 0dB attenuation is displayed:

                                                                       .    ; .              
                                                                            . .              
                                          ++##=+  ~~. ~; ~~~~~ ~~~  ;~~~; ~~~  ~~;~ ~~~  ~;;~
~;~+~~~.; ;~~~~~  ~~~ ~~.~~~~+~+ =+= ==== =#=# ## # ==~~~~~~~ ~~~.~~; ~~~~ ~~.~;~;~ ;; ~. ;;.
 ;;;++~~~~~~~~  ~~;~ ~~~~~~~~~ +~+++++=+===###=##=##==~~~~~  ~~~~~  ;~~~~;~;~~ ~~~~~. ~~~~~; 
 ~;;  ~~;~~;. ~ ~~~ ~~~~~ ~~  ~~+++++++~=====#=.#=====~~~~~~~.~~~  ~~; ~~~~  ~~~~ ~~~~~~; ~~;
  ~~;;~~;;  ~~~~. ~~~ ~~; ~~~ ~~~++ +~+.++===#===== ++~~~~~; ~~~ ~~  ~~~ ~~~~~. ~~. ;;~;~ ~; 
~;;;  ;; ;~ ~~. ~~~~~ ~~;~~ ~~ ~~~~+++~ + =========+++~~~ ~~~~ ~~. ~~; ~~~~.~~;~~ ~~~ ~~ ~~~ 
~~ ;;  ~;~~ ~~~~~;~;  ~~~ ~~~ ~+~~ ~;~~ +  =##====++; ~~~~ ~~~~~ ~~~  ~~~;~~ ~~ ~~~~;~ ;; ~~;
;~~~ ~;~~~; ~~~~~ ~;~~~; ~.~; ~~~~~ ~ ~~~+++##=+++~~  ~~~~~ ~  ;~~~.  ~;~~~  ~~;~ ;.;; ~~. ~~
~~;~;;~~~+~  ~~~.~~ ~;~~. ~~~ ~++~ ~; ~; +++##=#####==+++++; ~~~~~  ~~  ~~~~~ ~+~.;;. ;~~~~~ 
~.;~~~~  ~;~ ~~; ;~ ~  ~; ~~~ ~+++++++ +====#==  #===;~. ~~~ ~~~~. ~~~~~~~;~~ ~~.~;; ~;  ~;~;
 ~;~~. ;                                                                    . .              
                                                                        .   .;               

I believe these look better in the Arduino serial monitor than they do on this forum page :-/

RE: RfMon - RFM12B forensics - Added by martynj about 1 year ago

Good use of the very limited display capabilities of an ASCII device !
Dropping the LNA gain a notch or two may well clean up the displays further.

RE: RfMon - RFM12B forensics - Added by dzach about 1 year ago

I am stuck with debigging a problem with delay() not delaying as it should. I suspect a fuse problem (it's been some time now, but didn't have the time to revisit this issue). I have implemented an auto transmit feature in RfMon that's supposed to turn on and off the transceiver for defined periods. Here is a measurement of what happens:

The off time is managed by the milli() function and is OK, it lasts 10s. The on time is managed by the delay() function and was supposed to last for 30s, however it lasts only 6-6.5s, that is abt. 5 times faster. I suspect the clock setting fuse is messed up, but then why is the milli() function giving correct results?

This is what I get when I examine the node with avrdude

avrdude -c usbtiny -p m328p -v
Reading | ################################################## | 100% 0.01s
...
avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5
...
avrdude done.  Thank you.

Here is a picture of the crystal:

and one of the CPU:

But I get exactly the same behavior with the JeeNode. Any explanation/hint please?

rf12forensics33.png (32.4 KB)

Nano_xtal.jpg (25.9 KB)

Nano_cpu.jpg (42.4 KB)

RE: RfMon - RFM12B forensics - Added by martynj about 1 year ago

The standard delay function is 'orrible! It is a compute bound loop (so actual time will depend on the CPU clock setting/compile time options). Mercifully, it does not turn off interrupts, so drivers can still function.
_milli() uses a timer.

RE: RfMon - RFM12B forensics - Added by JohnO about 1 year ago

Which device are you selecting in the Arduino IDE?

RE: RfMon - RFM12B forensics - Added by dzach about 1 year ago

Yes, I've read about it being awful in many places, but having it off by a magnitude of 5 means something is terribly wrong with my settings, no? I cannot find the fuse settings for a 16MHz clock here , I guess I could use one of the 8MHz- choices, but which one?

JohnO
Which device are you selecting in the Arduino IDE?

My settings for the JeeNode in the boards.txt are these:

jeenodev5.name=JeeNode v5/6 
jeenodev5.upload.protocol=arduino 
jeenodev5.upload.maximum_size=32256 
jeenodev5.upload.speed=115200 
jeenodev5.bootloader.low_fuses=0xde 
jeenodev5.bootloader.high_fuses=0xde 
jeenodev5.bootloader.extended_fuses=0x05 
jeenodev5.bootloader.path=optiboot 
jeenodev5.bootloader.file=optiboot_atmega328.hex 
jeenodev5.bootloader.unlock_bits=0x3F 
#jeenodev5.bootloader.lock_bits=0x0F 
jeenodev5.bootloader.lock_bits=0x2F
jeenodev5.build.mcu=atmega328p 
jeenodev5.build.f_cpu=16000000L 
jeenodev5.build.core=arduino 
jeenodev5.build.variant=standard

For the Nano they are the same except for:

nano328.name=Arduino Nano w/ ATmega328
...
nano328.bootloader.low_fuses=0xFF
nano328.bootloader.high_fuses=0xDA
nano328.bootloader.extended_fuses=0x05

so I select JeeNode v5/6 or Nano w/ ATmega328
but they don't seem to make any difference to the delay() problem I have.

RE: RfMon - RFM12B forensics - Added by martynj about 1 year ago

Or the latest compiler said this delay looping is dumb, I can optimise that a bit... ;-)

RE: RfMon - RFM12B forensics - Added by JohnO about 1 year ago

jeenodev5.build.f_cpu=16000000L

I suspect your crystal, I don't see a speed engraved on it - is there one?

RE: RfMon - RFM12B forensics - Added by JohnO about 1 year ago

You could use the delay derived from @tht's version of RF12.cpp - if the
null/int16 return gets fixed. That is based on the RFM12B crystal which
is quite accurate I understand.

RE: RfMon - RFM12B forensics - Added by JohnO about 1 year ago

You could setup a WDT timer and a sleep loop.

RE: RfMon - RFM12B forensics - Added by dzach about 1 year ago

Can't sleep while scanning!

This is the ceramic resonator of the JeeNode, the Nano has something like "A4" scratched on it, see above.

EDIT:
Well, it's not scanning while transmitting but it's listening to the serial port for incoming commands, when in xmit off mode. Can I put it to sleep while it's transmitting?

Jeenode_xtal.jpg (16.2 KB)

RE: RfMon - RFM12B forensics - Added by JohnO about 1 year ago

Delay would impact your incoming serial commands since it just waits without executing user code.

RE: RfMon - RFM12B forensics - Added by JohnO about 1 year ago

You could use @jcw's Sleepy::loseSomeTime(60000); command in a loop.
http://jeelabs.org/2011/12/13/developing-a-low-power-sketch/

1 2 3 ... 10 (1-25/239)