Skip to content

Comments

Drastically improve waterfall performance#7

Open
kieransimkin wants to merge 1 commit intoadafruit:masterfrom
kieransimkin:master
Open

Drastically improve waterfall performance#7
kieransimkin wants to merge 1 commit intoadafruit:masterfrom
kieransimkin:master

Conversation

@kieransimkin
Copy link

set_at() is extremely slow, plus we're doing a call to clamp() and
color_func() once per pixel. This causes the waterfall to be a bit
underwhelming. Using surfarray makes it quicker - I think you can
probably do away with the pixel iterator completely and copy the entire
row in one go (equivalent of a C memcpy())

set_at is extremely slow, plus we're doing a call to clamp() and
color_func() once per pixel. This causes the waterfall to be a bit
underwhelming. Using surfarray makes it quicker - I think you can
probably do away with the pixel iterator completely and copy the entire
row in one go (equivalent of a C memcpy())
@tdicola
Copy link
Contributor

tdicola commented Jul 20, 2015

Oh nice, yeah those look like some great optimizations for how it's manipulating the pygame surfaces. Let me setup a pi with it a little later this week to test it out and merge it in. Thanks for contributing!

@kieransimkin
Copy link
Author

I was actually wondering if Adafruit would be interested in collaborating on a "RF Scanner" PI shield?
My thinking is that it would be possible to combine a PiTFT, R820T, LM386 + speaker, plus a rotary encoder onto a single board. If you did this, you'd have an amazing next-gen scanner, the likes of which is not currently available in any form. I think that's a real marketable product, both as a Pi shield, and as a standalone ready-made device. Currently if you want an RF scanner you end up with something like this: (and the starting price is $150)

rad-sca-bc75xlt

I think, with Adafruit's purchasing power, it'd be possible to offer a Pi shield giving waterfall and spectrograph functionality way beyond what's capable with even $500 scanners, and to sell that for <$100 - the complete product assembled including a case would probably be saleable at around the $250 price point, would you agree with these guesstimates?

Obviously there'd need to be some improvements to the software - the ability to decode FM/AM audio streams would be a must - this may not be possible from Python, but certainly would be from C. Scanning functionality (ie, the ability to sweep across the spectrum looking for signals) would also be a must, but I'm already planning on adding that to your Python code.

I think there's a real opportunity here to produce a unique and highly desirable product - it's something I'm looking for myself and have yet to find. Would you raise this with your hardware team and see if they'd be interested in a collaboration? I could certainly design the hardware and write most of the software myself, but I'd need the backing or someone like Adafruit simply to source the RTL SDR chips at an affordable price - similarly, I don't have the purchasing power to get hold of a decent number of SPI TFTs - but Adafruit could do it ;) I think you'd probably want more than 320x240, ideally 800x600 or thereabouts. 3.2" / 4" would probably be the sweet spot in terms of physical screen size - people want a walkie-talkie sized device.

Let me know what you think :)

@kieransimkin
Copy link
Author

The closest thing I've come across is this:
http://www.elecraft.com/PX3/px3.htm
https://www.youtube.com/watch?v=ZQ7fkI9L36k
"Panadapters" are an established piece of Ham radio kit, but this one sells for $699 in kit form! .. and you still need a separate radio! I've never seen a handheld RF scanner that includes this functionality, and certainly nothing below the $300 price point that includes any visual waterfall at all.

@ThingEngineer
Copy link

Fast forward four years... This is off-topic from the OP but I like the "Scanner Panadapter Pi Shield/bundle" idea. I've used an RTL to add a panoramic adapter to an old radio shack scanner by tapping the first IF following akdude47's example.
https://www.rtl-sdr.com/rtl-sdr-as-a-cheap-panadapter/
http://huprf.com/huprf/pat-board/

I actually came here to grab this code so I can change from using GQRX software on a laptop to something more specific/stand-alone i.e. only the panadapter view on an RPI with a small TFT display, minus all the other stuff you see in GQRX or similar SDR applications. This would also open up the possibility of demod/decoding more than just FM/AM signals such as P25 trunk radio, DMR, and many other digital modes. The libraries exist to do most all of this already. Gqrx uses the open-source library gr-osmosdr Gnu Radio Blocks and has python support.

Back to the OP, I noticed this never got merged.

@wodowiesel
Copy link

wodowiesel commented Oct 13, 2019

@kieransimkin the idea with the scanner sounds really great, i only have a pi 1.2 B+ but its worth a try.

@colinluthier
Copy link

colinluthier commented Mar 27, 2022

I am sure everyone has moved on but this PR would be very useful. It will not run. I am getting this error:

Traceback (most recent call last):
  File "/home/pi/FreqShow_Small/freqshow.py", line 31, in <module>
    import controller
  File "/home/pi/FreqShow_Small/controller.py", line 31, in <module>
    from views import *
  File "/home/pi/FreqShow_Small/views.py", line 803
    print build_palette(self.color_func)
SyntaxError: invalid syntax

          ^

I don't really understand what is going on here to fix it.

@colinluthier
Copy link

Ah, it just needs to be commented out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants