Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Login


Options
View
Go to last post Go to first unread
Possum  
#1 Posted : Tuesday, May 4, 2021 9:57:50 PM(UTC)
Possum

Rank: Member

Groups: Member
Joined: 8/5/2012(UTC)
Posts: 208
Australia

Thanks: 4 times
Was thanked: 16 time(s) in 14 post(s)
Added remote debugging/monitoring, helper libraries for power relay/DAC reset, volume control pot (both motorised and non-motorised) and also includes common events such as lock acquisition and automute detection to make writing custom implementations easy.

https://github.com/possum64/BuffaloDAC

Below is all the code you need to implement a dual mono setup with volume control and lock detection:

// Arduino analog pins
const byte VOL_ANALOG_INPUT_PIN = 0;

// Arduino digital pins
const byte POWER_RELAY = 3;
const byte DAC_RESET = 13;

#define NO_OF_ES9028_DACS 2
ES9028 leftDAC = ES9028("Left Channel", ES9028::MonoLeft);
ES9028 rightDAC = ES9028("Right Channel", ES9028::MonoRight);
ES9028 es9028dacs[NO_OF_ES9028_DACS] = {leftDAC, rightDAC};
DACControl dacCtrl = DACControl(es9028dacs, NO_OF_ES9028_DACS);
DACVolumeControl dacVolCtrl = DACVolumeControl(&dacCtrl, VOL_ANALOG_INPUT_PIN);

bool configDAC(ES9028* dac)
{
dac->mute();
dac->setSerialBits(ES9028::Bits_24);
dac->setInputSelect(ES9028::InputSelect_SPDIF);
dac->setAutoSelect(ES9028::AutoSelect_Disable);
dac->setFilterShape(ES9028::Filter_Hybrid);
dac->setAutoMute(ES9028::AutoMute_MuteAndRampToGnd);
dac->setAutomuteTime(100);
dac->setGPIO1(ES9028::GPIO_Automute);
dac->setGPIO2(ES9028::GPIO_StandardInput);
dac->setGPIO3(ES9028::GPIO_StandardInput);
dac->setGPIO4(ES9028::GPIO_Lock);
dac->setDpllBandwidthSerial(ES9028::DPLL_Lowest);
dac->setVolumeMode(ES9028::Volume_UseChannel1);
dac->setAttenuation(25);
return true;
}

void eventLocked()
{
digitalWrite(LED_BUILTIN, true); // turn the LED on if both DACs locked
}

void eventNoLock()
{
digitalWrite(LED_BUILTIN, false); // turn the LED off if either DAC not locked
}

void setup() {
// initialize digital pin LED_BUILTIN as the DAC lock light.
pinMode(LED_BUILTIN, OUTPUT);
dacCtrl.initES9028(configDAC);
dacCtrl.setPinPowerRelay(POWER_RELAY);
dacCtrl.setPinDACReset(DAC_RESET);
dacCtrl.onLock(eventLocked);
dacCtrl.onNoLock(eventNoLock);

dacCtrl.powerOn();
}

void loop() {
dacCtrl.loop();
dacVolCtrl.loop();
delay(10);
}

Edited by user Tuesday, May 4, 2021 9:59:23 PM(UTC)  | Reason: Not specified

thanks 1 user thanked Possum for this useful post.
vc1Xvc2 on 8/25/2023(UTC)
ghekko  
#2 Posted : Wednesday, May 5, 2021 5:56:01 PM(UTC)
ghekko

Rank: Member

Groups: Member
Joined: 6/29/2014(UTC)
Posts: 4
United Kingdom
Location: UK

You added volume control using motorised pot. excellent!
I think i'll have to to give this a go on an 8-channel ES9038 board.
Strangely i see replies against the other post about 8-channel BIII replacement were deleted??
Possum  
#3 Posted : Thursday, May 6, 2021 6:53:05 AM(UTC)
Possum

Rank: Member

Groups: Member
Joined: 8/5/2012(UTC)
Posts: 208
Australia

Thanks: 4 times
Was thanked: 16 time(s) in 14 post(s)
Motorised pot is as easy as:

// specify pins for motorised pot
DACVolumeControl dacVolCtrl = DACVolumeControl(&dacCtrl, VOL_ANALOG_INPUT_PIN, VOL_MOTOR_PIN1, VOL_MOTOR_PIN2);

I've used it with a 10K Alpine motorised pot modded to give 5K

I also have an infrared control library and miniSHARC control

Edited by user Thursday, May 6, 2021 7:00:53 AM(UTC)  | Reason: Not specified

ghekko  
#4 Posted : Monday, May 10, 2021 4:08:34 PM(UTC)
ghekko

Rank: Member

Groups: Member
Joined: 6/29/2014(UTC)
Posts: 4
United Kingdom
Location: UK

That's very helpful. Thanks for making your work available in the community.

Infrared library - works with apple remote?
Modded potentiometer - out of interest, why modded to 5k? I've always assumed the BIII converts the linear profile to log internally.
I am using miniSHARC so this is also of interest.


I'll need to check out the code.
Thanks!
Possum  
#5 Posted : Saturday, May 15, 2021 6:45:17 AM(UTC)
Possum

Rank: Member

Groups: Member
Joined: 8/5/2012(UTC)
Posts: 208
Australia

Thanks: 4 times
Was thanked: 16 time(s) in 14 post(s)
"Infrared library - works with apple remote?"

I haven't updated it for awhile - was doing some IR stuff recently and noticed the IR Remote lib has been significantly updated for more modern devices that use both an IR address and code - so may need a refresh


I tested volume code with the 5K pot from TP. Alpine pots make 10K stereo which when paralleled make a 5K pot so they were interchangeable - spent a bit of time on the arduino code to get the feel and range right. Its the code that converts from voltage drop across pot to attenuation of DAC. I use bit shifting to do the conversion - which works really nicely with a 5K pot.

I have miniSHARC code that sets its attenuation and selects the config - however, you cannot do this directly with an ESP8266 WiFi board as it cannot act as an I2C slave (like a normal arduino can) - so I use an arduino Nano as a bridge between ESP8266 and miniSHARC

If you get the basics up and running am happy to lend you a hand with getting IR and miniSharc code going for you
Possum  
#6 Posted : Saturday, May 15, 2021 6:49:16 AM(UTC)
Possum

Rank: Member

Groups: Member
Joined: 8/5/2012(UTC)
Posts: 208
Australia

Thanks: 4 times
Was thanked: 16 time(s) in 14 post(s)
PS: I am using MQTT for home automation incl. control of sound system - no need for remotes anymore - just use your phone, tablet, or voice commands to change SHARC config, attenuation, power etc.
Rss Feed  Atom Feed
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.