Monthly Archives: May 2024

PiKVM on a Raspberry Pi 4

Note

I have been considering making this project for a few years now, but have been pushing it off because I have had issues. I started off using a Raspberry Pi Zero 2 W and a CSI-to-HDMI input module and abandoned the project for a few years after that.

I also used a full-size USB to USB-C cable, along with a Y-Splitter (2 male to 1 female), and USB power blocker, all of which I had from my previous tries.

Recently, I have purchased a Raspberry Pi 4 2GB from my local Micro Center. I connected this to my existing hardware.

I used the PiKVM v2 DIY version and downloaded the image from the official website.

Materials Used

  • Raspberry Pi 4 2GB
  • CSI-to-HDMI (input) adapter
  • USB Splitter (2 male to 1 female)
  • USB power adapter
  • USB-to-USB-C cable
  • microSD card
  • MicroSD card USB adapter
  • Other computer (Any OS with Raspberry Pi Imager)
  • USB power blocker
  • USB extension cable
  • Ethernet cable
  • Micro-HDMI-to-HDMI cable
  • Monitor (or capture card to see on another computer)

Setup

I plugged in the USB splitter to a power adapter and the data end to the other plug (with a power blocker and extension cable). I then plugged in a USB-to-USB-C cable to both sides. I then plugged in the USB-C cable to the Pi. Finally, I plugged the ethernet cable into the Pi and my network switch.

Connect the Micro-HDMI-to-HDMI cable to the monitor or capture card and see the IP address on the screen.

After flashing the image to a 64GB microSD card, I set up the Pi and connected to the web interface. I was able to see the display input, but I was not able to use the USB input.

In a future post, I will share the solution I had. Until then, please leave any suggestions you have in the comments.

This post is to be continued

FM Radio Transmitter with a Raspberry Pi 0

With a jumper wire, USB cable, wall adapter, and a $16 Raspberry Pi 0WH, you can build an FM radio transmitter. The signal can be easily picked up for about 50 feet in all directions (assuming no other interference or walls.) This project uses a GitHub repo by user markondej. With this, setting up a FM radio station is extremely easy.

While any Raspberry Pi model (except for Pico) with headers will work, the older Pi 3 series or Pi Zero (not Zero 2) series are preferred. Later series will require additional configuration and will not work as well due to increased interference from having more components. If you are using a Pi 4, 5, or Zero 2, see the below section.

Before you start, you will need a USB cable (Type B-Micro.) These are very common on power banks, small devices, and some old phones. If you don’t have one or would like one specifically designed for the Pi 0, you can buy one for $8. You will also need a few jumper wires, (female-to-female or female-to-male) and a Raspberry Pi. I used the Pi 0, but any version will work as long as there are headers.

Start by flashing Raspberry Pi OS using the Raspberry Pi OS Flasher. Select your board model and select the “Lite” version. For example, the Pi 0 uses Raspberry Pi OS 32-bit Lite, however, you may use the 64-bit version depending on what board you use.

These instructions used the above-mentioned GitHub repository. Please see the repository form more information.

Before I start the guide, I just wanted to say thank you all for the kind comments. Please let me know if you have any questions or anything you want a guide to by leaving a comment or emailing me at [email protected].

Installation & Usage

First, run these commands to install the necessary tools to compile the FM Transmitter. If you used Pi OS, these should be preinstalled, but it is best to run these commands to make sure the software is up-to-date.

sudo apt-get update
sudo apt-get install make build-essential
sudo apt-get install libraspberrypi-dev

When those commands have finished, run these commands to download the GitHub repository to your computer and to create the FM transmitter executable.

git clone https://github.com/markondej/fm_transmitter
cd fm_transmitter
make

If there are no issues (if there are try searching the exact error code and diagnosing from there), then you can move on to the next step.

Test Broadcast

If you are using a Raspberry Pi 1, 2, 3, or 0 (Not Zero 2), use the below command:

sudo ./fm_transmitter -f 100.6 acoustic_guitar_duet.wav

If you are using a Raspberry Pi Zero 2, 4, or 5, read the additional instructions.

Notice:

  • -f frequency – Specifies the frequency in MHz, 100.0 by default if not passed
  • acoustic_guitar_duet.wav – Sample WAV file, you can use your own

Other options:

  • -d dma_channel – Specifies the DMA channel to be used (0 by default), type 255 to disable DMA transfer, CPU will be used instead
  • -b bandwidth – Specifies the bandwidth in kHz, 100 by default
  • -r – Loops the playback

After transmission has begun, simply tune an FM receiver to chosen frequency, you should hear the playback.

Pi Zero 2, Pi 4, and Pi 5 users only:

On Raspberry Pi 4 other built-in hardware probably interferes somehow with this software making transmitting not possible on all standard FM broadcasting frequencies. In this case it is recommended to compile executable with option to use GPIO21 instead of GPIO4 (PIN 40 on GPIO header):

make GPIO21=1

Changing either ARM core frequency scaling governor settings to “powersave” or changing ARM minimum and maximum core frequencies to one constant value (see: https://www.raspberrypi.org/forums/viewtopic.php?t=152692 ).

echo "powersave"| sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Using lower FM broadcasting frequencies (below 93 MHz) when transmitting.

Assuming you followed all device-specific instructions, the below example command should work:

sudo ./fm_transmitter -f 89.5 acoustic_guitar_duet.wav

Extra Info

Using an FM radio, scan the channel you plan to use for interference. If there is just static or a faint channel, you should be able to use that channel. Simply change the frequency option when running the code. Replace frequency with the desired channel.

sudo ./fm_transmitter -f frequency acoustic_guitar_duet.wav

Also note that some radios do not work below 88.0MHz, while others go down to 87.5MHz. I personally recommend staying between 88.5 and 107MHz to maximize compatibility, but your mileage may vary.

Legality

This was not written by a lawyer and is not legal advice. Consult a lawyer or other expert before attempting this project. I do not condone illegal activity or this project. Use your own due diligence before attempting this project. Additional regulations may apply depending on your location.

In the US, extremely low power broadcasting is permitted for some hobbyist devices, however, they must accept interference.

Do not attach an amplifier or proper antenna to the Raspberry Pi because that will exceed the maximum unlicensed limit of 200 feet.

According to the official website of the FCC:

Unlicensed operation on the AM and FM radio broadcast bands is permitted for some extremely low powered devices covered under Part 15 of the FCC’s rules.  On FM frequencies, these devices are limited to an effective service range of approximately 200 feet (61 meters).  See 47 CFR (Code of Federal Regulations) Section 15.239, and the July 24, 1991 Public Notice (still in effect).  On the AM broadcast band, these devices are limited to an effective service range of approximately 200 feet (61 meters).  See 47 CFR Sections 15.207, 15.209, 15.219, and 15.221.  These devices must accept any interference caused by any other operation, which may further limit the effective service range.

The FCC also outlines regulations for “Home-Built Transmitters that are Not for Sale”

Hobbyists, inventors and other parties that design and build Part 15 transmitters with
no intention of ever marketing them may construct and operate up to five such
transmitters for their own personal use without having to obtain FCC equipment
authorization. If possible, these transmitters should be tested for compliance with the
Commission’s rules. If such testing is not practicable, their designers and builders are
required to employ good engineering practices in order to ensure compliance with the
Part 15 standards.
Home-built transmitters, like all Part 15 transmitters, are not allowed to cause
interference to licensed radio communications and must accept any interference that
they receive. If a home-built Part 15 transmitter does cause interference to licensed
radio communications, the Commission will require its operator to cease operation
until the interference problem is corrected. Furthermore, if the Commission determines that the operator of such a transmitter has not attempted to ensure compliance with the Part 15 technical standards by employing good engineering practices then that operator may be fined up to $10,000 for each violation and $75,000 for a repeat or continuing
violation.
Operating a prototype of a product that is ultimately intended for market is not
considered “personal use.” Thus, a party that designs and builds a transmitter with
plans to mass produce and market a future version of it must obtain an experimental
license from the FCC in order to operate the transmitter for any purpose other than
testing for compliance with the Part 15 technical standards. Information on
experimental licenses may be obtained from the contact point listed in the Additional
Information section of this bulletin. FCC authorization is not required in order to test
a transmitter for compliance with the Part 15 technical standards

You can read the official FCC standards here: