ARM Architecture

Utilizing a RTLSDR dongle to validate NRF905 configuration


I'm at present engaged on a system to observe the storage door standing from my flat. Each locations are 7 flooring aside, and I must ship the info wirelessly. I selected to function on the 433MHz service, and I ordered 2 PTR8000 modules:
http://www.electrodragon.com/w/NRF905_Transceiver_433MHz-Wireless_ModuleThe PTR8000 relies on the twin band sub 1GHz NRF905 chipset from NORDICSEMI:
http://www.nordicsemi.com/eng/Merchandise/Sub-1-GHz-RF/nRF905

I first wanted to validate that each modules can talk over the gap separating the two locations. To take action, I arrange a easy a configuration consisting of two impartial TI STELLARIS LAUNCHPAD boards appearing because the receiver and transmitter, and related to their resepctive PTR8000 module over SPI. The next diagram exhibits sign connections:


The transmitter sends packets at most energy acquire each second or so utilizing 4 bytes addresses and a pair of bytes payloads. Additionally, packet auto retransmission and CRC have been disabled. The receiver waits for incoming information. It prints totally different messages on the UART and turns LEDs on off if the service is detected, if information are acquired, and if they're right. The code is versionned on GITHUB: https://github.com/texane/nrf

This submit refers back to the commit: a36d24b3f8fa57ffbddd691cd9b3b63c9fd4a0ad

The directories:
unit/vary/rx_nrf905
unit/vary/tx_nrf905

comprise the code for receiver and transmitter, respectively.

The NRF905 associated code is written from scratch. Thus, errors are more likely to happen throughout the first improvement steps. A typical programming error leads to no information being transmit or acquired. However even when each module talk, it doesn't necessarly imply that their configuration is the anticipated one.

Suppose that each module service frequencies are set to the identical improper worth. This could simply happen if a SPI register offset is invalid, because of some typo as an example. This register would maintain its default, nonetheless legitimate, worth. The identical applies for different paramters: energy acquire, handle and payload width ... Whereas there are apparent benefits when sharing a code base between a number of parts, there will also be issues.

Thus, I needed to confirm that NRF905 chipset configuration was the anticipated one. It occurs that I lately began to be taught extra about software program digital radio (SDR). For this goal, I bought a RTLSDR dongle:
http://www.terratec.internet/fr/produkte/Cinergy_T_Stick_RC_97821.html

It's primarily based on the RTL2832U chipsets. Some folks found that it's doable to entry uncooked I/Q samples, making merchandise primarily based on this chipset low cost SDR receivers. Extra data may be discovered right here:
http://sdr.osmocom.org/trac/wiki/rtl-sdr

The venture gives an API to entry a rtl-sdr suitable {hardware}. It may well configure the machine (middle frequency, sampling price, acquire ...) and skim uncooked IQ samples in 2x 8 bits unsigned integer format. This library is offered within the venture repository:
git://git.osmocom.org/rtl-sdr.git
rtl_fm is a instrument included within the repository that gives demodulation on prime of the rtl-sdr library. It outputs the demodulated sign in time area, samples being in 1x 16 bits low endian signed integer format. FM demodulation is used for my functions.
Then, all I wanted to do was implementing a NRF905 body decoder. By probability, the chipset datasheet paperwork practically all the things associated to packet framing:
http://www.nordicsemi.com/eng/content material/obtain/2452/29528/file/Product_Specification_nRF905_v1.5.pdf

A NRF905 body consists of: . a ten bits preamble, . an handle (as much as 32 bits, 32 bits in our case), . a payload (as much as 256 bits, 16 bits in our case), . a CRC (as much as 16 bits, disabled in our case).

The preamble and CRC are robotically added by the NRF905. Earlier than transmission, the body bit stream is coded utilizing the Manchester scheme. This encoding turns each single bit right into a transition: . a 0 is changed into a transition from 1 to 0, . a 1 is changed into a transition from 0 to 1.

The next diagram represents a full body together with the Manchester encoded model:

NRF905 framing
Manchester coding will increase the variety of degree transitions, which is helpful for serial asynchronous methods. The downside is that it doubles the body dimension. Thus, for an efficient information price of 50Kbps, the precise price is 100Kbps.
The datasheet additionally mentions different particulars associated to the transmission. As an illustration, it states that GFSK is used with a frequency deviation of 100KHz. GFSK is a particular sort of FM modulation, the place the time area sign is utilized a gaussian filter to easy the extent transition. I wont go into the small print, as it might require a whole serie of posts about frequency modulation. In our case, the FM demodulator supplied by rtl_fm and a 16x oversampling are used.

With all these data, I applied a primary decoder to hear and print NRF905 frames. The code is offered in the identical github repository, listing: unit/vary/nrf905_decoder

It has a variety of shortcomings and I'd finally rewrite it for extra critical makes use of. However for testing functions, it really works nicely sufficient. It may well learn time area samples produced by rtl_fm from a file or direclty from the usual enter. In its present model, it expects a 16x oversampling. To run it:
./construct.sh
sudo rtl_fm -f 433000000 -s 1600k -g 0 | ./nrf905_decoder -

After just a few hours of coding and debugging, the primary frames had been efficiently decoded, and I used to be now assured concerning the system setup.

One other great tool is rtlizer, a spectrum analyzer initially developped for the beaglebone black platform: http://www.oz9aec.internet/index.php/beaglebone/480-rtlizer

It compiles and works nicely on a typical LINUX x86 platform. The output seems like this:

rtlizer It isn't very exact, however I used it to confirm the change in transmission energy acquire. Additionally, I might discover the very best place to set the receiving module by way of sign amplitude.
To conclude, the RTLSDR dongle has confirmed to be an affordable however very great tool. Merchandise can simply be discovered on the internet. Additionally, there's a variety of associated software program, which makes the developer give attention to its utility particular points.

You may also like… (promoted content material)

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button