{"id":1009,"date":"2018-03-25T11:12:53","date_gmt":"2018-03-25T11:12:53","guid":{"rendered":"http:\/\/naich.net\/wordpress\/?p=1009"},"modified":"2018-03-26T12:09:15","modified_gmt":"2018-03-26T12:09:15","slug":"taming-the-pifm-transmitter-part-2","status":"publish","type":"post","link":"https:\/\/naich.net\/wordpress\/index.php\/taming-the-pifm-transmitter-part-2\/","title":{"rendered":"Taming the PiFM Transmitter (Part 2)"},"content":{"rendered":"<p>In <a href=\"http:\/\/naich.net\/wordpress\/?p=991\">part one of this guide<\/a> it became clear that a Raspberry Pi with a 700 mm long wire on pin 7, running a variant of the PiFM software is an easy way to make a nuisance of yourself. We might not be broadcasting kilowatts of power and realistically, you are not going to be knocking planes out of the sky, but the Pi is a dirty old man when it comes to broadcasting and we need to clean up its act.<\/p>\n<p>The obvious way to do that is to put a filter between the Pi&#8217;s output and the aerial. If the design considerations and analysis of the filter&#8217;s performance don&#8217;t interest you, skip to the end for circuit diagrams, construction instruction and purchase info (possibly).<\/p>\n<p><em>As always, these posts are for educational use only. Do not use your Pi as a transmitter unless it is legal for you to do so, which is highly unlikely. <strong>Using a filter will not make it any less illegal for you to use your Pi as a transmitter.<\/strong>\u00c2\u00a0 Always brush your teeth before bedtime and be nice to people.<\/em><\/p>\n<p>To recap, this is typically the sort of thing that comes out of your Pi when you use it as an FM transmitter:<\/p>\n<p><a href=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Nofilter.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-993\" src=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Nofilter-1024x671.png\" alt=\"\" width=\"640\" height=\"419\" srcset=\"https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Nofilter-1024x671.png 1024w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Nofilter-300x196.png 300w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Nofilter-768x503.png 768w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Nofilter-800x524.png 800w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Nofilter.png 1281w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>There&#8217;s a lovely spike around the 144 MHz mark, which is the amateur radio 2m band. There are probably not many radio hams near me that like the sort of music I listen to. Come to think of it, some times I&#8217;m not sure I do either. In general, it&#8217;s a broad splattering of crap all over the spectrum. And the Pi&#8217;s transmitted output is just as bad, ho ho ho. Ahem. This is the sort of thing we need:<\/p>\n<p><a href=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/simplefilter-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1015 \" src=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/simplefilter-1.png\" alt=\"\" width=\"645\" height=\"330\" srcset=\"https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/simplefilter-1.png 823w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/simplefilter-1-300x153.png 300w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/simplefilter-1-768x393.png 768w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/simplefilter-1-800x409.png 800w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/a><\/p>\n<p>You might notice R1 there. The GPIO pins are not designed to drive inductive or capacitive loads, so we need to make the filter input a bit more friendly. The easiest way is to put a resistor between the Pi and the filter&#8217;s inductor. I&#8217;ve tried it and it works, but it does reduce the range of the transmission. If you want to try it without R1, don&#8217;t blame me if you fry your Pi. There&#8217;s about 5 dB loss with this design, which might be fine for you. For me, it reduced the range just enough that the signal was fading out if I stood in the wrong part of the kitchen. The solution was either to avoid using the fridge or to amplify the output a bit.<\/p>\n<p>I&#8217;m not an expert with RF circuits (although I probably know more than you), so I used the interwebs to find a design that would<\/p>\n<ul>\n<li>Be cheap<\/li>\n<li>Work on a 5V supply<\/li>\n<li>Not require any fine tuning<\/li>\n<li>Be cheap<\/li>\n<li>Be easy to make<\/li>\n<li>Not have any expensive components<\/li>\n<\/ul>\n<p>You can probably tell what my priorities were. This was the prototype:<\/p>\n<p><a href=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180304_200216.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1020\" src=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180304_200216-1024x868.jpg\" alt=\"\" width=\"640\" height=\"543\" srcset=\"https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180304_200216-1024x868.jpg 1024w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180304_200216-300x254.jpg 300w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180304_200216-768x651.jpg 768w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180304_200216-800x678.jpg 800w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180304_200216.jpg 1200w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Those with a keen eye have probably already spotted that it looks shit. Bear in mind that it&#8217;s already been bodged around a bit, and it looked worse than that by the time I&#8217;d finished experimenting with the poor thing. It is a single stage class C amplifier with a low pass filter on the output. The 2N4427 transistor is old and cheap; I bought 5 from China for about \u00c2\u00a33. Everything else (apart from the variable capacitors) is bog standard and the coils are easy to wind. The variable capacitors are stupidly expensive &#8211; there is about \u00c2\u00a320 worth of them in that photo, so they had to be replaced with fixed ones that cost pennies.<\/p>\n<p>The end result was this circuit:<\/p>\n<figure id=\"attachment_1018\" aria-describedby=\"caption-attachment-1018\" style=\"width: 640px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Job1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1018 size-large\" src=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Job1-1024x672.png\" alt=\"\" width=\"640\" height=\"420\" srcset=\"https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Job1-1024x672.png 1024w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Job1-300x197.png 300w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Job1-768x504.png 768w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Job1-800x525.png 800w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Job1.png 1473w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><figcaption id=\"caption-attachment-1018\" class=\"wp-caption-text\">Pi Hat Filter &#8211; click to enlarge.<\/figcaption><\/figure>\n<p>It&#8217;s cheap, simple and it works quite well. This is the finished hat installed and working:<\/p>\n<p><a href=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180315_201416.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1028\" src=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180315_201416-1024x707.jpg\" alt=\"\" width=\"640\" height=\"442\" srcset=\"https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180315_201416-1024x707.jpg 1024w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180315_201416-300x207.jpg 300w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180315_201416-768x531.jpg 768w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180315_201416-800x553.jpg 800w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/20180315_201416.jpg 1200w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>This is the output with the filter hat on:<\/p>\n<p><a href=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Filter.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-996\" src=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Filter-1024x671.png\" alt=\"\" width=\"640\" height=\"419\" srcset=\"https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Filter-1024x671.png 1024w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Filter-300x197.png 300w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Filter-768x503.png 768w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Filter-800x524.png 800w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/107MHz-Filter.png 1277w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Out of band signals are attenuated by at least 20 dB, which means they are 1\/100th the power of when it was hatless. There is even a little bit of gain at our broadcast frequency, which also amplifies the in-band harmonics, unfortunately. It&#8217;s not exactly BBC quality but it should stop you annoying the neighbours. If you want to get the absolute maximum performance out of the filter, use 5-95pF variable capacitors instead of C7, C8, C13 and C16 and keep tweaking them until it becomes apparent that you aren&#8217;t really having any effect.<\/p>\n<p><a href=\"http:\/\/naich.net\/5V Filter v2.zip\">The design files are here.<\/a>\u00c2\u00a0 If you would be interested in a kit of parts or a ready made hat, leave a note in the comments and I&#8217;ll look into it.<\/p>\n<p>I&#8217;ll leave you with a comparison of the filtered (orange) Vs. unfiltered (blue) Pi:<\/p>\n<p><a href=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Screenshot-from-2018-03-24-17-08-53.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1030\" src=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Screenshot-from-2018-03-24-17-08-53-1024x734.png\" alt=\"\" width=\"640\" height=\"459\" srcset=\"https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Screenshot-from-2018-03-24-17-08-53-1024x734.png 1024w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Screenshot-from-2018-03-24-17-08-53-300x215.png 300w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Screenshot-from-2018-03-24-17-08-53-768x550.png 768w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Screenshot-from-2018-03-24-17-08-53-800x573.png 800w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2018\/03\/Screenshot-from-2018-03-24-17-08-53.png 1051w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Good, eh?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In part one of this guide it became clear that a Raspberry Pi with a 700 mm long wire on pin 7, running a variant of the PiFM software is an easy way to make a nuisance of yourself. We might not be broadcasting kilowatts of power and realistically, you are not going to be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74,102],"tags":[],"class_list":["post-1009","post","type-post","status-publish","format-standard","hentry","category-geek","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/1009","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=1009"}],"version-history":[{"count":18,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/1009\/revisions"}],"predecessor-version":[{"id":1037,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/1009\/revisions\/1037"}],"wp:attachment":[{"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=1009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=1009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=1009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}