Pages: [1]   Go Down
Author Topic: Tea5767 speaker/sound issues  (Read 773 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is my ninth project, and I am having issues even hearing this radio. I've finished all of the work for this system, but am having issues detecting any sound. The snippets of audio code that are placed in at various points aren't working. Everything does work on the serial monitor, but have yet to get a antenna to boost the range of the radio. Can someone help me properly insert the code for the speaker? Any assistance would be appreciated.

Scratch built project courtesy of Instructables.com and smonk1: "http://www.instructables.com/id/TEA5767-FM-Radio-Breakout-Board-for-Arduino/step4/Attach-to-Arduino/"

Here is the unhashed code courtesy of "http://www.electronicsblog.n":
Code:
/// Arduino FM receiver with TEA5767
#include <Wire.h>
#include <LiquidCrystal.h>

unsigned char search_mode=0;

int b=0;
int c=0;
#define Button_next 30
#define Button_prev 31

unsigned char frequencyH=0;
unsigned char frequencyL=0;

unsigned int frequencyB;
double frequency=0;

double freq_available=0;

LiquidCrystal lcd(7, 8, 9, 10, 11, 12); ///this is the configuration for my lcd screen

void setup()
  {

  Wire.begin();


/// buttons

  pinMode(Button_next, INPUT);
  digitalWrite(Button_next, HIGH); //pull up resistor

  pinMode(Button_prev, INPUT);
  digitalWrite(Button_prev, HIGH); //pull up resistor

    frequency=87.5; //starting frequency

    frequencyB=4*(frequency*1000000+225000)/32768; //calculating

    frequencyH=frequencyB>>8;

    frequencyL=frequencyB&0XFF;

  delay(200);

  Wire.beginTransmission(0x60); //writing TEA5767

    Wire.write(frequencyH);
    Wire.write(frequencyL);
    Wire.write(byte(0xB0));
    Wire.write(byte(0x10));
    Wire.write(byte(0x00));
    Wire.endTransmission();



  }

void loop()
 {

  unsigned char buffer[5];

  lcd.setCursor(0, 0);

  Wire.requestFrom(0x60,5); //reading TEA5767

  if (Wire.available())

  {
      for (int i=0; i<5; i++)
      {

        buffer[i]= Wire.read();
      }

        freq_available=(((buffer[0]&0x3F)<<8)+buffer[1])*32768/4-225000;

        Serial.print("FM ");

        Serial.print((freq_available/1000000));

        frequencyH=((buffer[0]&0x3F));

        frequencyL=buffer[1];

if (search_mode)
  {

if(buffer[0]&0x80) search_mode=0;

}

  if (search_mode==1)
    Serial.print(" SCAN");
    else { Serial.print(" ");
    }

  lcd.setCursor(0, 1);

Serial.print("Level: ");
Serial.print((buffer[3]>>4));
 Serial.print("/16 ");

if (buffer[2]&0x80)
  Serial.print("STEREO ");
else Serial.print("MONO ");

}

///// buttons read

//////////// button_next//////////
if (!digitalRead(Button_next)&&!b)
{

frequency=(freq_available/1000000)+0.05;

frequencyB=4*(frequency*1000000+225000)/32768+1;

frequencyH=frequencyB>>8;
frequencyL=frequencyB&0XFF;

Wire.beginTransmission(0x60);

Wire.write(frequencyH);
Wire.write(frequencyL);
Wire.write(byte(0xB0));
Wire.write(byte(0x1F));
Wire.write(byte(0x00));

Wire.endTransmission();

  delay(200);

//////////////////////

b=100;

};

if (!digitalRead(Button_next)&&b==1)
{

///scannnn UP

search_mode=1;

 Wire.beginTransmission(0x60);

Wire.write(frequencyH+0x40);
Wire.write(frequencyL);
Wire.write(byte(0xD0));
Wire.write(byte(0x1F));
Wire.write(byte(0x00));

Wire.endTransmission();

  delay(200);

/////////////////

b=100;

};

if (!b==0) b--;

//////////// button_prev//////////
if (!digitalRead(Button_prev)&&!c)
  {

frequency=(freq_available/1000000)-0.05;

frequencyB=4*(frequency*1000000+225000)/32768+1;

frequencyH=frequencyB>>8; frequencyL=frequencyB&0XFF;

Wire.beginTransmission(0x60);

Wire.write(frequencyH);
Wire.write(frequencyL);
Wire.write(byte(0xB0));
Wire.write(byte(0x1F));
Wire.write(byte(0x00));

Wire.endTransmission();

c=100;

  delay(200);


};

if (!digitalRead(Button_prev)&&c==1)
  {

///scannnn DOWN

search_mode=1;

Wire.beginTransmission(0x60);

Wire.write(frequencyH+0x40);
Wire.write(frequencyL);

Wire.write(byte(0x50));
Wire.write(byte(0x1F));
Wire.write(byte(0x00));
Wire.endTransmission();

  delay(200);

c=100;

};

if (!c==0) c--;
}
Logged

Offline Offline
Edison Member
*
Karma: 58
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the link, http://www.electronicsblog.net/arduino-fm-receiver-with-tea5767/

I don't understand your question, you would like some code for the speaker ?
You can't connect a speaker to the output of the module.
You should use an amplifier.
Logged

Pages: [1]   Go Up
Jump to: