FinRadio - a balenaLabs residency project

Hi everyone.

My name is Ramiro and I’ve joined Balena two weeks ago. I’ve started now working on my residency project at balenaLabs after some research/experimentation about what to work on, and I wanted to share the project idea and use this thread to also track the progress I make.

I chose to work on something related to Software Defined Radio because I like a lot the things you can do with it, like a GPS received, AM/FM received, aircraft and ship tracker and much more! After playing with some ideas I’ve settled on one.

Wouldn’t it be great to have a Raspberry Pi based AM/FM/SW radio?

  • I could start with a Pi + a SDR dongle.

  • Then connect the Pi to a speaker → boom we have sound

  • I could add a rotary switch ( now that I know how they’re called ) to tune the radio and a potentiometer to control the volume

  • I have several options for displays:

  • A simple frequency display with a 7-segment LED

  • A graphical display that resembles an analog radio dial

  • I could have “radio preset” buttons

  • I could have a “tuning level” indicator if I somehow manage to detect how far from the signal the currently selected frequency is

I’m currently on the “design/experiment” phase, learning which tools I could use and making a plan for the next weeks.

The building blocks I have in mind are:

  • A Raspberry Pi (3B or 4)

  • An SDR dongle. I have a nice NooElec NESDR SMArt HF Bundle , but it should work with any. Note that for AM reception you need some add-ons like the “Ham It Up”

  • The RTL-SDR package and related projects

  • Hardware knobs, buttons, and a case to fit the components

  • Displays. Haven’t decided on which one(s) yet

The project will be made available as a Balena Hub app so that anyone can install it on their Pi.

On the next post I’ll write about related projects and references I’ve found.

Any ideas and suggestions are welcome!

R.

2 Likes

I’ve made some good progress so far:

  • Using a modified version of the rtl-sdr rtl_fm program to control the tuner
  • The app is “balenized”, and I’ve had success running on a Raspberry Pi 4. Will try on a balenaFin
  • I have a very crude app that I’m using to control the tuner. This will be replaced with the hardware control once I get a rotary knob and learn how to use it

This is the repo I’m using to keep track of the app, code and related references:

1 Like

I’ll post the two alternatives I’m evaluating to build the app. The functionality I need to solve:

  • Being able to turn a dial and change the tuning
  • Listen to FM and AM ideally; FM only is OK since to listen to AM you probably need some extra hard
  • Change the volume up or down

And I’m trying to reuse either a library or existing programs from rtl_sdr to do the heavy work of signal processing and demodulation.

Here’s the first one:

I have some issues to solve; see the box on the top right. I need to explore this option a little more. In the next post, I’ll post the alternative I’m working on.

1 Like

Here’s the current alternative. It lets rtl_fm handle the data acquisition and demodulation, and it outputs an audio stream that can be piped to other applications. It uses a modified version ( called rtl_udp ) that provides a “command channel” similar to the one provided by rtl_tcp

2 Likes

good job @ramirogm

some noob questions:

  • do you think the rotary know potentiometer may be a block?
  • do you think the radio app might be a website rendered on browser or browser-wpe block?

looking fwd to test this :slight_smile:

Hi @mpous , great ideas. I was thinking on first creating some internal component for the rotary knob reader to keep the interfaces simple; I have to read a bit more about blocks but I think making a reusable block sounds great

And about the UI I was thinking of using a simple graphics display ( 240x180 or something like that ) because I wanted to do something at a lower level than a browser, but I’ll keep that in mind!

1 Like

@ramirogm maybe if you decouple the logics of the UI on another service, this will provide a lot of flexibility to other developers to add other UIs!

what do you think?

I think it’s a good idea ! I like it

References!

While looking for ideas and references for my project I found or was told about these excellent related projects:

1 Like

Hi there, time to share some updates.

I’ve been working on implementing the following components:

  • rotary-reader: a node app that reads the input from a rotary knob via GPIO, calculates an abstract value from clicks it receives from the knob, and publish the new value by sending a UDP packet ( a very simple protocol )
  • radio-player: no updates for this one as it was working already. I’ve learned about an “absolute tuning” mode that I’m currently using ( more about this later )
  • display: I want to show at least the current frequency, as any regular radio does, so I’ve been working on creating a library or block that displays this info in a simple OLED 128 x 64 tiny screen
  • controller: a node.js app that syncs the different modules and provides feedback to the user

This diagram shows the components:

1 Like

Here’s a video of the current prototype. The basic features are working!
It plays a radio, you can use the knob to change the frequency, and the radio provides some feedback using a display and two leads ( mainly used while debugging )

1 Like

oh wow! that sounds amazing!

BTW do you have the GPIO connection sketched to share @ramirogm ?

Hi Marc, not yet but plan to do it once I have them a bit more tidy :slight_smile:
. Currently working on making the rotary-reader a standalone component ( block ).

1 Like

Looking forward to see that block :slight_smile:

Hi, I’ve created a fritzing diagram for the current config. Here it is!

I couldn’t find an image for the USB SDR dongle, but it connects to the USB port

1 Like

Meanwhile, I’m working on making a balena block out of the rotary reader component.

I’ve created a “proto-block” called rotary-reader that can be used to integrate a rotary encoder into an app without having to deal with GPIOs. The block integrates a couple of node.js libraries and sends the events to other containers using an UDP datagram. The code is at finradio/rotary-reader at main · ramirogm/finradio · GitHub . I built a couple of images and published them to Docker Hub Thanks @mpous for the idea! If anyone wants to take a look or give feedback go ahead :slight_smile:

1 Like

Here’s the diagram for the current version. I’ve added a Volume knob. I also got a set of tiny speakers that I plan to put inside a case to hide all the cabling

Here you can see it in action
V 0.0.3