Go Down

Topic: Need tip for digital volume control/potmeter (Read 2 times) previous topic - next topic

dc42

PS - you could also try:

1. Adding a 500ms delay before you send the C0 command (the datasheet says it needs at least 200ms).

2. Adding a short delay (maybe 1ms) between sending the C0 command and sending the set-volume command.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

hansibull

WOW! I hooked up a little opamp and the IC is working like a charm! THANKS ALOT dc42!
But when I'm going to build this in to my amp, should I use high quality components, and use the exact the schematic in the datasheet?
Now I'm going to test the the code in the beginning of this post! :D
again, THANKS!

dc42

#17
Mar 18, 2013, 09:24 pm Last Edit: Mar 18, 2013, 09:27 pm by dc42 Reason: 1
I'm glad you got it working! Most components are of adequate quality these days, and following the example schematic in the datasheet is a good idea unless you really know what you are doing.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

hansibull

#18
Mar 18, 2013, 09:42 pm Last Edit: Mar 18, 2013, 10:23 pm by hansibull Reason: 1
I've tested a bit, and the IC is still working great! I only got one question.
I've decided to use this code, because it's simple and understandable (the other one had this "current_value" thing, that I didn't got working.)
Code: [Select]
  void set_volume(uint8_t value) {
  uint8_t tens = value / 10;
  uint8_t ones = value % 10;
  Wire.beginTransmission(PT_ADDR);
  Wire.write(0b11010000 | tens);
  Wire.write(0b11100000 | ones);
  Wire.endTransmission();
  }


if I put the value to zero, set_volume(0); , the volume at maximum, 0dB. If I put the value to 70, set_volume(70); , the volume is at minimum, -70dB. How can I turn this around, making set_volume(0) minimum and set_volume(70) maximum?

dc42

Code: [Select]

void set_volume(uint8_t value) {
  value = 70 - value;  // added this line
  uint8_t tens = value / 10;
  uint8_t ones = value % 10;
  Wire.beginTransmission(PT_ADDR);
  Wire.write(0b11010000 | tens);
  Wire.write(0b11100000 | ones);
  Wire.endTransmission();
  }
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

SouthernAtHeart

Could you post the completed schematic & finished code you have used to  get this working successfully. I too am looking for a volume control to put inline with a microns, controlled by an atmega chip.

Go Up