{"id":11,"date":"2024-05-26T04:03:11","date_gmt":"2024-05-26T04:03:11","guid":{"rendered":"https:\/\/lvanosky.dev\/blog\/?p=11"},"modified":"2024-10-23T08:24:55","modified_gmt":"2024-10-23T02:24:55","slug":"fm-radio-transmitter-with-a-raspberry-pi-0","status":"publish","type":"post","link":"https:\/\/lvanosky.dev\/blog\/2024\/05\/26\/fm-radio-transmitter-with-a-raspberry-pi-0\/","title":{"rendered":"FM Radio Transmitter with a Raspberry Pi 0"},"content":{"rendered":"\n<p>With a jumper wire, USB cable, wall adapter, and a $16 Raspberry Pi 0WH, you can build an FM radio transmitter. The signal can be easily picked up for about 50 feet in all directions (assuming no other interference or walls.) This project uses a <a href=\"https:\/\/github.com\/markondej\/fm_transmitter\">GitHub repo<\/a> by user markondej. With this, setting up a FM radio station is extremely easy.<\/p>\n\n\n\n<p>While any Raspberry Pi model (except for Pico) with headers will work, the older Pi 3 series or Pi Zero (not Zero 2) series are preferred. Later series will require additional configuration and will not work as well due to increased interference from having more components. If you are using a Pi 4, 5, or Zero 2, see the below section.<\/p>\n\n\n\n<p>Before you start, you will need a USB cable (Type B-Micro.) These are very common on power banks, small devices, and some old phones. If you don&#8217;t have one or would like one specifically designed for the Pi 0, you can buy one for $8. You will also need a few jumper wires, (female-to-female or female-to-male) and a Raspberry Pi. I used the Pi 0, but any version will work as long as there are headers.<\/p>\n\n\n\n<p>Start by flashing Raspberry Pi OS using the Raspberry Pi OS Flasher. Select your board model and select the &#8220;Lite&#8221; version. For example, the Pi 0 uses Raspberry Pi OS 32-bit Lite, however, you may use the 64-bit version depending on what board you use.<\/p>\n\n\n\n<p><em>These instructions used the above-mentioned <a href=\"https:\/\/github.com\/markondej\/fm_transmitter\">GitHub repositor<\/a>y. Please see <a href=\"https:\/\/github.com\/markondej\/fm_transmitter\">the repository<\/a> form more information.<\/em><\/p>\n\n\n\n<p>Before I start the guide, I just wanted to say thank you all for the kind comments. Please let me know if you have any questions or anything you want a guide to by leaving a comment or emailing me at <a href=\"mailto:me@lvanosky.dev\">me@lvanosky.dev<\/a>. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installation &amp; Usage<\/h2>\n\n\n\n<p>First, run these commands to install the necessary tools to compile the FM Transmitter. If you used Pi OS, these should be preinstalled, but it is best to run these commands to make sure the software is up-to-date.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get update\nsudo apt-get install make build-essential\nsudo apt-get install libraspberrypi-dev\n<path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z\" style=\"user-select: auto;\"><\/path><path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z\" style=\"user-select: auto;\"><\/path><\/code><\/pre>\n\n\n\n<p>When those commands have finished, run these commands to download the GitHub repository to your computer and to create the FM transmitter executable.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/markondej\/fm_transmitter\ncd fm_transmitter\nmake\n<path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z\" style=\"user-select: auto;\"><\/path><path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z\" style=\"user-select: auto;\"><\/path><\/code><\/pre>\n\n\n\n<p>If there are no issues (if there are try searching the exact error code and diagnosing from there), then you can move on to the next step.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Test Broadcast<\/h2>\n\n\n\n<p>If you are using a Raspberry Pi 1, 2, 3, or 0 (Not Zero 2), use the below command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo .\/fm_transmitter -f 100.6 acoustic_guitar_duet.wav\n<path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z\" style=\"user-select: auto;\"><\/path><path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z\" style=\"user-select: auto;\"><\/path><\/code><\/pre>\n\n\n\n<p>If you are using a Raspberry Pi Zero 2, 4, or 5, read the additional instructions.<\/p>\n\n\n\n<p>Notice:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>-f frequency &#8211; Specifies the frequency in MHz, 100.0 by default if not passed<\/li>\n\n\n\n<li>acoustic_guitar_duet.wav &#8211; Sample WAV file, you can use your own<\/li>\n<\/ul>\n\n\n\n<p>Other options:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>-d dma_channel &#8211; Specifies the DMA channel to be used (0 by default), type 255 to disable DMA transfer, CPU will be used instead<\/li>\n\n\n\n<li>-b bandwidth &#8211; Specifies the bandwidth in kHz, 100 by default<\/li>\n\n\n\n<li>-r &#8211; Loops the playback<\/li>\n<\/ul>\n\n\n\n<p>After transmission has begun, simply tune an FM receiver to chosen frequency, you should hear the playback.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Pi Zero 2, Pi 4, and Pi 5 users only:<\/strong><\/h2>\n\n\n\n<p>On Raspberry Pi 4 other built-in hardware probably interferes somehow with this software making transmitting not possible on all standard FM broadcasting frequencies. In this case it is recommended to compile executable with option to use GPIO21 instead of GPIO4 (PIN 40 on GPIO header):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make GPIO21=1\n<path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z\" style=\"user-select: auto;\"><\/path><path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z\" style=\"user-select: auto;\"><\/path><\/code><\/pre>\n\n\n\n<p>Changing either ARM core frequency scaling governor settings to &#8220;powersave&#8221; or changing ARM minimum and maximum core frequencies to one constant value (see:&nbsp;https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?t=152692&nbsp;).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"powersave\"| sudo tee \/sys\/devices\/system\/cpu\/cpu0\/cpufreq\/scaling_governor\n<path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z\" style=\"user-select: auto;\"><\/path><path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z\" style=\"user-select: auto;\"><\/path><\/code><\/pre>\n\n\n\n<p>Using lower FM broadcasting frequencies (below 93 MHz) when transmitting.<\/p>\n\n\n\n<p>Assuming you followed all device-specific instructions, the below example command should work:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo .\/fm_transmitter -f 89.5 acoustic_guitar_duet.wav<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Extra Info<\/h2>\n\n\n\n<p>Using an FM radio, scan the channel you plan to use for interference. If there is just static or a faint channel, you should be able to use that channel. Simply change the frequency option when running the code. Replace <em>frequency<\/em> with the desired channel.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo .\/fm_transmitter -f <em><strong>frequency<\/strong><\/em> acoustic_guitar_duet.wav<\/code><\/pre>\n\n\n\n<p>Also note that some radios do not work below 88.0MHz, while others go down to 87.5MHz. I personally recommend staying between 88.5 and 107MHz to maximize compatibility, but your mileage may vary.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Legality<\/h2>\n\n\n\n<p><em>This was not written by a lawyer and is not legal advice. Consult a lawyer or other expert before attempting this project. I do not condone illegal activity or this project. Use your own due diligence before attempting this project. Additional regulations may apply depending on your location.<\/em><\/p>\n\n\n\n<p>In the US, extremely low power broadcasting is permitted for some hobbyist devices, however, they <strong>must accept interference<\/strong>.<\/p>\n\n\n\n<p><strong>Do not attach an amplifier or proper antenna to the Raspberry Pi because that will exceed the maximum unlicensed limit of 200 feet.<\/strong><\/p>\n\n\n\n<p>According to the official website of the FCC:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Unlicensed operation on the AM and FM radio broadcast bands is permitted for some extremely low powered devices covered under Part 15 of the FCC&#8217;s rules.\u00a0 On FM frequencies, these devices are limited to an effective service range of approximately 200 feet (61 meters).\u00a0 See 47 CFR (Code of Federal Regulations) Section 15.239, and the\u00a0July 24, 1991\u00a0Public Notice\u00a0(still in effect).\u00a0 On the AM broadcast band, these devices are limited to an effective service range of approximately 200 feet (61 meters).\u00a0 See 47 CFR Sections 15.207, 15.209, 15.219, and 15.221.\u00a0 These devices must accept any interference caused by any other operation, which may further limit the effective service range.<div><span style=\"color: rgb(33, 37, 41); font-size: 14px; font-style: normal; white-space-collapse: collapse;\"><\/span><\/div><\/p>\n<\/blockquote>\n\n\n\n<p>The FCC also outlines regulations for &#8220;Home-Built Transmitters that are Not for Sale&#8221;<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Hobbyists, inventors and other parties that design and build Part 15 transmitters with<br>no intention of ever marketing them may construct and operate up to five such<br>transmitters for their own personal use without having to obtain FCC equipment<br>authorization. If possible, these transmitters should be tested for compliance with the<br>Commission&#8217;s rules. If such testing is not practicable, their designers and builders are<br>required to employ good engineering practices in order to ensure compliance with the<br>Part 15 standards.<br>Home-built transmitters, like all Part 15 transmitters, are not allowed to cause<br>interference to licensed radio communications and must accept any interference that<br>they receive. If a home-built Part 15 transmitter does cause interference to licensed<br>radio communications, the Commission will require its operator to cease operation<br>until the interference problem is corrected. Furthermore, if the Commission determines that the operator of such a transmitter has not attempted to ensure compliance with the Part 15 technical standards by employing good engineering practices then that operator may be fined up to $10,000 for each violation and $75,000 for a repeat or continuing<br>violation.<br>Operating a prototype of a product that is ultimately intended for market is not<br>considered &#8220;personal use.&#8221; Thus, a party that designs and builds a transmitter with<br>plans to mass produce and market a future version of it must obtain an experimental<br>license from the FCC in order to operate the transmitter for any purpose other than<br>testing for compliance with the Part 15 technical standards. Information on<br>experimental licenses may be obtained from the contact point listed in the Additional<br>Information section of this bulletin. FCC authorization is not required in order to test<br>a transmitter for compliance with the Part 15 technical standards<\/p>\n<\/blockquote>\n\n\n\n<p>You can read the official FCC standards here:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/transition.fcc.gov\/oet\/info\/documents\/bulletins\/oet63\/oet63rev.pdf\">Document (fcc.gov)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.fcc.gov\/media\/radio\/low-power-radio-general-information#PENALTIES\">Low Power Radio &#8211; General Information | Federal Communications Commission (fcc.gov)<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>With a jumper wire, USB cable, wall adapter, and a $16 Raspberry Pi 0WH, you can build an FM radio transmitter. The signal can be easily picked up for about 50 feet in all directions (assuming no other interference or walls.) This project uses a GitHub repo by user markondej. With this, setting up a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6,2,3],"tags":[11,9,12,10,7],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-3d-printing","category-linux","category-maker-diy","category-raspberry-pi","tag-fm","tag-maker","tag-pi","tag-radio","tag-raspberrypi"],"_links":{"self":[{"href":"https:\/\/lvanosky.dev\/blog\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lvanosky.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lvanosky.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lvanosky.dev\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lvanosky.dev\/blog\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":12,"href":"https:\/\/lvanosky.dev\/blog\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"predecessor-version":[{"id":70,"href":"https:\/\/lvanosky.dev\/blog\/wp-json\/wp\/v2\/posts\/11\/revisions\/70"}],"wp:attachment":[{"href":"https:\/\/lvanosky.dev\/blog\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lvanosky.dev\/blog\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lvanosky.dev\/blog\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}