2

I was playing with the PiFm on my Pi and successfully transmitted the sound.wav on a specific frequency. That is 94.5 . But when I am trying to do the same on 89.7 , it does nothing. I changed absolutely nothing but the frequency.

What would be the cause of this. Also...maybe not so relevant, when I Ctrl+C the PiFm the sound.wav stops playing from the radio but the regular program does not return.

goldilocks
  • 60,325
  • 17
  • 117
  • 234

3 Answers3

2

You didn't show your antenna, but assuming it's just a piece of wire attached to the pin, it's "tuned" very approximately to the frequencies you're transmitting. It won't work well for GPS or WiFi signals, but if it works for one of the FM broadcast frequencies it will work for others as well.

Two sources of issues remain:

  • the software. You mention stopping your program with Ctrl+C, which stops the broadcast but doesn't terminate the "regular program". Not sure what is that, but it looks like you may not free the resources correctly after the first run, which explains why the second run of the program fails. Try broadcasting again after a complete restart.

  • the receiver. While the second frequency you have tried is within FM broadcast range and must be covered by most receivers, there are exceptions. For example, this particular frequency may be already used for broadcast, resulting in interference, or you may have hit your receiver's image frequency. In both cases, modern FM receivers try to save your ears from cracks and whistles and simply silence the output, which is what you observe. So, try broadcasting at a different frequency.

Dmitry Grigoryev
  • 28,277
  • 6
  • 54
  • 147
1

PiFM is one of those really cool wow projects. I still want to get around to playing with it it's that cool. Unfortunately this means I don't know about the second part of your problem. Still, I have a basic understanding of radio so I can take a stab at what's going wrong with being unable to transmit on 89.7.

A simplified explanation of how radio works is that you vibrate the antenna at your frequency, varying it a little because it's FM - Frequency Modulation. Now the important bit here is that vibration. How much the antenna can vibrate is related to the length of it, the longer it is the more it can vibrate, and you can broadcast at a higher frequency. There's a bit more to it than that involving modes and multiples, but that's the fundamental.

What I suspect is happening to you is that your antenna is just a little bit too long (maybe 1 cm or so). When you try to broadcast, or vibrate at 89.7, the wave travels down the antenna at a frequency it really doesn't want to vibrate at - there's no resonance, so it wants more energy than the Pi puts out, so you get no signal.

There are calculators for working out the correct antenna length, but I think a rough rule of thumb is 300 divided by the frequency, so (300 / 89.7)/4 = 0.836 meters. Not sure about that rule though. Might get away with /8 and 0.418. Note the multiples of 2, that's a resonance/natural frequency thing.

Fred
  • 4,592
  • 19
  • 29
0

Yes, PiFM is great and really, like Fred says, a wow project. Simply transmitting FM on GPIO is was an absolute first for me. It made allot of people, more interested in the Pi, which is great.

There can be a few reasons for your issues.

  1. It may be down to software problems, since there are no guarantees with it, since the Pi is not a certified FM transmission device. Inherently, in most countries it is illegal to broadcast above a certain power since it may interfere with other users, so its mostly personal, up to a few metres.
  2. Expanding on the licensing of FM. It may also be possible that FM range is being overpowered by another broadcaster. Even though you might be right there, next to it, the other FM signal will overlap if its licensed to broadcast at such power. It may sound silent, but it may be broadcasting inaudible bit data, for traffic? Radio Display or other commercial activity in your area.
  3. Some anomaly with your antenna might cause at that frequency may "corrupt" the signal so to say. Make sure your wire is the correct length, purest solid core copper, and straight (no kinks or loops) (solid core copper Ethernet cable is great!)

Really, in the case of personal FM transmission, it is mostly down to the fact that if it works on an FM frequency, utilise that one.

Some troubleshooting:

  • You say you only tried two frequencies? Try a few more but essentially there is no way to guarantee the frequency you want, will work with an unlicensed device like the Pi.
  • Try another wave file, another encoding (preferable 22khz)
  • Try another power supply on the Pi
  • Try moving right next to the receiver, but do not let the antennas touch. There could be a negative impedance issue and could fry either or both devices.
Piotr Kula
  • 17,336
  • 6
  • 66
  • 105