RDA5807m FM Radyo Yapımı Yardım Lütfen

Başlatan thenorthstar, 16 Mart 2019, 13:04:24

thenorthstar

S:A Arkadaşlar, RDA5807m FM radyo modülünden almıştım, internetdeki kütüphaneleri ve uygulamaları denedim ama hışırtıdan başka birşey gelmiyor, İnternettde çalışan videolu kodları bile denedim ama birtürlü kanallabı bulamıyorum nerde yanlış yaptığımı bilemedim. Yardımcı olursanız sevinirim.

Bağlantı Şekli ekte bulunmaktadır.

Kütüphane ve örnek kod:
http://mathertel.github.io/Radio/

Deneme yaptığım kod:
#include <Wire.h>

#include <radio.h>
#include <RDA5807M.h>
#include <SI4703.h>
#include <SI4705.h>
#include <TEA5767.h>

#include <RDSParser.h>


// Define some stations available at your locations here:
// 89.40 MHz as 8940

RADIO_FREQ preset[] = {
  8770,
  8810, // hr1
  8820,
  8850, // Bayern2
  8890, // ???
  8930, // * hr3
  8980,
  9180,
  9220, 9350,
  9440, // * hr1
  9510, // - Antenne Frankfurt
  9530,
  9560, // Bayern 1
  9680, 9880,
  10020, // planet
  10090, // ffh
  10110, // SWR3
  10030, 10260, 10380, 10400,
  10500 // * FFH
};

int    i_sidx=5;        ///< Start at Station with index=5

/// The radio object has to be defined by using the class corresponding to the used chip.
/// by uncommenting the right radio object definition.

// RADIO radio;      ///< Create an instance of a non functional radio.
 RDA5807M radio;    ///< Create an instance of a RDA5807 chip radio
// SI4703  radio;    ///< Create an instance of a SI4703 chip radio.
//SI4705  radio;    ///< Create an instance of a SI4705 chip radio.
// TEA5767  radio;    ///< Create an instance of a TEA5767 chip radio.


/// get a RDS parser
RDSParser rds;


/// State definition for this radio implementation.
enum RADIO_STATE {
  STATE_PARSECOMMAND, ///< waiting for a new command character.
  
  STATE_PARSEINT,    ///< waiting for digits for the parameter.
  STATE_EXEC          ///< executing the command.
};

RADIO_STATE state; ///< The state variable is used for parsing input characters.

// - - - - - - - - - - - - - - - - - - - - - - - - - -



/// Update the Frequency on the LCD display.
void DisplayFrequency(RADIO_FREQ f)
{
  char s[12];
  radio.formatFrequency(s, sizeof(s));
  Serial.print("FREQ:"); Serial.println(s);
} // DisplayFrequency()


/// Update the ServiceName text on the LCD display.
void DisplayServiceName(char *name)
{
  Serial.print("RDS:");
  Serial.println(name);
} // DisplayServiceName()


// - - - - - - - - - - - - - - - - - - - - - - - - - -


void RDS_process(uint16_t block1, uint16_t block2, uint16_t block3, uint16_t block4) {
  rds.processData(block1, block2, block3, block4);
}


/// Execute a command identified by a character and an optional number.
/// See the "?" command for available commands.
/// \param cmd The command character.
/// \param value An optional parameter for the command.
void runSerialCommand(char cmd, int16_t value)
{
  if (cmd == '?') {
    Serial.println();
    Serial.println("? Help");
    Serial.println("+ increase volume");
    Serial.println("- decrease volume");
    Serial.println("> next preset");
    Serial.println("< previous preset");
    Serial.println(". scan up  : scan up to next sender");
    Serial.println(", scan down ; scan down to next sender");
    Serial.println("fnnnnn: direct frequency input");
    Serial.println("i station status");
    Serial.println("s mono/stereo mode");
    Serial.println("b bass boost");
    Serial.println("u mute/unmute");
  }

  // ----- control the volume and audio output -----
  
  else if (cmd == '+') {
    // increase volume
    int v = radio.getVolume();
    if (v < 15) radio.setVolume(++v);
  }
  else if (cmd == '-') {
    // decrease volume
    int v = radio.getVolume();
    if (v > 0) radio.setVolume(--v);
  }

  else if (cmd == 'u') {
    // toggle mute mode
    radio.setMute(! radio.getMute());
  }
  
  // toggle stereo mode
  else if (cmd == 's') { radio.setMono(! radio.getMono()); }

  // toggle bass boost
  else if (cmd == 'b') { radio.setBassBoost(! radio.getBassBoost()); }

  // ----- control the frequency -----
  
  else if (cmd == '>') {
    // next preset
    if (i_sidx < (sizeof(preset) / sizeof(RADIO_FREQ))-1) {
      i_sidx++; radio.setFrequency(preset[i_sidx]);
    } // if
  }
  else if (cmd == '<') {
    // previous preset
    if (i_sidx > 0) {
      i_sidx--;
      radio.setFrequency(preset[i_sidx]);
    } // if

  }
  else if (cmd == 'f') { radio.setFrequency(value); }

  else if (cmd == '.') { radio.seekUp(false); }
  else if (cmd == ':') { radio.seekUp(true); }
  else if (cmd == ',') { radio.seekDown(false); }
  else if (cmd == ';') { radio.seekDown(true); }


  // not in help:
  else if (cmd == '!') {
    if (value == 0) radio.term();
    if (value == 1) radio.init();

  }
  else if (cmd == 'i') {
    char s[12];
    radio.formatFrequency(s, sizeof(s));
    Serial.print("Station:"); Serial.println(s);
    Serial.print("Radio:"); radio.debugRadioInfo();
    Serial.print("Audio:"); radio.debugAudioInfo();

  } // info

  else if (cmd == 'x') { 
    radio.debugStatus(); // print chip specific data.
  }
} // runSerialCommand()


/// Setup a FM only radio configuration with I/O for commands and debugging on the Serial port.
void setup() {
  // open the Serial port
  Serial.begin(57600);
  Serial.print("Radio...");
  delay(500);

  // Initialize the Radio 
  radio.init();

  // Enable information to the Serial port
  radio.debugEnable();

  radio.setBandFrequency(RADIO_BAND_FM, preset[i_sidx]); // 5. preset.

  // delay(100);

  radio.setMono(false);
  radio.setMute(false);
  // radio.debugRegisters();
  radio.setVolume(8);

  Serial.write('>');
  
  state = STATE_PARSECOMMAND;
  
  // setup the information chain for RDS data.
  radio.attachReceiveRDS(RDS_process);
  rds.attachServicenNameCallback(DisplayServiceName);
  
  runSerialCommand('?', 0);
} // Setup


/// Constantly check for serial input commands and trigger command execution.
void loop() {
  int newPos;
  unsigned long now = millis();
  static unsigned long nextFreqTime = 0;
  static unsigned long nextRadioInfoTime = 0;
  
  // some internal static values for parsing the input
  static char command;
  static int16_t value;
  static RADIO_FREQ lastf = 0;
  RADIO_FREQ f = 0;
  
  char c;
  if (Serial.available() > 0) {
    // read the next char from input.
    c = Serial.peek();

    if ((state == STATE_PARSECOMMAND) && (c < 0x20)) {
      // ignore unprintable chars
      Serial.read();

    }
    else if (state == STATE_PARSECOMMAND) {
      // read a command.
      command = Serial.read();
      state = STATE_PARSEINT;

    }
    else if (state == STATE_PARSEINT) {
      if ((c >= '0') && (c <= '9')) {
        // build up the value.
        c = Serial.read();
        value = (value * 10) + (c - '0');
      }
      else {
        // not a value -> execute
        runSerialCommand(command, value);
        command = ' ';
        state = STATE_PARSECOMMAND;
        value = 0;
      } // if
    } // if
  } // if


  // check for RDS data
  radio.checkRDS();

  // update the display from time to time
  if (now > nextFreqTime) {
    f = radio.getFrequency();
    if (f != lastf) {
      // print current tuned frequency
      DisplayFrequency(f);
      lastf = f;
    } // if
    nextFreqTime = now + 400;
  } // if  

} // loop



Epsilon

#1
Module anten takıp denedinizmi?

Protoboard da B19 civarındaki pine 75 cm lik teleskopik anten takın. (O pinede biraz lehim ekleyin bu haliyle   anten temas etmeyebilir.)

thenorthstar

Teleskopik anten bağlayarak denedim hocam.resim çekerken sökmüşüm.
Deli oldum inan. Adam video çekmiş çalışıyor ben aynı kodu atıyorum çalışmıyor sinyal seviyeside 30-34 arasında gösteriyor halbuki.

Epsilon

Ses çıkışındaki elektrolitik kondansatörü ve başka ne varsa söküp linkteki gibi bağlayın
http://www.theorycircuit.com/arduino-rda5807m-fm-receiver/


thenorthstar

Hocam valla hayret ediyorum gönderdiğiniz linkdeki devreyide kurdum onuda denedim ama bir türlü olmadı, RDA5807 çıkışını direk kulaklığa bağlayınca önce hışırtı geliyor daha sonra giderek azalıyor ve hiç ses gelmiyor. ordmı hata yapıyorum bilemedim.
Siz RDA5807 çıkışını direk kulaklığamı takıyorsunuz hocam yokda amplifikatöremi?

@Epsilon hocamın verdiği linkdeki kodu ve bağlantıyı denedim yine aynı önce hışırtı yüksek geliyor sonra giderek azalıyor. RDA5807 nin çıkışına amplifikatormü bağlamam gerekiyor?

1-1" border="0
2" border="0
sinyal" border="0

Epsilon

#6
@thenorthstar modulde çıkış katıda var kulaklıktan dinlenebilecek seviyede .Bu devrede frekans artırma azaltma butonlarlamı yapılıyor yoksa klavyeden harflere mi basılarak artıp azalıyor 94,60 Mhz de kalmış o hiç değişmiyormu? Referans aldığın projenin devresini görsek daha kısa sürede  çözülürdü .


Sanırım sorun : kodda frekans satırı var.  Orayı 9950  yap(yada bildiğin kuvvetli bir radyonun frekansını gir)
Volume fix satırınıda artır 10 falan yap ,kaça kadar müsade ediyorsa artır.

thenorthstar

@Epsilon Hocam sizin vermiş olduğunuz link deki devreyi yaptım.http://www.theorycircuit.com/arduino-rda5807m-fm-receiver/
Bu kodda evdeki radyoda dinlediğim bir frekansı sabit yazdım. Seside max 15 çıkarttım ama kulaklığı takınca ilk önce yüksekbi sesle hışırtı geliyor sonra giderek azalıyor ve birsüre sonra hiç ses gelmiyor. Sadece RDA5807 çıkışına kulaklık bağlayınca hiç ses gelmiyor ama sinyal seviyesi 35-36 seviyelerinde oluyor, amplifikatör takınca hışırtı geliyor ama sinyal seviyesi 1-2 ye düşüyor.75cm lik teleskobik anten bağlı.

@muratdu hocamın verdiği likteki butonlu devreyide kurdum.ondada aynı sorun var lcd de frekans gözüküyor ama ses soluk yok.
http://nicuflorica.blogspot.com/search/label/RDA5807



Epsilon

#8
@thenorthstar senin bu radyoyu çalıştıracağız don't worry  :)
Başka bir hata da şimdi gördüm
radyo modulünde Antenin karşisindaki pin A4 e bağlanacak seninkinde boşta
Radyo modülünde ,onun yanındaki de Arduinonun A5 ine bağlanacak
* Birde o bakır kablolar nedir  :)   yokmu sağlam ince 2 kablo


thenorthstar

;) SDA--> A4'e  ve SCL--> A5'e bağlı hocam resim çekme açısından bağlanmamış gibi görülüyor orda sorun yok  ::ok
Ethernet kablosundan CAT6 dan söktüm kabloları  :) baya sağlam.
Hocam anten çekim gücünü artırmak için bir şeymi yapsak acaba?

3" border="0

Epsilon

Ben mi yanlış görüyorum? O iki bakır kabloyu birer delik ileriye alırmısınız.Bu şekilde haberleşme olmaması normal

thenorthstar

Bağlantılar normal hocam, ı2c üzerinden sinyal seviyesini falan alabiliyorum.

Bu sitede bir anten devresi var işe yararmı acaba.
https://www.mikrocontroller.net/topic/313562#3411429



ipek

Arduino kısmı bağlantıları eğer yollağınız foto gibiyse A4 boşta gözüküyor.

thenorthstar

Hocam kontrol ettim bağlı gözüküyor.



Epsilon