This repository contains the code for the reference funtenna implementation.
It transmits Hamming-coded data from a BeagleBone's GPIO pin, bit-banged at about 12.5 MHz. This data is received on a USRP2, then demodulated in GNU Radio.
- BeagleBone (Rev2) running Ångström Linux
- Antenna: we used a long wire wrapped in an oval around a small wooden cross.
- Ettus research USRP2 (this is discontinued, but any GNU Radio-compatible SDR board that can receive at 12.5 MHz will do)
- Computer with GNU Radio >=3.7
-
Hook up a wire/antenna to pin 8.46 on the Beaglebone (consult the reference manual).
-
Copy
beaglebone/gpio
to BeagleBone; compile the kernel module. This is a good resource for installing the dependencies necessary for compiling a kernel module and compiling. Once that's done, load the kernel module and begin transmitting.make insmod gpio.ko mknod /dev/gpio c 60 0
Now, the repeat
executable will broadcast a 10101010
bit pattern over and
over. This helps the AGC in the GNU Radio circuit adjust to the appropriate
level.
-
Power on and connect USRP.
-
Compile and install GNU Radio blocks found in
gr-cw_binary
andgr-hamming
directories (if this fails at any step, it's probably due to missing dependencies):cd gr-cw_binary mkdir build cd build
cmake -D CMAKE_INSTALL_PREFIX=/usr ../ make make test sudo make install # if all looks good sudo ldconfig
-
Start GNURadio companion. Open flow found in
demod/online-demod.grc
. Run the flow. Wait for the levels in the scope to settle. -
Tail
/tmp/bitpattern
. -
On the BeagleBone, ^C the
repeat
executable and run./send_message 'test message here'
. If all is well, the message should appear in/tmp/bitpattern
.
The BeagleBone code is a kernel module that writes either alternating 10
s or
00
s to memory-mapped IO for the BeagleBone's GPIO pin 8.46. The number of
repetitions can be set. The kernel module reads from a char
array, toggling
the pin for a nonzero value or holding the pin low for a zero. This broadcasts
the given bit-pattern using
on-off keying.
There are two userspace programs to broadcast data. One sends out a 10101010
bit pattern on repeat until interrupted; this allows the receiving end to adjust
their levels. The other program encodes data it is given via the command line
into packets:
- A fixed 6-byte prefix:
0xaaaaaaaacccc
- One unsigned byte to indicate the length of the message
- Length * 2 bytes that include the data sent, Hamming[7,4]-coded for error correction
The BeagleBone broadcasts at 12.5 MHz.
We used an Ettus Research USRP2 (discontinued) with a homemade antenna. We were able to observe a clear signal from at least 30 feet away before signal processing.
We used GNU Radio for signal processing and demodulation; the flow graph includes the following:
- USRP Source centered at 12.49 MHz
- Band Pass Filter to isolate the BeagleBone signal
- Automatic Gain Control to adjust to the level of the received signal
- Moving Average to smooth the signal
- Threshold to convert the signal into binary responses
- Sampling logic (our blocks) to turn the binary samples into a stream of bits
- Packet logic (our blocks) to recognize packets
- Hamming decoder (our blocks) perform error correction and detection
- Digital logic to combine nibbles into bytes and write them to a file