<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Amit Ferman on Medium]]></title>
        <description><![CDATA[Stories by Amit Ferman on Medium]]></description>
        <link>https://medium.com/@amitferman?source=rss-633fc33feac8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MONtMpHQt0ywZDrnpxoZxw.jpeg</url>
            <title>Stories by Amit Ferman on Medium</title>
            <link>https://medium.com/@amitferman?source=rss-633fc33feac8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 25 Jun 2026 11:47:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amitferman/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Frequency-Shift Keying Backscatter and Bluetooth Low-Energy]]></title>
            <link>https://medium.com/@amitferman/frequency-shift-keying-backscatter-and-bluetooth-low-energy-ee484c43c7e7?source=rss-633fc33feac8------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee484c43c7e7</guid>
            <category><![CDATA[signal-processing]]></category>
            <category><![CDATA[software-defined-radio]]></category>
            <category><![CDATA[bluetooth]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[backscatter]]></category>
            <dc:creator><![CDATA[Amit Ferman]]></dc:creator>
            <pubDate>Thu, 15 Jun 2023 21:59:30 GMT</pubDate>
            <atom:updated>2023-06-15T22:25:17.641Z</atom:updated>
            <content:encoded><![CDATA[<p>Backscatter FSK and BLE on Arduino. Minimal hardware. Ultra-low-power.</p><p><a href="https://github.com/amitferman/FSK-Backscatter">github.com/amitferman/FSK-Backscatter</a></p><h3><strong>Who should read this?</strong></h3><p>Anyone interested in radio frequency (RF) backscatter!</p><p>RF backscatter is a fast-growing field of research that enables ultra-low-power connectivity for billions of Internet of Things (IoT) devices. I thought it was really interesting, so worked onimplementing RF backscatter with a minimal hardware setup at home.</p><p>I published my work here on Medium because there are few online resources to implement backscatter. Hopefully, you will find this article helpful!</p><p>I always appreciate feedback through comments.</p><h3><strong>1. Introduction</strong></h3><p>Bluetooth Low Energy (BLE) is a power-efficient Bluetooth configuration that enables connectivity for billions of IoT devices. One mode of operation is advertising: BLE has 40 channels in the 2.4GHz band, each separated by 2MHz. In advertising mode, peripherals transmit BLE packets in one of three advertising channels. For each channel, frequency deviations must exceed ±185kHz from its center frequency to encode a logical 0 or 1 [‎1].</p><p>The BLE physical layer is relatively simple. BLE modulates bits at 1 Mbps with Gaussian Frequency-Shift Keying (FSK). Whereas FSK instantaneously shifts a signal between two discrete frequencies to encode bits, Gaussian FSK applies a Gaussian filter to FSK data pulses, causing smooth transitions between frequencies. Therefore, Gaussian FSK is continuous phase and requires more fine-grain frequency modulation.</p><p>In research by Joshua Ensworth, the University of Washington was the first to backscatter BLE in 2016. Ensworth developed a standalone BLE backscatter tag with a TI MSP430F2132 16MHz microcontroller, an analog oscillator, and an ADG918 RF switch. The analog oscillator enabled fine-grain, continuous-phase frequency modulation of the RF switch for Gaussian FSK [‎2].</p><p>This work pushes the limits of backscatter without an external oscillator. We similarly employ a 16MHz microcontroller, but ours is directly wired to the RF switch (as opposed to a frequency-select line on an external oscillator). This imposes numerous challenges on modulating the switch: First, it constrains us to pulse-width modulation (PWM), which introduces undesired frequency artifacts in the backscattered signal. Second, it limits the maximum frequency at which we can modulate the switch. Third, it limits the frequency resolution (i.e., the minimum step size between frequencies) we can achieve. Given these limitations, it’s not immediately obvious whether BLE backscatter is feasible. Therefore, we approach the problem iteratively in two stages.</p><p>In Stage One, we design and implement a transmitter, backscatter device, and L1/L2 receiver capable of backscattering a given data payload at various frequencies and baud rates. We implement a packet-based link-layer protocol that is useful for evaluation purposes, including error correction and detection. We measure performance by varying baud rates to determine the maximum data throughput we can achieve and how this compares to the ideal throughput determined by the communication rate.</p><p>In Stage Two, we analyze whether BLE backscatter is feasible with signal modeling to understand the main challenges involved. Next, we attempt a proof-of-concept with an unmodified BLE scanning app on an Apple iPhone.</p><h3>2. Approach</h3><p>Below, we describe the Stage One setup because the Stage Two setup is a subset of the Stage One setup. (See 4.1 Setup for more details.)</p><h4>2.1 High-level Design</h4><p>We designed a transmitter (TX), backscatter device (BX), and receiver (RX), as shown in Figure 1. TX radiates a single-tone sinusoid (the “carrier”) at <em>f_c</em>. BX backscatters the carrier by modulating an RF switch according to an input signal (the “subcarrier”) at one of two frequencies, <em>f_sc0</em> and <em>f_sc1</em>, to encode a logical 0 or 1, respectively. By modulating the RF switch according to this subcarrier signal, BX implements a mixing operation with the carrier. Since multiplication in the time domain is convolution in the frequency domain, the backscattered signal has two frequency spikes for logical 0 and 1, whose offsets from <em>f_c </em>match <em>f_sc0</em> and <em>f_sc1</em>, respectively. RX demodulates the backscattered signal into logical bits (L1) and decodes them as packets (L2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*zmBBen2U_rw_1e800u5RQw.png" /><figcaption><strong>Figure 1.</strong> Abstract model of the experimental setup, including the transmission unit (TX), backscatter unit (BX), and receiver unit (RX).</figcaption></figure><h4>2.2 Hardware Design</h4><p>For stage one, we selected hardware for the 900MHz frequency band. As seen in Figure 2, the BX hardware includes:</p><ul><li>Atmel ATmega2560 microcontroller (16MHz clock)</li><li>Analog Devices ADRF5132 RF switch</li><li>RFMAX S9028PCRJ patch antenna (902–928 MHz, 8 dBic gain)</li></ul><p>A PWM pin on the microcontroller is wired to VCTL on the switch. The patch antenna is connected to RFC on the switch with various adapters and wiring (not shown), whose total length is around 1m. RF1 and RF2 on the switch are connected to 0 Ohm and 50 Ohm SMA terminators, respectively. A standard battery pack powers the microcontroller.</p><p>The RX hardware includes:</p><ul><li>Nooelec NESDR SMArt v5 RTL-SDR</li><li>Personal computer</li></ul><p>The personal computer demodulates and decodes the I/Q data stream emitted by the RTL-SDR at 3.2Msps using Python.</p><p>The TX includes:</p><ul><li>Great Scott Gadgets HackRF One</li><li>RFMAX S9028PCRJ patch antenna (902–928 MHz, 8 dBic gain)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*n7BM907BF6kCHPNjqqq1YQ.png" /><figcaption><strong>Figure 2.</strong> Backscatter unit (top-left), receiver (top-center), transmitter (top-right), and complete setup (bottom). Each image on the top row corresponds to the component immediately below it in the complete setup.</figcaption></figure><h4>2.3 Software Design</h4><p>Below, we describe the software implementation for Stage One. As described earlier, see 4.1 Setup for more details on how Stage Two software differs from Stage One.</p><h4>2.3.1 Transmitter: Carrier Generation</h4><p>The transmitter uses SoapySDR and Python bindings to interface with the HackRF One. It transmits a single-tone sinusoid forever at the given frequency.</p><h4>2.3.2 Backscatter Device: Subcarrier Generation</h4><p>The backscatter device leverages native 16-bit timer peripherals on the ATmega2560 to provide precise timing for (1) PWM and (2) periodically shifting the PWM frequency. The first timer constantly modulates a pin between 0V and 5V. The second timer triggers an interrupt request every bit period to shift the frequency at which the first timer modulates the pin. Each timer is configured with Fast PWM Mode, and changes to timer frequencies are achieved by writing to timer registers.</p><p>One challenge was ensuring the computation time of the interrupt routine does not exceed its period. For example, at 1Mbps, the bit period is 1µs, whereas the ATmega2560’s clock period is 1/16µs. Therefore, the interrupt routine must never exceed 16 clock cycles. We heavily leveraged precomputation and C++ language features such as macros throughout the implementation to satisfy this requirement.</p><h4>2.3.3 Receiver: Demodulation and Decoding</h4><p>To demodulate the signal, the receiver applies the following operations to the given I/Q data:</p><ol><li>I/Q Sampling: The RTL-SDR is configured with a center frequency of a few 100kHz below the midpoint of <em>f_sc0</em> and <em>f_sc1 </em>to avoid obfuscating the FSK signal with DC noise.</li><li>Down-conversion: The I/Q signal is down-converted to center the midpoint at 0kHz by multiplying it by a complex sinusoid whose frequency is the offset from 0kHz to the midpoint of <em>f_sc0</em> and <em>f_sc1.</em></li><li>Compute instantaneous frequency: We computed the phase of the original signal and differentiated the phase stream at offsets of 0 and π/2 radians to correct phase artifacts.</li><li>Low-pass filter: High-frequency components of the instantaneous frequency were empirically confirmed to be noise, so we filtered them out at an empirically determined offset.</li><li>Match filter: We convolved the frequency with a top hat function. The justification for this is related to the prior step since a match filter is another kind of LPF filter.</li><li>Edge detection: To determine where to sample the resulting signal for logical 0s and 1s, we implemented basic edge detection with a moving average of N samples, which tolerates noise reasonably well. This step outputs the bit stream that is passed to the link layer in the next step.</li><li>Channel decoding: We implemented fuzzy preamble matching to identify packets in the bit stream (i.e., match if Hamming distance does not exceed 1). After the preamble, we then applied error-correction to the packet contents and ignored packets whose CRC-8 check bits did not match the decoded data. See the next section for more details.</li></ol><h4>2.3.4 Link Layer</h4><p>Since error correction and detection are commonly used in industry-standard network protocols and backscatter communication, in particular, is prone to bit errors, we implemented a basic link layer with a best-effort datagram service model. As seen in Figure 3, the packet begins with an 8-bit preamble, followed by data bits and an 8-bit CRC. A Hamming(7, 4) code is applied to both the data bits and CRC. Each packet contains 16 data bits. The CRC provides error detection for up to 5 bits. The Hamming code provides error correction up to 1 bit. The communication rate is 0.32. We independently implemented Hamming(7, 4) codesand used an external library for CRC-8 computation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*JzoiEAfYn5EE0r4ItVIC-g.png" /><figcaption><strong>Figure 3.</strong> Custom link layer packet structure.</figcaption></figure><p>For any data we want to transmit in our system, we first packetize it at the link layer. Next, we manually copy this bit stream into the backscatter device’s software as a byte array, compile it, and upload it to the microcontroller. Decoding is built into the receiver software.</p><h3>3. Stage One: Experiment</h3><h4>3.1 Experimental Setup</h4><p>We selected our control variables to fit our hardware implementation best. For example, the patch antennas were rated 902–928 MHz, so we transmitted in this frequency band. We also used a spectrum analyzer to understand which frequencies had the least ambient power in our testing location. Finally, other variables, such as subcarrier frequencies, were influenced by limitations stated earlier concerning the max frequency the ATmega2560 can modulate and the 16-bit timers’ frequency resolution.</p><p>The control variables are:</p><ul><li><em>f_c</em> = 905MHz</li><li><em>f_sc0</em> = 2.0MHz</li><li><em>f_sc1 </em>= 2.66MHz</li><li>0.5m between BX and TX.</li><li>0.25m between BX and RX.</li><li>0.25m between RX and TX.</li><li>1 second of sampling time per trial.</li><li>3.2 Msps sampling rate at RX.</li></ul><p>The independent variable is:</p><ul><li>Baud rate: the rate of frequency shifts in the backscattered signal.</li></ul><p>The dependent variable is:</p><ul><li>Throughput: the total number of <em>payload</em> bits per second, excluding check bits and preambles.</li></ul><p>We perform 4 trials for each baud rate, and we evaluate the following baud rates:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SAZQobOBuSV53xxO0s88nA.png" /></figure><h4>3.2 Results</h4><p>See Figure 4 for our results plotted against an ideal throughput (communication rate x baud rate), and see 7.1 Data for raw data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*OBR8lj06WcR93U0jqnYD0A.png" /><figcaption><strong>Figure 4.</strong> Baud rate vs throughput and ideal throughput.</figcaption></figure><h4>3.3 Discussion</h4><p>As shown in Figure 4, increasing the baud rate past 40,000 bps has diminishing throughput returns past roughly 5,000 bps. Experimentally, we had trouble getting non-zero throughput measurements past this baud rate.</p><p>We believe the receiver’s sampling rate limitations cause this diminishing return phenomenon. The RTL-SDR has a max sampling rate of 3.2Msps, which we used in our experiment. The key observation is that samples per bit (SPB) decrease with the inverse of the baud rate. Low SPB reduces noise tolerance and increases bit errors to the point where our channel coding cannot decode any packets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*aJtq-QpKgl4I0vR9YD6m4A.png" /><figcaption><strong>Figure 5.</strong> Baud rate vs. throughput, ideal throughput, and samples per bit.</figcaption></figure><p>Consider the same data plotted against the SPB in Figure 5. At a baud rate of 40,000 bps, there are 80 SPB. Already, this number is quite low. Increasing the baud rate to 80,000 bps results in 40 SPB. Experimentally, 40 SPB is insufficient for any throughput.</p><p>Another interesting observation was that some of the decoded packets contained random characters not modulated by the backscatter device. This happened when the noise in the system was so high that bit flips caused false positives when checking if the CRC-8 matched the payload to detect errors.</p><p>The software that computes throughput statistics attempts to correct for this phenomenon, but future testing may have benefited from longer CRC codes (e.g., CRC-16). However, this would come at the expense of the communication rate, which must be balanced to provide the most useful evaluation of the system.</p><h3>4. Stage Two: BLE Proof-of-concept</h3><h4>4.1 Setup</h4><p>The setup for the BLE proof-of-concept was the same as that for Stage One, but with the following differences:</p><ul><li>The TX and BX patch antennas were replaced with Sunhans WiFi antennas (2.4GHz, 6dBi gain).</li><li><em>f_c</em> = 2399.7MHz</li><li><em>f_sc0</em> = 2.0MHz</li><li><em>f_sc1</em> = 2.6MHz</li><li>Baud rate = 1 bps</li><li>RX was replaced with the app BLE Scanner 4.0 by Bluepixel Technologies LLC on an Apple iPhone 13 Pro Max.</li></ul><p>We transmitted the same example BLE packet as in Ensworth to ensure that if our setup does not work, it would be explained by physical-layer demodulation issues as opposed to higher-level decoding challenges.</p><h4>4.2 Signal modeling and theory</h4><p>We performed signal modeling in Python to analyze the system because the available receiver hardware (i.e., the RTL-SDR) could not down-convert the 2.4GHz frequency band. The modeling is designed to precisely model how the 16-bit timers in BX implement PWM and show what the backscattered signal should look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IJCeROjaaKd5XRXWpSo2cw.png" /><figcaption><strong>Figure 6.</strong> Subcarrier in time domain (left), subcarrier in frequency domain (center), and backscattered signal in frequency domain (right).</figcaption></figure><p>As shown in Figure 6, the subcarrier shifts between 2.00MHz and 2.6MHz every 1µs (20 samples). As mentioned earlier, since the subcarrier is a square wave instead of a continuous sinusoid, there are frequency artifacts around the frequency spikes corresponding to logical 0 and 1. This comprises one of the challenges in BLE backscatter. As shown in the frequency domain representation of the backscattered signal, we have two frequency spikes for logical 0 and 1 as expected. However, there are still frequency artifacts propagated from the subcarrier that could make demodulation more difficult.</p><p>Notably, we only model FSK as opposed to Gaussian FSK. As shown by the plots, Gaussian FSK would be infeasible with bit periods as low as 1µs and subcarrier frequencies as low as 2.0MHz and 2.6MHz. In fact, this is likely why Ensworth used subcarrier frequencies as high as 11.7MHz and 12.3MHz: higher subcarrier frequencies enable more cycles per bit period, which enables more fine-grained frequency modulation. Therefore, our proof of concept only attempts to use FSK to backscatter BLE, and we will empirically determine whether an unmodified BLE receiver can receive FSK instead of Gaussian FSK in testing.</p><h4>4.3 Results</h4><p>The BLE scanner app did not detect our backscattered packet. We attempted multiple distances and verified that the backscatter setup was functioning correctly at lower frequencies with a Stage One receiver. Also, as mentioned earlier, we used a sample BLE packet that Ensworth has already tested with an unmodified Apple iPad. Therefore, we are convinced the failure was at the physical/demodulation layer.</p><h4>4.4 Discussion</h4><p>Without investigating the demodulation layer of the BLE Scanner on the iPhone, and because we didn’t have another HackRF One (which is capable of down-converting the 2.4GHz frequency band), it’s difficult to debug this failure. However, our signal modeling and intuition provide several clues as to why it failed:</p><ul><li>Due to hardware limitations, we could only modulate FSK instead of Gaussian FSK.</li><li>Frequency artifacts in the subcarrier propagated to the backscattered signal.</li></ul><p>A combination of these issues likely resulted in the iPhone app failing to decode the backscattered signal.</p><h3>5. Problems</h3><p>The biggest problem we encountered was acquiring the right hardware. This process took 1–2 weeks because parts had to be delivered, and we were learning.</p><p>Another problem was that we didn’t have a HackRF One to debug the BLE proof-of-concept. We likely could have acquired one if we had more time, but we tested this rather late into the project time window since it was part of Stage Two, making it infeasible given time constraints.</p><p>Beyond parts issues, the project went smoothly in areas where we otherwise expected issues. For example, we verified that backscattering a carrier with a single-tone sinusoid and plugging/unplugging the backscatter device caused sudden fluctuations on a spectrum analyzer. This allowed us to spend most of our time debugging demodulation software instead of hardware issues.</p><h3>6. Future Work</h3><p>Future work could retry BLE backscatter with a similar setup but use an external oscillator (or a faster microcontroller) to identify the minimum frequency at which you can modulate the subcarrier and still receive BLE packets. With our hardware, 2.0MHz and 2.66MHz was the maximum frequency pair with a high enough frequency resolution we could experiment with. However, if one had the ability to incrementally raise this with an external oscillator, it might provide more useful results. This is an interesting area of future work because lower subcarrier frequencies enable lower power consumption.</p><p>Another option is to, instead of using our custom L2 packet protocol, adapt an industry-standard L2 protocol to work with a backscatter physical layer and test achievable throughputs. This might provide a more accurate assessment of how well the backscatter setup works in an experimental setup closer to a real-world environment.</p><p>Finally, future work could focus on Stage One and use a receiver with a higher sampling rate. For example, it could use a Hack RF One in RX (in addition to TX) with a max sampling rate of 20Msps. This work could similarly measure throughput for each baud rate and the maximum achievable throughput. Based on our data, a sampling rate of 20Msps may enable baud rates of around 0.25 MHz, so it would be very interesting to see whether this hypothesis is correct!</p><h3>7. Appendix</h3><h4>7.1 Data</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2_1h_z9ZRzRD7fuJtOjlZA.png" /></figure><h4>7.2 Code</h4><p>See <a href="https://github.com/amitferman/FSK-Backscatter">github.com/amitferman/FSK-Backscatter</a> for code and documentation.</p><h3>8. Works Cited</h3><p>1. Woolley, Martin, et al. “Bluetooth Low Energy — It Starts with Advertising.” Bluetooth® Technology Website, 29 Mar. 2022, <a href="http://www.bluetooth.com/blog/bluetooth-low-energy-it-starts-with-advertising/.">www.bluetooth.com/blog/bluetooth-low-energy-it-starts-with-advertising/.</a></p><p>2. Ensworth, Joshua F.. “Ultra-low-power Bluetooth Low Energy (BLE) compatible backscatter communication and energy harvesting for battery-free wearable devices.” (2016).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee484c43c7e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>