๐Ÿ”Š How to connect the volume controller M62429 to Arduino

Chip M62429 is designed to reduce the volume of sound in electrical circuits. The chip allows you to control simultaneously and independently two sound channels. The sound adjustment range is from 0 to โˆ’83 dB, i.e. the chip is able to attenuate the volume about 100,000 times.
scheme

Chip M62429 is designed to reduce the volume of sound in electrical circuits. The chip allows you to control simultaneously and independently two sound channels. The sound adjustment range is from 0 to โˆ’83 dB, i.e. the chip is able to attenuate the volume about 100,000 times.

We will need:

  • Arduino UNO or another compatible card;
  • digital potentiometer M62429 in a DIP8 package or in a SOP8 package;
  • connecting wires (I recommend this set);
  • breadboard;

Volume Control Description M62429

Chip M62429 runs in two types of cases – DIP-8 (8P4) and SOP-8 (8P2S-A). The pin assignment for both types of enclosures is shown in the figure. As you can see, there are two inputs (VIN1, VIN2) and two outputs (VOUT1, VOUT2) for sound channels, power, and ground (VCC and GND), as well as two control legs (DATA and CLOCK).

The power supply of the chip is carried out with a voltage from 4.5 to 5.5 V (the absolute maximum is 6 volts).

This is what the microcircuit looks like in an output package:

 I have a chip in a surface mount case. It is difficult to connect to such a chip without soldering, so for testing, I will use the following adapter from the SOP-8 case to the PLS connectors:

 

Circuit connection: M62429 to Arduino
Connect the chip to the Arduino and to the microphone here according to this scheme:

 

 The manufacturer recommends stabilizing the VCC power input using a decoupling capacitor (connect the power input to the ground through a capacitance of 0.1 … 0.33 ฮผF).

The manufacturer also recommends putting an electrolytic capacitor with a capacity of 2.2 microfarads at the input (for the circuit, see the last page of the technical description).

 The microphone and speaker in the diagram are conventionally just to show that the VIN1 input of the M62429 chip is output from a microphone or other audio source, and the output – further to the electrical circuit and to the audio playback device.

Description of the serial control signal volume control M62429

To control the chip M62429 uses a serial interface with packet data. The length of one data packet is 11 bits. The package structure is shown in the figure.

 

 The first bit is the channel number, the second is whether to use independent channel control or simultaneous, then 7 bits are allocated for the volume code, and the packet is completed with two bits equal to “1”.

It is important to know the parameters of the frequency and data pulses. The microcircuit is controlled by a meander (the duty cycle is 2), the minimum pulse duration tWHC (as well as tWLC) is 1.6 ยตs, and the period TCR is 4 ยตs. The remaining characteristics of the pulses are given in the technical description (datasheet), which can be downloaded from the links below.

 

Sketch to control the M62429 chip using Arduino

Knowing all this, we will write a sketch that will change the volume of the regulator from maximum to minimum at a speed of 1 decibel per second. The heart of the program is the setVolume () procedure and two arrays of volume codes that are composed of two tables of volume codes in the technical description (the “Volume Code” table).

const int CLK = 4;
const int DATA = 2;
const int twhc = 2;
const int twlc = 2;

int att1[21][5] = {
  {1, 0, 1, 0, 1}, //-0db
  {0, 0, 1, 0, 1}, //-4db
  {1, 1, 0, 0, 1}, //-8db
  {0, 1, 0, 0, 1}, //-12db
  {1, 0, 0, 0, 1}, //-16db
  {0, 0, 0, 0, 1}, //-20db
  {1, 1, 1, 1, 0}, //-24db
  {0, 1, 1, 1, 0}, //-28db
  {1, 0, 1, 1, 0}, //-32db
  {0, 0, 1, 1, 0}, //-36db
  {1, 1, 0, 1, 0}, //-40db
  {0, 1, 0, 1, 0}, //-44db
  {1, 0, 0, 1, 0}, //-48db
  {0, 0, 0, 1, 0}, //-52db
  {1, 1, 1, 0, 0}, //-56db
  {0, 1, 1, 0, 0}, //-60db
  {1, 0, 1, 0, 0}, //-64db
  {0, 0, 1, 0, 0}, //-68db
  {1, 1, 0, 0, 0}, //-72db
  {0, 1, 0, 0, 0}, //-76db
  {1, 0, 0, 0, 0}  //-80db
};

int att2[4][2] = {
  {1, 1}, //-0db
  {0, 1}, //-1db
  {1, 0}, //-2db
  {0 ,0}  //-3db
};

void setup() {
  pinMode(DATA, OUTPUT);
  pinMode(CLK, OUTPUT);
  digitalWrite(DATA, HIGH);
  digitalWrite(CLK, LOW);
  delay(1000);
}

void loop() {
  for (int db=0; db>=-83; db-=1){
    setVolume(0, true, db);
    delay(1000);
  }
  delay(2000);
}

void setVolume(int channel, bool independent, int decibels) {

  int att1index = floor(abs(decibels) / 4);
  int att2index = abs(decibels) % 4;
  
  digitalWrite(DATA, (bool)channel);
  digitalWrite(CLK, HIGH);
  digitalWrite(DATA, LOW);
  digitalWrite(CLK, LOW);

  digitalWrite(DATA, independent);
  digitalWrite(CLK, HIGH);
  digitalWrite(DATA, LOW);
  digitalWrite(CLK, LOW);

  for (int i=0; i<5; i++) {
    digitalWrite(DATA, (bool)att1[att1index][i]);
    digitalWrite(CLK, HIGH);
    digitalWrite(DATA, LOW);
    digitalWrite(CLK, LOW);
  }
  
  for (int i=0; i<2; i++) {
    digitalWrite(DATA, (bool)att2[att2index][i]);
    digitalWrite(CLK, HIGH);
    digitalWrite(DATA, LOW);
    digitalWrite(CLK, LOW);
  }

  digitalWrite(DATA, HIGH);
  digitalWrite(CLK, HIGH);
  delayMicroseconds(twhc);
  digitalWrite(DATA, LOW);
  digitalWrite(CLK, LOW);
  delayMicroseconds(twlc);

  digitalWrite(DATA, HIGH);
  digitalWrite(CLK, HIGH);
  delayMicroseconds(twhc);
  digitalWrite(CLK, LOW);
  digitalWrite(DATA, LOW);
  delayMicroseconds(twlc);
}

I note that in decibels to set the volume attenuation is not always convenient. You can make a procedure that accepts, let’s say, the volume level. Like this: setVolumeInPercent (0, true, 35), where 0 is the second channel, true indicates independent control of channels, and 35 is the volume level as a percentage of the maximum (or vice versa, attenuation level of attenuator).

Load the sketch into the Arduino memory and see the result. I connected the oscilloscope to the CLOCK and DATA channels for demonstration.

 

 Purple signal – CLOCK, green – DATA.

And here is the oscillogram of the voltage at the output VOUT1 of the chip M62429.

Share on facebook
Facebook
Share on google
Google+
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on pinterest
Pinterest