SurtrTech
Published © GPL3+

Add Radio Stations Reception to Your Arduino Projects

With Grove - FM Recevier, that spares you the amplification and demodulation stuffs.

BeginnerProtip1 hour2
Add Radio Stations Reception to Your Arduino Projects

Things used in this project

Hardware components

Seeed Grove - FM Receiver
×1
Seeeduino Nano
Seeeduino Nano
×1

Story

Read more

Schematics

Wiring

All pins used are digital I/O

Code

Grove_-_FM_Receiver.ino

Arduino
Uses two external buttons to control some radio functions
/* This code works with Grove FM Receiver
 * It permits to control the On/Off and tunning functions via the Arduino board
 * Refer to www.SurtrTech.com for more details
 */

#define B1 2          //D2 and D3 are used as push button inputs
#define B2 3
#define DIFM1 4       //D4 and D5 are used as outputs to be wired with the module "D1" "D2"
#define DIFM2 5

bool B1_state, B2_state; //To read the button current state, 0 or 1

void setup() {
  
  pinMode(DIFM1, OUTPUT);       //pinMode setting
  pinMode(DIFM2, OUTPUT);
  pinMode(B1, INPUT_PULLUP);   //The push button are wired with their pins as above and with GND, so here they are always on high level
  pinMode(B2, INPUT_PULLUP);   //When you press it goes low
  digitalWrite(DIFM1, HIGH);   //FM module pins are set on HIGH, otherwise a low level signal will be sent it will start the module at the beginning
  digitalWrite(DIFM2, HIGH);

}

void loop() {
  
  B1_state=digitalRead(B1);    //Constantly reading the Button 1 and 2 state
  B2_state=digitalRead(B2);

  if(B1_state == LOW)        //if one of them is pushed it calls the function below
  ButtonP(DIFM1);

  if(B2_state == LOW)
  ButtonP(DIFM2);
  

}

void ButtonP(int x){      //The function takes the name of the pin to activate as argument
  
  digitalWrite(x, LOW);   //Sends LOW level signal for 3s then put it to high level
  delay(3000);            //This was the simple and functionning way to simulate a long press
                          //The low level signal couldn't be sent directly from the button --> Arduino --> module
  digitalWrite(x, HIGH);
}

Credits

SurtrTech

SurtrTech

7 projects • 96 followers
YT Channel, run by Automation and Electrical Engineer, Electronics amateur.

Comments

Add projectSign up / Login