5 ms·
Author here. This code no longer works on new Pi's (it does a lot of low level very hardware stuff from userspace without a proper kernel driver). The code w
by pifm_guy 4y ago
Author here.
This code no longer works on new Pi's (it does a lot of low level very hardware stuff from userspace without a proper kernel driver). The code was written in a 24 hour Hackathon, so is very far from maintainable.
However there are other projects to do the same which do work on new Pi's.
There are ways to do a full software defined radio from a pi by using the I2S hardware, and that can transmit GPS, 433 MHz garage door openers, and various other things.
Obviously whatever you transmit you better be using some filters on the output if you want it to be vaguely legal.
- Johnythree 4y ago> "using some filters on the output" While it's relatively easy to remove harmonics, it is pretty much impossible to remove the broad comb of spurious signals either side of the carrier. Which why transmitters are not designed this way in the real world.
- kragen 4y agoWhich spurious signals do you mean? I'm assuming you're talking about stuff well outside the intended sidebands that result from the modulation. If we were talking about AM I would assume you mean the audio signal isn't bandlimited and so high-frequency audio components get upconverted by the carrier frequency, but I don't know what the spectrum of an FM signal looks like. Are we talking about a broad comb that results in an analogous way from sudden changes in the frequency? Do they go away if you vary the frequency of a 50%-duty-cycle square wave smoothly, like maybe with second- or third-order continuity, instead of suddenly?
- Johnythree 4y agoI'm talking about the broad band of spectral components (both close in and further out) which are generated by the synthesizer. These are a separate issue to any sidebands generated by the modulation process. see https://en.wikipedia.org/wiki/Phase_noise https://en.wikipedia.org/wiki/Phase_noise It's surprisingly difficult to generate a clean carrier which doesn't have a broad band of spectral components, but this is essential for the design of effective Receivers and Transmitters. These sidebands are generated by noise in the oscillator, spurs caused by mixing products, jitter in the synthesiser, and non-linearities in the modulation process. The bottom line is to look at the output with a high-quality spectrum analyser and compare the result with the spectral mask which is published by the FCC.
- kragen 4y agoA broad band of spectral components generated by the Raspberry Pi's clock generator because it has a lot of phase noise? Or do you just mean that in general that many circuits that generate clock signals can have phase noise but that you don't have any idea about this one in particular? He doesn't seem to be using a mixer, so I don't think you'll get any spurs caused by mixing products in this case. I'm no expert obviously but I'd think the phase noise of a PLL driven from a quartz crystal would be negligible.
- pifm_guy 4y agoIn the case of PiFM, the clock generator is being operated out of spec by a wide margin - it is rated for operation up to 25 MHz, but the code operates it at 100Mhz. That makes it do some weired things - and I suspect one of those is that when adjusting the clock frequency (by changing the divisors), sometimes it stops oscillating for many microseconds. Not sure what impact that has in the frequency domain, but I can't imagine it's good...
- kragen 4y agoDid you try hooking it up to a spectrum analyzer or a fast scope with FFT?
- Johnythree 4y agoA PLL is one of the worst for phase noise. It will have a divider chain which will produce jitter and harmonics of the ref osc, and must absolutely rely on careful tuning of the AFC loop to null out these spurs. And as the filter will be digital rather than analog, there is no chance of optimizing it. But that is before we get to the modulation. That again will be digital (rather than analog) so by definition will be chock full of jitter, especially if the FM is generated by stepping the clock frequency in finite steps. Not only will this generate large amounts of jitter, but it will generate spurs of the PWM clock over a wide range of frequencies.
- kragen 4y ago
- noasaservice 4y agoRPITX is the spiritual successor of your project! https://github.com/F5OEO/rpitx https://github.com/F5OEO/rpitx And it does work with nearly every RPi. And unlike only doing FM (97MHz-108MHz), it can emit from an IQ datastream from 10KHz to 1.5GHz.
- miegl 4y ago> There are ways to do a full software defined radio from a pi by using the I2S hardware, and that can transmit GPS, 433 MHz garage door openers, and various other things. Wait, we can do sine wave up to ~1.5 GHz using the built-in PCM/I2S peripheral?
- pifm_guy 4y agoThe built in peripheral works up to about 100 MHz. Beyond that you use the third/fifth/seventh harmonic. Because the pi is notionally outputting a square wave, there are plenty of high powered harmonics to use, and from a signal-quality point of view, they are just as good as the fundamental frequency. Most people view harmonics, spurs and sidebands as unwanted, but with a bit of careful thought they can be controlled to be the exact signal you want...