PARTS: I2C AUDIO volume POTENTIOMETER (DS1807)

The DS1807 consists of two logarithmic digital potentiometers (pots) for audio volume adjustment. Each pot has 64 volume levels plus a mute setting. The volume level of each pot is set over a two-wire I2C serial interface. We’ll show you how to connect and interface the DS1807 below.

DS1807 I2C audio volume potentiometer (Digikey #DS1807+-ND, $3.04)

Connections

बस समुद्री डाकू
DS1807 (pin #)

रखरको चाल्नु
Gnd (1)

रखरको चाल्नु
A2 (2)

रखरको चाल्नु
A1 (3)

रखरको चाल्नु
A0 (4)

रखरको चाल्नु
Atnd (11)

SDA
SDA (12)

घडी
SCL (13)

+5volts
Vcc (1))

We connected the DS1807 to the Bus Pirate universal serial interface tool as shown in the table, the same basic principals apply to any custom-made configuration. We used the Bus Pirate’s 5volt power supply, but the DS1807 will also work at 3.3volts. I2C requires a pull-up resistor on each signal line, we used the Bus Pirate’s on-board resistors connected to the on-board 5volt power supply.

Connect the DS1807 to an audio source as shown on page 3 of the datasheet. connect the raw audio signal to the H pin and connect the L pin to ground, the attenuated audio signal will come from the W pin.

Interfacing

First, setup the Bus Pirate for I2C mode, and activate the 5volt power supply. We covered this procedure in our last parts post.

I2C>v<–voltage monitor 9xx VOLTAGE MONITOR: 5V: 4.9 | 3.3V: 0.0 | VPULLUP: 5.0 | I2C>

With the power supply configured, check the voltage monitor (v) to be sure the 5volt supply is active and that 5volts is present at the pull-up resistors.

I2C>(0)<–list available macros 0.Macro menu 1.7bit address search I2C>(1)<–run address search xxx searching 7bit I2C address space. Found devices at: 0x50 0x51 0x52<–potential addresses I2C>

The Bus Pirate’s address search macro is a quick way to locate I2C devices without checking out the datasheet. 0x50 is an I2C write address because the last bit is 0, 0x51 is read address (last bit 1). 0x52 is probably a group/global write address because it doesn’t have a corresponding read address.

We could also figure out the address from the datasheet: the base address is 0101 plus the three address select bits (A0-2, all grounded, 000) and the write or read bit (0 or 1) gives 0b01010000 (0x50).

I2C>[0x51 r r]<–read pot values 210 I2C start CONDITION 220 I2C WRITE: 0x51 got ACK: yes <–device read address 230 I2C READ: 0x3F<–pot0 230 I2C READ: 0x3F<–pot1 240 I2C stop CONDITION I2C>

First, we read the potentiometer values at startup. [ issues the I2C start condition, 0x51 is the device read address, “r r” reads two bytes, and ] issues the I2C stop command. The default startup value is 63 (0x3f), one position above mute (datasheet page 2).

I2C>[0x50 0b10101001 0]<–write pot0 210 I2C start CONDITION 220 I2C WRITE: 0x50 got ACK: YES<–DS1807 write address 220 I2C WRITE: 0xA9 got ACK: YES<–pot0 write command 220 I2C WRITE: 0x00 got ACK: YES<–volume to set 240 I2C stop CONDITION I2C>[0x50 0b10101010 64]<–write pot1 210 I2C start CONDITION 220 I2C WRITE: 0x50 got ACK: YES<–DS1807 write address 220 I2C WRITE: 0xAA got ACK: YES<–pot1 write command 220 I2C WRITE: 0x40 got ACK: YES<–volume to set 240 I2C stop CONDITION I2C>[0x51 r r]<–read values back to verify 210 I2C start CONDITION 220 I2C WRITE: 0x51 got ACK: YES<–DS1807 read address 230 I2C READ: 0x00<–pot0 value 230 I2C READ: 0x40<–pot1 value 240 I2C stop CONDITION I2C>

Next, we update each volume pot with a separate command. 0x50 is the DS1807 write address, 0b10101001 (0xA9) is the command to update pot0, and 0 sets the volume to full. The next sequence uses the update pot1 command, 0b10101010 (0xaa), and sets the volume to mute (64, 0x40). Finally, we use the read procedure to verify that the values are correct.

I2C>[0x50 0xA9 64 0]<–write both pot values 210 I2C start CONDITION 220 I2C WRITE: 0x50 got ACK: YES 220 I2C WRITE: 0xA9 got ACK: YES<–update pot0 command 220 I2C WRITE: 0x40 got ACK: YES<–pot0 value 220 I2C WRITE: 0x00 got ACK: YES<–pot1 value 240 I2C stop CONDITION I2C>[0x51 r r]<–read back values 210 I2C start CONDITION 220 I2C WRITE: 0x51 got ACK: YES 230 I2C READ: 0x40<–pot0 value 230 I2C READ: 0x00<–pot1 value 240 I2C stop CONDITION I2C>

The pot 0 write command can also be used to set both potentiometer values with a single command. use the pot0 update command (0b10101001, 0xA9), and  send the pot1 value (0) following the pot0 value (64).

I2C>[0x50 0b10101111 0x20]<–update both pots with the same value 210 I2C start CONDITION 220 I2C WRITE: 0x50 got ACK: YES 220 I2C WRITE: 0xAF got ACK: YES<–dual update command 220 I2C WRITE: 0x20 got ACK: YES<–value to set 240 I2C stop CONDITION I2C>[0x51 r r]<–read back values 210 I2C start CONDITION 220 I2C WRITE: 0x51 got ACK: YES 230 I2C READ: 0x20<–pot0 value 230 I2C READ: 0x20<–pot1 value 240 I2C stop CONDITION I2C>

Finally, 0xAF (0b10101111) can be used to update both potentiometers with the same value. This is probably the most beneficial command for stereo audio volume control where bothच्यानलसँग समान मूल्य छ र एकै साथ परिवर्तन हुन्छ।

के त्यहाँ कुनै चिप्स वा कम्पोनेन्टहरू छन् जुन तपाईं हामीलाई भविष्यका भागहरू पोष्टहरूमा कभर गर्न चाहनुहुन्छ?

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

एप्पलले युरोप र क्यानडामा उत्पाद मूल्य बढाउँदछ, यहाँएप्पलले युरोप र क्यानडामा उत्पाद मूल्य बढाउँदछ, यहाँ

को कारणले गर्दा उनीहरूले हिजो आफ्नो नयाँ कम्प्युटरको लागि अधिक तिर्नै पर्छ अमेरिकी डलरको प्रतिक्रियाले युरोको बिरूद्धको शिष्यलाई देखायो। यस समाचारमा धेरै विवरणहरू यहाँ उत्तम पाउन सकिन्छ। यस विगतमा युरोपमा

बिग्रिएको सलाद स्पिनर मर्मत गर्दैबिग्रिएको सलाद स्पिनर मर्मत गर्दै

हेर्नुहोस् (क्विनको] बिग्रिएको सलाद स्पिनर, साथै आजसम्म सलादको साथसाथै जब अन्य बगैंचा सिर्जना हुन्छ। बिग्रिएको स्मारको मर्मत गर्नको लागि उनी प्रणालीलाई अलग गर्न सक्षम भइन् कि भनेर पत्ता लगाउन हामी

कसरी Google प्ले स्टोर (####) बाट स्वत: ए-अनुप्रयोग अद्यावधिक बन्द गर्नकसरी Google प्ले स्टोर (####) बाट स्वत: ए-अनुप्रयोग अद्यावधिक बन्द गर्न

को 12..5 + million0 लाख अनुप्रयोगहरूको साथ, गुगल प्ले स्टोर दोस्रो ठूलो अनुप्रयोग बजार हो। सबै एन्ड्रोइड उपकरणहरू प्रणाली र ब्लुट अनुप्रयोगहरूको सेटको साथ आउँदछन्। कुन कुराले कुनै पनि अपरेटिंग