Adding a simple Display for Channel Name and Number on Pirate Radio

There is a MOD to Pirate Radio

thast uses Big Buttons for the Control of the Pirate Radio. I extended this MOD a little further by adding a Arduino Nano and simple 2x16 LCD Display to the Radio that shows the Name of the played Channel and the Number.
It uses a Arduino Nano Controller, a 16x2 LCD Display. Both you can get by around 15 Euro or even cheaper.
It does not tinker with the Raspberry Code, I tried to keep it simple, just like the Pirate Radio.
The idea is to use Push buttons with 2 ON/OFF connectors, one is connected to the Raspberry to do its work(Volume up/down, Channel Chnage and so on), the second switch channel is to activate a switch on the Arduino Nano to change its Display.
The Programm contains the chars of the Pirate Channel Names which are displayed on the 16x2 Display and the Channel Number.
So only two or three of the present Buttons are used for additional function (Channel UP and DOWN, and, in my case, PAUSE, which will display “AIR PLAY” in my case)
I will display setup and code in short time here.
Shure it would be more sofisticated to read out the Station and stream Name from the VLC Player on the Raspberry directly, and display it on a directly connected Display,but thats higher stuff.
What to do further?
Well, one can use the Arduino to simulate Button clicks on the Raspberry, so add a simple Bubble Touchpad, and if you want to go to lets say Channel 20 directly, you can programm the Arduino so it simulates 20 Button Clicks to “Channel UP” Button to the Raspberry.

Nice, and well documented. I did something similar. My Pirate Radio (Pi Zero w + pHat Beat) is in a wooden box. The buttons on my pHat Beat aren’t accessible. I mounted mini arcade buttons in the top of the case and wired those to a Proto Zero. The Proto Zero is on a stacking header between the Pi Zero and pHat Beat. The buttons just wire up to the same GPIO pins used by the pHat Beat buttons. No code modification necessary.
I’ve been keen to add a display to show the artist and song title of the song being played. Just can’t seem to find my round 2it. ;)

Hi, Nice work.
I have also made similar pushbutton breakout. I am very keen to follow your work with Arduino controller and 16*2 LCD, I hope to be able to convert it using pico or Tiny2040 althou my programmiing skills are very poor. In the meanwhile I made a webradio baced on Volumio+RPiZero+PirateAudio3W from Pimoroni. Attached pictures of both prototypes . I remain waiting for your display setup and code. Thanks for your contribution.
CalleBlyh
Helsinki

There are some stickers in this pack that are handy for marking what button does what.
Pimoroni Super Sticker Selection – Pimoroni

Looks like the second picture shows exaclty what would be th ultimate goal, a display that displays the Station/Title from the stream. Do you have a webside for that solution for me?

Well, so far the Code works pretty well. Should also be possible to use a smaller Arduino device with it, but I had several Nanos laying around.
The following code uses a Arduino Nano and a simpple 16x2 Display.
Here the way to connect them together: (The display should have a i2C 4 Pin Interface, makes it much easier to connect)

The code so far: It works with Digital Input PIN 6 for starters to increase the Display from Station to station, so connect a Button to Pin D6 and GND:

Hi, Yes go to Volumio.org. I used the image version 2.873.There is a recent version 2.868 but for me it crashed. Please be aware I used the Pimoroni PirateAudio Display and there is a plugin available to use. Unfortunately for me, I have no Arduino nano experience at all so adopting a 16*2 display to RPiZero or Pico is a real challenge …

Dont worry. I started with that stuff 2 months ago, and today I have today half a dozen working Webradios (all with different controllers, Raspberrys, Displays) on my desk.
If I wanted just a web Radio, I go to any shop and buy one for 69 Euros, with display and the works all. But Hey, thats no FUN.
And remember: My solution is pretty simple! It does not tinker with the Pirate Radio Setup/Software. Its just a little controller (Arduino Nano) and 2-3 Pushbuttons connected to it (and to the Zero at the same time, see [Mod My Pirate Radio on top] )that makes the Arduino display the Radio STation that is playing. Simple enough stuff.
And if you just want a homebrew Radio, buy a Zero, a Phatbeat (around 27 Euros),
a Arduino Nano (3,50) and a little display (12,00). 2 Speakers, some wires, Buttons -thats it!
grafik
Press the Button
grafik
grafik

Indeed, I totally agree

Hmm, this should be doable with a Pi Zero and Pi PICO, if you have the skills, which I’m not sure I do? The new Arduino IDE now supports the Pi PICO.
Please don’t take this the wrong way, I’m not knocking what you did with the Arduino. It’s just that the PICO has kind of shook things up in that respect. =)

True, but that would be overkill for that task.

True enough, the PICO is a pretty cheap alternative though. What Arduino did you use by the way?

I just now had a second look at your tutorial and realized you had used the stickers on your buttons. The colors matched up nicely with the colors of your button caps. I totally missed that first time through.

The Code is ready. It uses the digital D7 PIN of the Arduino Nano for Channel UP and the digital D6 Pin for Channel down.


So just connect the Pins from the Raspberry for Fast Forward (GPIO 5)and Fast Rewind (GPIO 13) to an Push Button Switch which can handle 2 Channels.
Suprisingly those switches are hard to find!
It has to be a non locking 2 Chanel Push Button switch with off/(ON) Parameters.
That means: The default switch status is off, when its pressed the 2 Channels are ON.
One Channel is connected to the Raspberry GPIO 5 (switch1)and GPIO 13(switch 2), the second channels of the 2 switches are connected to the Arduiono Nano (Pins D6 and Pins D7 ).
So every switch (at the moment 2) closes 2 lines, one to the Raspi and one to the Arduino.
In the Arduino Code you can add your own Radio Station Identifiers, the memory should take a couple of them.
Abother way to do this would be with a 4066 Logic chip (about 50 Cents) that has 5 Logical switches build in which can be set by a 5V Signal.
I Will add a third Button to the code, GPIO 6 of the Raspi for Pause, that will display then "Paused, AIRPLAY Mode).
Have Fun

That type of switch is I believe, referred too as a,
Double pole, momentary contact, normally open, pushbutton switch.
Code tags are three ` before and after your code. On my English US keyboard its the key to the left of the 1 key with the ~ on it.

Thank you very much! That did the trick!

/* This is an easy way to display your Radio Stations on a 16x2 Display with i2c Interface. It can be changed to server other displays, if you include th proper libraries for them in the ARduino Code
 *  and adjust the display commands accordingly. It uses the extension for pirate radio with seperate buttons on the top, and it does not tinker with the Raspi Zero Code. The used buttons 
 *  are simply with two connectors on/of instead of one just for the Raspberry Zero. The second on/of channel of th buttons serve the Arduino Nano with its display. Its fair and simple.
 *  It will in future also allow to ad a Remote Infrared Interface for the Pirate radio, so that the BUTTON Presses are remotely simulated
 */
#include <LiquidCrystal_I2C.h>

// constants won't change. They're used here to set pin numbers:
const int buttonPin = 7;   // the number of the pushbutton pin (Digital Pin D7 on Arduino) + Channel
const int buttonPin2 = 6;   // the number of the pushbutton pin (Digital Pin D6 on Arduino) - Channel
const int buttonPin3 = 5;   // the number of the pushbutton pin (Digital Pin D6 on Arduino) Pause /Airplay Mode
int buttonState = 1  ;  
int buttonState2 = 1  ;
int buttonState3 = 1  ;
int i=1; //Just a counter
int ButtonPress = 0; //Number of the Channel Displayed
int ButtonPress3 = 0; //Is the Pause Button pressed?

LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16 column and 2 rows

//This is the List of your Radio Stations as an array of strings. Put  the Stations in Brackets "Station", And a Komma (except the last station) Its a Global Variable,declared at the beginning, so its known everywhere in the Code

const char* string_array[] =
{ //See that the strings are not longer than 16 characters
  "Hawaiian Rainbow",
  "Slayradio.org",
  "Rainwave",

  "198.27.70.42"

};
const int NUM_OF_STRINGS = sizeof(string_array) / sizeof(string_array[0]); 

void setup()
{
  Serial.begin(9600);  
  pinMode(buttonPin, INPUT_PULLUP); //D7 Button for stations up
  pinMode(buttonPin2, INPUT_PULLUP); //D6 Button for stations down
   pinMode(buttonPin3, INPUT_PULLUP); //D5 Button for Pause/Airplay down
   lcd.init(); // initialize the lcd
  lcd.backlight(); //Backlight on
  lcd.begin(16,2);
   lcd.clear();
  lcd.setCursor ( 0, 0 );
  
 // Demo parameters
const char demoText[]= "Pirate Radio Display";
const unsigned int scrollDelay = 600;   // Miliseconds before scrolling next char
const unsigned int demoDelay = 800;    // Miliseconds between demo loops
byte textLen;                           // Number of visible characters in the text
  textLen = sizeof(demoText) - 1;
  lcd.init();
  lcd.backlight();
  lcd.print(demoText);
  delay(demoDelay);
  // Scroll entire text in a row to the left outside the screen
  for (byte positionCounter = 0; positionCounter < textLen; positionCounter++) {
    lcd.scrollDisplayLeft();
    delay(scrollDelay);
 

/* //Display all Stations
  for (int i = 0; i < NUM_OF_STRINGS; i++)
  {
    lcd.setCursor ( 0, 0 );
    lcd.clear();
    lcd.print(string_array[i]);
       delay(500);       
 */
}
}
void loop() {
//START Buttun UP 
buttonState = digitalRead(buttonPin); 
buttonState2 = digitalRead(buttonPin2) ;
buttonState3 = digitalRead(buttonPin3) ;
if ((buttonState == HIGH)&& (buttonState2 == HIGH)&& (buttonState3 == HIGH)) //Button not pressed
  {
    lcd.setCursor ( 0, 0 );
   lcd.clear();
    lcd.print(string_array[ButtonPress]);
     lcd.setCursor ( 0, 1 );
    char str[16];
     sprintf(str,"Ch: %d", ButtonPress); //Display Channel: X
     lcd.print(str);
     //lcd.print("Channel: ") ;lcd.print (ButtonPress); //Display Channel: X other method
    while ((digitalRead(buttonPin) == HIGH)&& (digitalRead(buttonPin2) == HIGH)&& (digitalRead(buttonPin3) == HIGH)) {}; //something happens 
  }
 
 else if  (buttonState == LOW){ 
   while(digitalRead(buttonPin) == LOW) { }; //Wait until button is pressed and released again
   (buttonState == LOW); 
   ButtonPress ++;  //Increase the number of butto Presses
     
     if (ButtonPress>NUM_OF_STRINGS-1)  //if the channel > max Channels, goto ch 1 
        { ButtonPress=0; }
     
     else 
     {ButtonPress= ButtonPress;}
    }

else if  (buttonState2 == LOW) {
   while(digitalRead(buttonPin2) == LOW) { }; //Wait until button is pressed and released again
   (buttonState2 == LOW); 
     ButtonPress --;  //Decrease the number of butto Presses
      if (ButtonPress<0)
        { ButtonPress=NUM_OF_STRINGS-1; }
  
    else {
       {ButtonPress= ButtonPress;}
        } 
}


else if  (buttonState3 == LOW) {
   while(digitalRead(buttonPin3) == LOW) { }; //Wait until button is pressed and released again
   (buttonState3 == LOW); 
     ButtonPress3 ++;  //Increase the number of butto Presses
      if (ButtonPress3>1) //is the Pause Button pressed more than once??
        {ButtonPress3=0;} //then reset it to 0
      else  { 
       ButtonPress3=ButtonPress3;
        lcd.setCursor ( 0, 1);
        lcd.clear(); 
        lcd.print ("PAUSE / AIRPLAY");
        while (digitalRead(buttonPin3) == HIGH) //wait until the Button is pressed again  
    {} //do nothing in between presses
            }
}
   
    lcd.setCursor ( 0, 1);
    lcd.clear(); 
    lcd.print(string_array[ButtonPress]);                                      
                                                                            
}

The above Code works with 3 Buttons now, D6, D7 and D5 of the Arduino.
D7 (and GND naturely) displays the next Channel, D6 the previous Channel, and D5 sets the Pirate Radio Display in “PAUSE/AIRPLAY” Mode until it resumes to the last Channel if pressed a second time.
The only issue is that the Pirate Radio seems to not recognize every DOWN Channel Button Press (though the Arduino does).
The Arduino uses only one Library, LiquidCrystal_I2C.h, so it should be easy to transfer the code with the Arduino IDE

And here the Picture for the thing