0% found this document useful (0 votes)
15 views2 pages

Accessing Hardware: Code Club Pihack

This document discusses turning a Raspberry Pi into an FM radio transmitter by using its hardware that generates spread-spectrum clock signals on GPIO pins to output FM radio signals. Only a 20cm antenna wire plugged into GPIO pin 4 is needed to transmit at 100.0 MHz. Testing showed the signal could travel at least 50m through several conference rooms and behind a heavy metal cabinet. The code hacks together a python library that calls a C program to access the hardware and set the clock generator and frequency. Modulation is done by adjusting the frequency slightly to make the audio signal.

Uploaded by

Rasool Reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Accessing Hardware: Code Club Pihack

This document discusses turning a Raspberry Pi into an FM radio transmitter by using its hardware that generates spread-spectrum clock signals on GPIO pins to output FM radio signals. Only a 20cm antenna wire plugged into GPIO pin 4 is needed to transmit at 100.0 MHz. Testing showed the signal could travel at least 50m through several conference rooms and behind a heavy metal cabinet. The code hacks together a python library that calls a C program to access the hardware and set the clock generator and frequency. Modulation is done by adjusting the frequency slightly to make the audio signal.

Uploaded by

Rasool Reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Below is some code that was hacked together over a few hours at the Code Club

pihack . It uses the hardware on the raspberry pi that is actually meant to generate
spread-spectrum clock signals on the GPIO pins to output FM Radio energy. This
means that all you need to do to turn the Raspberry-Pi into a (ridiculously powerful) FM
Transmitter is to plug in a wire as the antenna (as little as 20cm will do) into GPIO pin 4
and run the code posted below. It transmits on 100.0 MHz.
When testing, the signal only started to break up after we went through several
conference rooms with heavy walls, at least 50m away, and crouched behind a heavy
metal cabinet. The sound quality is ok, but not amazing, as it currently plays some clicks
when the CPU gets switched away to do anything else than play the music. The plan
was to make a kernel mode driver that would be able to use the DMA controller to
offload the CPU and play smooth music without loading the CPU, but we ran out of
time. Now Done and working, DMA from userspace is awesome and awful at the same
time!
If you're v. smart, you might be able to get stereo going! Done!

Accessing Hardware
The python library calls a C program (provided both precompiled and in source form).
The C program maps the Peripheral Bus (0x20000000) in physical memory into virtual
address space using /dev/mem and mmap. To do this it needs root access, hence the
sudo. Next it sets the clock generator module to enabled and sets it to output on GPIO4
(no other accessible pins can be used). It also sets the frequency to 100.0Mhz
(provided from PLLD@500Mhz, divided by 5), which provides a carrier. At this point,
radios will stop making a "fuzz" noise, and become silent.
Modulation is done by adjusting the frequency using the fractional divider between
100.025Mhz and 99.975Mhz, which makes the audio signal. The fractional divider
doesn't have enough resolution to produce more than ~6 bit audio, but since the PI is
very fast, we can do oversampling to provide about 9.5 bit audio by using 128
subsamples per real audio sample. We were being naieve with our subsampling
algorithm - you can now get full 16 bit quality sound, and it even does FM pre-emphasis
so that the result doesn't sound bass-heavy.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy