RF Analyzer for Android 安卓平台连接HackRF的App

Over the last week I've been working on a new project, trying to build a spectrum analyzer for Android that works with my hackrf_android library. Now I finally reached the point were it is stable enough to be useful and I created the GitHub repository today:

https://github.com/demantz/RFAnalyzer

It is still very basic and I have a lot of ideas to extend its functionality, but I thought it's better to have testers involved as early as possible. Eventually it should evolve in something similar to GQRX, supporting different modes and devices. But that will take some time!

The new version of RF Analyzer (1.07) has now support for AM/FM demodulation! It is now also available on Google Play:

See the readme on GitHub for a more detailed description!

RF Analyzer running on a Nexus 5

In this blog I'm going to show what you can do with the app and in the end I explain how it is working internally for those who like to play with the source code. I also tried to document the code as good as possible, but it is always easier if the basic flow of the program is explained before looking at it.

What you can do with it

Right now there aren't many fancy features. The app will present you with a simple UI showing the frequency spectrum including a waterfall plot. Here is a list of what you can do right now with version 1.00:

  • Browse the spectrum by scrolling horizontally
  • Zoom in and out, both horizontally and vertically
  • Adjust the sample rate and center frequency to match the current view of the screen by double tapping
  • Auto scale the vertical axis
  • Jump directly to a frequency
  • Adjust the gain settings of the HackRF
  • Select a pre-recorded file as source instead of a real HackRF
  • Change the FFT size
  • Setting the frame rate either to a fixed value or to automatic control
  • Activate logging and showing the log file

I'm planning to also support the rtl-sdr in the future and of course I want to include the actual demodulation for common analog modes like AM, FM, SSB, ... But so far you can only browse the spectrum. Here is how you get it to work:

Plug the HackRF into your Android device using an OTG (on-the-go) cable. You can get those cables for around 3$ and you can also find them as Y-version which enables external powering the HackRF, for those phones/tablets that don't deliver enough power. After you start RF Analyzer you can hit the start button in the action bar and it should prompt you for the permission to access the USB device. Once you did that the FFT will start:

FFT at 20 Msps showing FLEX pagers at 931 MHz

Use common gestures to zoom and scroll both vertically and horizontally. Note that the vertical axis of the FFT plot also affects the colors of the waterfall plot:

Zoomed in (both vertical and horizontal) view

If you scroll outside the current range of the FFT or if you zoom so that the resolution of the FFT is too low you can simply double tap the screen. RF Analyzer will re-tune the HackRF to the frequency currently centered on the screen and also ajust the sample rate so that the FFT covers exactly the frequency range that is currently visible:

The resolution of the FFT is too low when zoomed in too closely. And we scrolled to far right that we can see the end of the FFT on the right site

After double tapping the HackRF is tuned to 931,61 MHz (note the DC offset peak!) and the sample rate is now adjusted to about 2.5 Msps so that we see the full FFT resolution again

You can also use the autoscale button in the action bar to adjust the vertical scale so that it ranges from the minimum to the maximum of the currently visible values of the FFT:

If you want to jump to a certain frequency, use the 'set frequency' button and it will prompt you to enter a new frequency:

The gain settings of the HackRF (both VGA and LNA gain) can be accessed through the 'set gain' button in the overflow menu:

In the settings activity you can:

  • Select other source types (currently only HackRF or file source)
  • Set the FFT size
  • Set the screen orientation (auto / landscape / portrait)
  • Turn autostart on and off (so that you don't have to hit the start button every time)
  • Set the frame rate to auto or a fixed value (useful if you want a linear time axis in the waterfall plot)
  • Deactivate vertical zoom and scrolling (so that you don't accidentally alter the vertical scale while scrolling through frequencies)
  • Turn on logging and set the location of the log file.
  • Show the log file

Settings Activity of RF Analyzer on a Nexus 7

Implementing the file source was helpful for debugging the application. It is also a way to test the app if you don't have an OTG cable or your phone/tablet doesn't output enough power for the HackRF. Selecting the file source type will allow you to use RF Analyzer with recorded samples from hackrf_transfer or Test_HackRF. I've uploaded a short capture of some FLEX pager signals for testing: FLEX Pager at 931MHz (2Msps)

How it works

For those who want to play with the sources of RF Analyzer (GPLv2) I want to quickly explain the internal structure of the app:

(Uncomplete) class diagram of RF Analyzer. Underlined classes are running in seperate threads. Gray elements are external modules.

To support different devices I defined a common interface that is implemented by all classes which represent sources of IQ samples. The Scheduler will continuously read samples from the source to prevent the receive buffers of the device to fill up. It forwards samples in packets of the size of the FFT to the AnalyzerProcessingLoop by inserting them in a queue. If the queue is full, the samples are thrown away in order to not block the input device. The AnalyzerProcessingLoop also runs in a separate thread and reads the sample packets from the queue, processes them with the help of the FFT class and then calls draw() on the AnalyzerSurface. This method draws the given FFT samples on a SurfaceView and also draws a new line of the waterfall plot as well as the horizontal and vertical axis.

For a more detailed impression of how the app works, have a look into the sources on GitHub. I tried my best to add helpful comments to understand the flow of the program.

If you have any questions, comments or any other input, don't hesitate to leave a comment or contact me directly on Twitter: @dennismantz

Have fun testing it! ;)

Here is the video were I demonstrate the old version of RF Analyzer:

原文地址:http://tech.mantz-it.com/2014/10/rf-analyzer-explore-frequency-spectrum.html

时间: 2024-11-03 19:55:48

RF Analyzer for Android 安卓平台连接HackRF的App的相关文章

ANDROID安卓平台的切图小贴士

  用户手中看到的产品界面,并非设计师呕心沥血创作的效果图,而是一个个单独的切图经由开发同学技术实现.切图作为设计师与开发者之间的桥梁,它的作用很关键,合适的切图.精准的位置可以最大限度的还原效果图的设计,精妙的切图更会有事半功倍的效果哦! 我们经常会做一个俗称"点九"的切图,什么是"点九"呢?"点九"是Android平台处理图片的一种特殊的形式,由于文件的扩展名为:".9.png",所以被称为"点九".&

安卓平台日抛型APP泛滥

使用者的喜新厌旧是App开发行业里必须面对的一个状况,就连<你画我猜>这样曾经一时风头无俩的应用,也不到一个月就被许多人遗忘,新的应用层出不穷,人们没有时间去感觉不舍. App生命周期太短,让众多开发者体验到这个市场的严酷.面对"如何延长App生命周期"的课题,一些不思进取的开发者,干脆放弃了通过创新应对挑战,而是采取"打一枪换一个地方"的方式,制造出一些生命力极弱的"日抛型App",只为以量取胜,捞一笔广告收入就走. 重量不重质 &

javascript判断当前是安卓平台还是ios平台

javascript判断当前是安卓平台还是ios平台 if (/android/i.test(navigator.userAgent)){ // todo : android } if (/ipadiphonemac/i.test(navigator.userAgent)){ // todo : ios } 以上是小编为您精心准备的的内容,在的博客.问答.公众号.人物.课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索javascript , 安卓 , 平台 , navigator ,

安卓pad 连接远程数据库

问题描述 安卓pad 连接远程数据库 是修改 连接字符串吗 加上ip? 怎么连接net服务器 用net做接口 解决方案 一般来说是连接服务器上的web service,web service再连接数据库,没有直接连服务器的数据库的. 解决方案二: ii8 express在哪里打开 win7系统. 解决方案三: android studio 那边用java 代码接收webservice吗 解决方案四: android studio 加 java 代码 能不能 连接无线数据库

android-小波变换实现语音去噪在安卓平台上怎么实现?求大神指点~~

问题描述 小波变换实现语音去噪在安卓平台上怎么实现?求大神指点~~ 本人要在Android平台上实现小波变换的语音去噪方法,请问怎么实现?求大神指点~~ 解决方案 可以利用speex进行降噪处理

谷歌安卓平台副总裁宣布推送安卓5.1系统

目前仍然有许多安卓智能手机,尚未升级到安卓5.0,不过谷歌官方日前已经先行一步,对于自家Nexus系列硬件设备,推送安卓5.1系统.该版本提供了多个重要功能升级,比如手机防盗.支持多SIM卡等等. 腾讯科技在谷歌公司的安卓官方博客上看到,谷歌负责安卓平台的副总裁布尔科(DaveBurke)于本周一宣布了推送安卓5.1系统的消息. 第一批获得新系统更新的设备,包括摩托罗拉移动公司制造的Nexus 6智能手机,以及HTC制造的平板电脑Nexus 9.预计安卓厂商将陆续获得安卓5.1系统的源代码,并且

App广告平台现状:安卓平台杂乱 从业者难赚钱

中介交易 SEO诊断 淘宝客 云主机 技术大厅 ●很多插件都很弱小,需要移动应用广告平台这位红娘将合适的广告商和应用开发者"速配成功". ●目前移动应用广告生态链上的从业者没有真正赚到钱,大家赚到的和花出去的,只是VC投的钱而已. ●移动应用广告平台如果缺乏核心平台,两头都压不住,角色将会逐步被替代掉. 任何留心移动互联网发展的人都能感受到近一年来开发者的疯狂,每一场开发者沙龙都被闻讯而来的开发者挤得水泄不通,他们试图在安卓.IOS等平台分得一杯羹,但面对很杂很乱的安卓平台产业链,开发

百度移动应用内搜索在安卓平台上线

中介交易 http://www.aliyun.com/zixun/aggregation/6858.html">SEO诊断 淘宝客 云主机 技术大厅 新浪科技讯 3月12日上午消息,百度今日宣布安卓平台手机用户通过搜索对本地App进行调用(应用内搜索)的最新进展:继在百度App上实现后,现在用户通过任意手机浏览器使用百度搜索,就有可能直接调用手机本地应用(Native App). 事实上,针对应用内搜索的开发早在2012年秋季就已展开,彼时通过自有产品百度App用户就可以调用本地已安装得百

Go 语言将登陆安卓平台

根据谷歌Go语言开发团队成员David Crawshaw的透露,Go语言即将登陆安卓平台.对 那些讨厌安卓平台上只有Java的人来说,虽然等来的不是Dart语言或Groovy语言,这仍然是一个让人欢欣鼓舞的消息.并不是将Go语言实现成完全 的可替换Java.计划中Go语言在安卓平台上的封装并没有全面涉及Android SDK,而是基于NDK.对于Go语言来说--Crawshaw评论道--SDK实在是太庞大了:让Go语言在安卓平台上和Java等效--这是无法完成 的任务. 安卓平台用Java写出,