Problem interfacing with PCD3311 tone generator via I2C

Hello, I’m attempting to interface with a PCD3311CP[1] IC (DIP14) to produce tones on a tiny 8ohm speaker. My code is very simple:

#include <Wire.h>

void setup() {
  Wire.begin();
}

void loop() {
  Wire.beginTransmission(0x24);
  Wire.write(0x0f); // Generate 1633hz tone
  delay(100);
  Wire.write(0x01); // Turn off oscillator
  Wire.endTransmission();
}

All I hear is a quiet clicking in the speaker. Unfortunately I don’t have access to a oscilloscope so I can’t say much more about what’s actually happening.

I’ve tried the following:

  • Confirmed the speaker works with another circuit
  • Tried putting a 1K ohm resistor in series with the speaker (no difference)
  • Tried calling beginTransmission/endTransmission for each byte (no difference)
  • Tried several other PCD3311 chips (no difference)
  • Ensured the I2C address/A0 pin are correct (if I change the address or pull A0 high, I hear no clicking)
  • Ensured the MODE pin is correct (if I pull MODE high (parallel input mode) I hear no clicking)

Here are my connections on the PCD3311:

pin1 3.5mhz crystal
pin2 3.5mhz crystal
pin3 pulled low (I2C mode)
pin4 NC
pin5 NC
pin6 connected to speaker (+)
pin7 pulled low (I2C address LSB=0 (the address is fixed to 010010X where X is pin7, i.e., 0x24 or 0x25))
pin8 SCL with pull-up resistor
pin9 SDA with pull-up resistor
pin10 NC
pin11 NC
pin12 NC
pin13 GND
pin14 VCC

One thing I’m confused about in the data sheet is the mention of byte 0x00 meaning oscillator ON (section 7.11, Table 2). Maybe I’m not understanding the protocol.

Any tips would be greatly appreciated. I’m stuck. Thank you.

[1] Data sheet http://www.e-lab.de/downloads/DOCs/PCD3311C_3312C_2.pdf

Photo of breadboard if it helps at all:

nx1101:
Hello, I’m attempting to interface with a PCD3311CP[1] IC (DIP14) to produce tones on a tiny 8ohm speaker. My code is very simple:

#include <Wire.h>

void setup() {
 Wire.begin();
}

void loop() {
 Wire.beginTransmission(0x24);
 Wire.write(0x0f); // Generate 1633hz tone
 delay(100);
 Wire.write(0x01); // Turn off oscillator
 Wire.endTransmission();
}




All I hear is a quiet clicking in the speaker. Unfortunately I don't have access to a oscilloscope so I can't say much more about what's actually happening.

You do not understand I2C communications.

The Wire.h library is a transaction based library.

  • Wire.beginTransmission(slaveID);
    is the first Step, It just stores the slaveID in an internal buffer
  • Wire.write();
    add data to this internal Wire buffer
  • Wire.endTransmission();
    actually sends the data to the I2C slaveID

so to achive what you wanted try this:

void loop() {
  Wire.beginTransmission(0x24);
  Wire.write(0x0f); // Generate 1633hz tone
  Wire.endTransmission();

  delay(100);

  Wire.beginTransmission(0x24);
  Wire.write(0x01); // turn off
  Wire.endTransmission();
}

Chuck.

  • Tried calling beginTransmission/endTransmission for each byte (no difference)

That also didn't work. I didn't know the Wire lib was transactional though. Thanks for the tip.

Any other ideas what may be wrong?

Try the I2C scanner program to verify the connections.

jremington:
Try the I2C scanner program to verify the connections.

I2C Scanner
Scanning...
I2C device found at address 0x24  !
done

Looks like the address 0x24 is correct.

Any other ideas?

I put a 10uF cap in series with the speaker, and now I can hear the modem/DTMF tones very quietly.

You seem to be trying to drive your 8Ω loudspeaker directly from the tone output of the integrated circuit (pin 6). That pin gives roughly 150mV RMS output with an output impedance up to 500Ω.

You need an audio amplifier capable of driving an 8Ω loudspeaker.