A FREE frequency generator if you have a Raspberry Pi

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
The Raspberry Pi  as a frequency generator
  


I was experimenting with the Pifm code,
and wanted to know what sort of frequencies I could get from the GIPO_4 pin 7.

So I wrote some test code, the program is very simple, and only outputs a square wave.
No extra things needed...
BUT the frequency range is from 130 kHz to 250 MHz.
I have only tested to 250 MHz, I think this is the limit.
Some defines in the code for the PLL frequency are likely wrong.
Missing a factor 2, anyways the calculation of the fractional divider is really close.

A free signal generator from 130 kHz to 250 MHz when you have a Pi is nice thing to have.
 http://panteltje.com/pub/freq_pi.c

Compile that code with:
 gcc -Wall -O4 -o freq_pi freq_pi.c -std=gnu99 -lm

Install it with:
 sudo cp freq_pi /usr/local/sbin/

Connect your frequency counter to GPIO header pin 7.

Run it like this for 130 kHz:
 freq_pi -f 130000
error on my frequency counter 3 Hz.

Run it like this for 107.2 MHz:
 freq_pi -f 107200000
dunno the error, but it wipes out my FM station at 107.2

Run it like this for 250 MHz:
 freq_pi -f 25000000

Error is a few kHz on xpsa spectrum analyzer,
but that could as well be the 30 kHz LO offset from the Elonics 4000 tuner..

Nice to test LC circuits, filters, and the 3.3V amplitude is more than enough for most things,
will even drive 3.3V and 5 V logic.








Re: A FREE frequency generator if you have a Raspberry Pi
The Raspberry Pi  as a frequency generator
  
Version 0.2 is on my site:
 http://panteltje.com/pub/freq_pi-0.2.c

130 kHz to 250 MHz output

Functionality is basically the same, but added some info on phase noise.
When using a fractional divider and when the fractional part is not zero,
then the frequency will wobble around the requested one.
freq_pi -v -f 1000001 will show the fractional part,
so you are warned.
For simple testing this is probably not important,
but gets very important if you drive some modulator or something.

Next project :-)

No it is not a V3.
Did the Aliens take my precision screwdriver ???
More in the NEXT issue of ....

!







Site Timeline