Hacker News new | past | comments | ask | show | jobs | submit login
Turning the Raspberry Pi Into an FM Transmitter (icrobotics.co.uk)
262 points by trueduke on Jan 23, 2013 | hide | past | favorite | 87 comments



Heh, that blows away my AM morse code sender [1] using a PIC. One of the things I did in the PIC and it would probably work here is to mush the data into a sort of pre-encoded form (which is ready to be shipped out to the transmitter) I expect you could do the same here by taking the wave file, precomputing what the stereo deltas on the FM signal would be than then just using that file (maybe a foo.efm for encoded-FM) then just DMA the pre-processed file to the spectrum offset and voila, done.

[1] http://www.mcmanis.com/chuck/robotics/projects/eelb.html (and yes I'm re-doing the web site not in Comic Sans which will eventually all be moved to http://robotics.mcmanis.com but until then ...


I bet the FCC (or RCA in the UK) will love that :)

The amount of noise and harmonics that come off that sort of transmitter will be horrible. At least chuck a bandpass on the end of it.


http://en.wikipedia.org/wiki/Part_15_%28FCC_rules%29

Unlicensed broadcasts on the FM broadcast band (88 to 108 MHz) are limited to a field strength of 250 µV/m at a distance of 3 meters from the antenna. This is equivalent to 0.01 microwatts.[2] Emissions must be kept within the 88.0 to 108.0 MHz band under Part 15 rules.


Emissions must be kept within the 88.0 to 108.0 MHz band

Without a spectrum analyser, you have absolutely no idea how much energy is being emitted on other frequencies. A crude unfiltered transmitter of this sort is probably emitting more spurious energy than on the intended frequency. Ignorance is no defence and it is the obligation of the operator to ensure that their transmission is compliant.

Lots of serious, life-or-death stuff depends on radio. The FM broadcast frequencies are directly adjacent to the VHF Airband, either side of 108MHz. The lowest part of the Airband is allocated to VOR and ILS navigation aids. Transmit a couple of watts on 107MHz and you're just going to interfere with broadcast radio; A couple of watts on 109MHz could take down a light aircraft. If you're going to experiment, you have a moral duty to get yourself an amateur license and ensure you have the skills and equipment to be a good neighbour.


While I agree with everything you say, this:

"A couple of watts on 109MHz could take down a light aircraft."

is without doubt the sort of unnecessary hyperbolic statement that leads directly to the modern security-theatre over reaction. Sure, it might lead to navigation problems which combined with enough other co-incidental bad luck might lead to a crash, but the reductio ad absurdum statement "$30 worth of widely available electronics could crash a Cessna" would surely lead to an entirely justified call from Cessna's legal department if published prominently enough.

Yeah, fucking around with poorly controlled transmitters in the FM broadcast band isn't a great idea. but telling people "you'll crash planes!" is a sure-fire way to have the rest of your message's reliability questioned.

(And, for the record, I'm going to try this out with my RaspberryPi and see if I can get some sort of handle on unexpected emissions using my FunCube software radio to listen above and below the tx frequency...)


While it may be true that jamming a VOR signal is unlikely to cause a crash without other co-incidental bad luck, consider this: The localizer portion of ILS operates on those frequencies, too.

I don't think it's all that far-fetched to imagine that an unfiltered transmitter like the one described could generate signals which 'trick' the localizer receiver and guide a low-flying airplane into an obstruction which is technically outside, yet near, the approach path. (The wikipedia page on ILS describes how it works, so I won't repeat it here.) AMing the right carrier with 150 and 90 Hz tones (which really means generating carrier + and - 150 Hz and carrier + and - 90 Hz) would cause the localizer to show the plane centered on the glide path, even if it isn't.


I agree that if you intentionally try to jam it using something like this you may be able to, however to unintentionally as a side effect of mucking around with FM transmissions seems unlikely.

Also I suspect the actual ILS transmitters are a lot more powerful, so unless you have this on the plane it probably wouldn't do anything.


Agree.

Amateur radio operators have dummy loads and SWR meters to make sure that the signal they are putting out isn't stomping on some other critical portion of the RF band. Experimentation is a good thing, but this is the equivalent of someone being disturbingly careless experimenting with chemicals in their home "lab." The chance you could cause a serious problem with contamination for your neighbors is small but definitely non-zero.


I fail to see how a dummy load and a SWR meter will help to make sure you don't disturb other (portions of) RF band(s). To assess this you must look into the spectral purity of your signal. You do this with a spectrum analyzer (or equivalent). The SA is already 50 Ohms terminated so you at most need attenuators for your transmitter. The SWR meter will tell you if your transmitter is matched to your antenna. If not you might kill the final stage of your transmitter. SWR doesn't tell you something about radiating unwanted frequencies.


You are correct about the SWR only measuring the matching of your output to the antenna. But consider this: a signal with lots of harmonics (read: outside of your band intended RF signals) is going to make a 1:1 SWR match harder to achieve. If you've cut your antenna to the right length and you're not getting close to the match you need, something is wrong. It's a rough measurement to be sure, but decent in a pinch.

That said, you should always use a dummy load when working with a new transmitter project. SA is always a good idea, but I've been in a lot of shacks that didn't have one.

Of course, this guy used a FM radio to check his signal. He should have used a scanner and checked out the multiples of his center freq.


Surely you can put a maximum on whatever you might be accidentally transmitting. Those GPIO pins are 3V, and you are not going to get many amps through that board.

How many "couple of watts" are we talking about? I don't see this being capable of more than single digits.


Does it matter? The UK legal interference limit is 50 NANOwatts (prior to the Wireless Telegraphy (Exemption) (Amendment) Regulations 2006 ALL unlicensed FM transmitters were strictly illegal). This is almost certainly capable of exceeding that, perhaps even with just a bent wire antenna (and almost certainly with a tuned antenna). There are good reasons why those limits exist, and infringement can carry penalties up to a £5000 fine.


Oh, I am certainly not saying it is legal.


Low-power amateur radio (QRP) enthusiasts communicate many miles apart with well under 5 watts.


I guess my hangup here is that it seems like a <10W (with a raspberry pi's GPIO and no amp, we are probably talking <1W in reality, but throw on a factor of 10 for safety) RF circuit with an antenna a few cm long seems really easy to make by accident, let alone on purpose.

It is illegal sure, and these people shouldn't be doing it intentionally, but I have a hard time seeing it causing damage measurable in actual dollars.


That's no justification for doing it on purpose.


I'm not trying to justify what they are doing, just get a handle on how much damage they could be doing by breaking the rules in this way, not how much damage they could be doing by breaking the rules in general.


On much different frequencies.


How do you have a moral obligation to get licensed? Isn't the moral duty not to be an ass an interfere with others? What does being licensed have to do with anything?


In this case being licensed means getting an independent opinion that you know what you're doing. If you don't, you might "be an ass and interfere with others" without even knowing it.


A couple of watts on 109MHz could take down a light aircraft.

Only if the pilot is a fuckwit.


That is not the only relevant FCC rule. There are several swaths of public use spectrum in the USA.

Private Land Mobile Radio Service http://en.wikipedia.org/wiki/Business_band#Low-band_frequenc...


I don't suppose it's any more than a few mW - Ofcom don't seem to be interested in / able to remove the many high-power pirate radio stations, often with awful dirty signals, dotted around the UK (particularly London) so this would be a long way down their list of priorities! Even in rural Yorkshire, I get the "delights" of Phatt 100 and others every weekend.

Agreed though - anything throwing unwanted noise onto the RF spectrum is a Bad Thing, however low-power it is (see powerline networking).


You might be interested in this response to a FOI request on the subject of pirate radio enforcement action. http://www.whatdotheyknow.com/request/141864/response/351401...


TBH they're not really interested I understand as the FM broadcast band is on its way out in the UK.


This isn't true - I'm in the radio industry. High-level discussions have been taking place on the future of DAB digital radio, but there are no plans to switch off FM radio. It's FUD that's been spread over the past few years.

At the very most, we will see a migration of national (and possibly large regional) stations to DAB in the next decade. FM will still remain up and running for local commercial and community radio - and an expansion of this is planned once the spectrum currently used by national broadcasters is released. The current FM and MW spectrum is of little use for new technology like mobile broadband - they are more interested in the current TV spectrum and up into the GHz bands.

All this is currently under discussion, though, and nothing is confirmed. The status quo remains for now!


Sorry to jump in with a random reply.

I've always been interested (just out of interest) to get an understanding of what the whole spectrum looks like, which bits are good (and why), and which bits are currently taken by what and could be used by other things.

Is there any good place I could find such a thing that you know of?


In the UK, Ofcom provide quite a good overview of spectrum allocation here: http://spectruminfo.ofcom.org.uk/

This rather psychedelic PDF is linked from the above page: http://www.roke.co.uk/resources/datasheets/uk-frequency-allo...

It doesn't say which allocations are good or bad - just what each slice of spectrum is used for. People like the mobile operators are only really interested in spectrum above the 800MHz area. This is where the competition for spectrum and billion-pound licence auctions come into play.

Cellular companies are interested in line-of-sight frequencies in the UHF and SHF bands, where range is smaller but robustness of coverage is high. Then, they just blanket their desired area with cellular towers. VHF travels further, at the expense of robustness - it's ideal for broadcasting, but not for two-way data services. If you cleared FM and transplanted the existing 3G service onto, say, 100MHz, you'd find all sorts of interference issues.

87.5-108MHz, for instance, is used for FM broadcasting all over the world (except Japan where it's down in the 70s). The receivers will be available for the foreseeable future - certainly for my lifetime. If the band was vacated and all radio migrated to digital, the pirates would simply use it. It is of such little value - so it may as well be kept, rather than switching to digital for its own sake.


In terms of 'good / bad', it's basically a trade-off between bandwidth and distance the signal can travel. A high carrier frequency allows a higher bandwidth[1], but it doesn't travel far/well. A low frequency can travel far, but doesn't support high bandwidth. So there is a sweet-spot (which is currently considered 'good') that achieves a balance of BW and distance. There's a great guide here:

http://www.bbc.co.uk/rd/pubs/spectrum/bbc-the-spectrum-and-i... (see page 5)

1] the carrier frequency doesn't itself determine the bandwidth, it's the frequency range that does. For example, if someone says "a 100 Mhz signal", that doesn't tell you what the bandwidth is. You need to also know that the signal is actually allowed to cover 99.9 Mhz to 100.1 Mhz, so it's bandwidth is 0.2 Mhz (which could transfer ~0.2Mbps (order of magnitude accurate), depending on the encoding system used[2]). But if someone says "a 100 Mhz signal" you can guess that they don't mean the signal is allowed to cover 70 Mhz to 130 Mhz (60 Mhz of bandwidth), because: a) that's a ~2x range in frequency, which make it hard to design appropriate aerials, filters, modulators, etc; b) that isn't how spectrum is actually allocated anywhere I know of. So in practice you can normally deduce the approximate bandwidth by knowing the carrier frequency. Apologies for the long explanation - I've been nitpicked before on this..

2] see: http://en.wikipedia.org/wiki/Nyquist_rate, http://en.wikipedia.org/wiki/Bit_rate


pirate radio stations have a long history especially in London, they frequently try to take them down, but so do rival radio stations try to take out their competitors radio stations too.

Anyway, the FM band is still in use, see the furore over iTrip or similar devices that were at a time banned in the UK as the law said you needed a license to broadcast on FM.

The FM band is still in use and even when radio goes digital AFAIK the idea is that the FM band would be available for alternative use once radio stations no longer require it.


The current modus operandi of most pirate radio operators is to run as a legitimate internet radio station - remove all reference to the FM broadcast frequency from the website and promotional materials, promote yourself as "the internet's no.1 grime station" or whatever.

Then, when Ofcom come calling, the FM transmission is "someone relaying our internet broadcast, we don't know who it is."


Hams solved all the issues I saw mentioned in the article 100 years ago.

In the USA, it will be easy to break laws with this device. However, since the 1980s there has not been field enforcement by uncle Charlie (the FCC). Licensed users must complain a lot to get a response.\

For example, several times in CA police radio repeaters have been cross patched into HAM radio bands. No prosecution.

Now, all that being said, jamming is the worst sin a radio operator can commit. Please be careful if you start transmitting. Not out of fear, but out of being a good operator.


I have been the worst operator - a 12v car battery with a large file brushed across the terminals :)

That interfered with EVERYTHING.

25 years later, an EE degree and 5 years working RF comms engineering, I realise what an asshat thing to do that was.


I thought you were trolling at first!


Hams, too.


The replies to this comment are missing your point. It's not just the power of the FM signal, it's the amount of extraneous junk outside the FM band that will be a problem. This is a very dirty signal generator.


Filter functions

Four general filter functions are desirable:

    Band-pass filter: select only a desired band of frequencies
    Band-stop filter: eliminate an undesired band of frequencies
    Low-pass filter: allow only frequencies below a cutoff frequency to pass
    High-pass filter: allow only frequencies above a cutoff frequency to pass


http://en.wikipedia.org/wiki/RF_and_microwave_filter#Filter_...


Nah, they sell small FM transmitters you hook up to your MP3 in order to get the audio on your car audio system, this is kinda similar I guess (link is down for me at the moment).


No, those have to comply with FCC regulations to ensure that the signal they are sending out isn't stomping over all the other bands.

This has no filtering at all.


Not the ones you get on eBay from china. I was finally able to drag a handful of them over to someone who had a decent spectrum analyzer and was duly horrified.


There is far less noise on a proper antenna with filters. Hams deal with these issues all the time.


What is the power output of something like this? Would the FCC even care?


They say, "This means that all you need to do to turn the Raspberry-Pi into a (ridiculously powerful) FM Transmitter..." and claim it's transmitting at least 50 meters away, which is far beyond what's allowed by the FCC. Not that they'd care unless someone filed a complaint.


Wrong.

There are multiple rules for different spectrum.

Anyone can transmit for miles on FM in the 'green dot' / 'blue dot' spectrum. The laws were written for business, but anyone can use them.

http://en.wikipedia.org/wiki/Business_band#Overview


But that's not the band on which this is transmitting.


This can be configured in software. Pi can transmit up over 450 Mhz.


And with a paperclip antenna, it's leaking harmonics all over the place, not just at 450MHz or 100MHz, or whatever.


They describe they had to get several concrete walls and a metal cabinet between themselves and the Raspi before reception stopped, so I'd say too high.


A license holder would have to complain to the FCC. If you jammed a commercial station they would try to track you down and seize your gear.


Since there's a nerdy rPi post at the top of HN, I'm going to take the opportunity to plug my new baremetal midi file player / lv2 audio plugin host:

http://www.joebutton.co.uk/blog/baremetal-midi-lv2-raspberry...

When I get time I want to connect up a MIDI keyboard and audio input, so it becomes a synth / guitar stompbox that'll use an open audio plugin format.


Now that is cool will have to try that on one of my PI's


An unreplied comment on a previous submission on HN was questioning the remote feasibility of running TCP over FM with the Raspberry Pi. I too am curious about the state of the art in general, if any, and how it might possibly be exploited for long-range networking between small computers like the Pi.


Yes, but it isn't practical or effective. You would be re-inventing 802.11 very poorly.

1) You could use the given technique to create the MOdulation side of a modem[1]. You would have to solve the receiver and DEModulation side. Not likely to be do-able with a bare Raspberry Pi so you will end up adding a receiver and probably a demodulator (software demodulation is theoretically within the grasp of a Raspberry Pi).

Ref: http://en.wikipedia.org/wiki/Modem

2) Your data rate would be dependent on how well you implement your modem. Assuming you limit yourself to audio range frequency modulation (i.e. 10-3000Hz), you will have a hard time exceeding 300 baud using frequency shift keying (e.g. modulate with two tones, one indicating '0' and the other indicating '1'). If you use phase shift keying, you may achieve 2400 baud, but (a) I really doubt that a Raspberry Pi can do phase shift keying, (b) demodulating PSK is much more difficult that frequency shifting, and (c) in my limited experience, attempting phase shift modulation on top of a FM carrier doesn't work for crap (FM can be viewed as a type of phase shift modulation, so you end up phase shift modulating a phase shift modulator which doesn't demodulate + demodulate reliably into your baseband signal).

Ref: http://en.wikipedia.org/wiki/Modem#Narrow-band.2Fphone-line_...

Higher data rates over phone lines encode multiple bits per baud (signaling unit), making the encoding and decoding tasks go through the roof if done in software. Getting to e.g. 56Kbaud of the end-of-the-road phone modem is impossible - 56Kbaud only worked when the phone company digitized the phone audio, and rather iffy even then.

Ref: http://en.wikipedia.org/wiki/Modem#Using_digital_lines_and_P...


So, with a bigger transmitter, I would be able to r/c an airplane several miles away?, Like a real drone...


It's already possible[1], but legislation varies by country. Line-of-sight, 50m from buildings and people (other than the operator and those under the operators control) and a 150m height limit are common to reduce the risk to commercial aviation, and of property damage or injury.

[1] http://diydrones.com/ (for example)


This is something I've been wondering about after seeing https://www.youtube.com/watch?v=2P17LPYnAAg - they seem to be able to use a signal relay that works on a long range with both the control and video channels. So it's possible with some equipment, but not sure if it's custom built or off the shelf.


That and a satellite to act as a repeater to achieve "beyond line of sight" (BLOS) communications.

http://en.wikipedia.org/wiki/BLOS


There are UHF radio modems that are commonly used for radio telemetry for amateur UAVs (typically RC planes or multi-rotors), transmitting on 900MHz or 433Hz using spread-spectrum technology.

Based on HopeRFs HM-TRP module, they present a serial port, either TTL, or as a virtual COM port over USB using a (defacto-standard) FTDI USB to serial chip. You can use two serial, two USB, or one of each - the radio modem in them is identical, it's just the presentation that differs.

Line-of-site range depends on the data rate, but is in the region of 1 - 2km, but up to 24km is possible with amplification. The data rate is up to 128kb/s.

Lots of technical details can be found on the ardupilot wiki[1].

They were designed as a lower cost, longer range alternative to Xbee [2]. Xbee support ZigBee, multipoint, mesh and other protocols, but not the 433MHz frequency legal in Europe.(900MHz is fine for the US, but the alternative, 2.4GHz, is the same frequency commonly used for spread-spectrum radio-control, so risks interference or reduced range.)

They can be purchased in the US for $75 a pair [2]. Clones can be found can be found from Chinese suppliers for less than $40 a pair [3].

[1] http://code.google.com/p/ardupilot-mega/wiki/3DRadio

[2] http://www.digi.com/xbee/, http://en.wikipedia.org/wiki/XBee

[3] http://store.diydrones.com/category_s/13.htm

[4] Try: http://RCTimer.com, http://AliExpress.com, http://GoodLuckBuy.com and search for 3DR


Packet radio has increased in popularity in recent years. https://en.wikipedia.org/wiki/Packet_radio#Amateur_Packet_Ra... Might be worth looking into, although I'm not sure how practical it would be for the RPi.


It should be entierly possible to modulate packet radio using the GPIO hack, however you would probably need a real-time kernel extension to ensure proper transmission. Decoding is easily possible on the CPU as well, provided you attach soeme RF demodulation circuitry, e.g. to a sound card input.


Too bad the amateur radio service forbids encryption. People do use ssh on packet, but it is a violation.



Just found PiHAT - Rasberry Pi Home Automation Transmitter: http://www.skagmo.com/page.php?p=projects/22_pihat


That's fantastic, I discovered earlier that I had some plugs like those and now I'm trying to make them work. I've managed to make them turn off easily enough, but I can't for the life of me get them to turn on.

Would anyone happen to know how I can tune in to my remote's frequency (144.63 MHz, it says, even though the remote operates at 433.49 or something) and listen to the tones it generates?


Thanks for that link. The PiHAT page does a much better job of explaining the details of how this works to me (as someone with a lot of hardware experience but not a lot of familiarity with the Broadcom SOC on the Pi).


Back in the TRS-80 days, someone discovered they could make sounds through an AM radio and a few games took advantage of that.


I saw it done in the '70s with a PDP-8.


Back when I was doing z80 programming on my TI-83+, I would sometimes us an AM radio as a very crude debugger. Programs stuck in busy loops would generally have a very distinct sound, and you were often over time able to learn what other parts of your program sounded like too.


That is one of those little stories which is just awesome.

That's when you KNOW the machine.

You just can't do that with anything these days. Even my HP50G calc is personality-free in that respect.


Yeah, my understanding is that doing that became difficult even on the higher end 83+/84+ series calculators as the clockrate went up, though I haven't actually put that to the test.


> You just can't do that with anything these days

You can fake it - https://github.com/jamii/mechanical-sympathiser


One of the first demos on the PDP-1.

The first demo on the Altair 8800.


Oh, nice! Here is situation: I have a pretty old car with FM receiver and single CD player, with no line input. Problem: I want to listen to the music from my iPhone, hopefully with a distraction free interface. For that I need a horrible contraption from car power splitter, USB cable to the iPhone that usually doubles as GPS on the dashboard, audio cable back to FM transmitter down there plugged into power outlet.

But now I can have a raspberry pi hidden somewhere, translating audio to FM and possibly recognizing my voice commands while at it like "play We Are the Void by Dark Tranquillity"


Or you could get an iTrip, but I agree that the RPi is way more fun.

http://www.griffintechnology.com/itrip


use a Nokia N900 with built in FM Transmitter


Why would you not play Lost to Apathy?


I wonder, would it be possible to do the same thing in reverse, i.e. use it as some kind of radio receiver that dumps .wav to disk?


No, but rtlsdr [1] is a classical use-case for raspis.

[1] - http://sdr.osmocom.org/trac/wiki/rtl-sdr


Well, this is cool, but it would be cooler if they wrote an open source cell tower for GSM phones running on Raspberry Pi.


I have this sitting on my desk at the moment (just OpenBTS + rPi + a SDR). Nothing too crazy about it.

I like this because they are using the rPi itself as a radio -- that's a pretty neat hack.



$5k for a dev box? Not really in the same league...


Fantastic, now we should combine that with a good text to speech engine so it can read aloud e-books, blogs, and whatnot during daily commute.


I found this very exciting! Every Pi is now a potential pirate radio station!

I imagine that if a proper ground plane antenna were hooked up to it the pi would transmit much farther.

Are FM transmitters still restricted for civilians in some parts of the world?


I just read about Distributed Dance Party [1], a movement that uses an FM transmitters and a bunch of boomboxes to power outdoor parties. Seems like this would be perfect for parades or groups that need a cheap way to communicate with a large number of people.

[1] http://www.wired.com/underwire/2013/01/mf-decentralized-danc...



This is brilliant! Thanks for sharing!!




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: