Code was missing
“#include <pins_arduino.h>” under Libraries.
For some reason copying html from the Arduino environment and pasting into wordpress will result in missing that part of the code. I have added it to the code just now.
I also copied the fixed code and pasted it in a blank sketch in Arduino and compiles fine.
Let me know if you find any bugs (use the comments section)
Advertisement
Thank you very much for sharing your great job.
I found that sample rate showed in my Arduino isn’t correct.
In the comment of your code, you specified the way you calculate it in reference to 80mhz clock for the Buffalo.
My Buffalo have a 100Mhz clock, and I believe that this is the reason why I got a wrong number…
I’ve modified the DPLLNUM variable, but still can’t get the correct number.
What number are you using for the calculations and what number do you get for the sample rate?
I’m using I2S input and the formula is 2^32*64/100,000,000
the result is 2748 and I modified the original DPLLNUM accordingly
At this point the sample rate I get is 47995
That is a valid value: 48,000 Hz (a 5 Hz deviation is normal)
Thank you very very much for sharing your great project.
I tried to build HIFIDUINO using Arduino nano because want to fix the ‘I2S problem’ of buffalo dac, now I can fix the trouble.
Thank you very much.
But now I have a problem.
Turn on the power switch for Arduino nano, I can control Volume or other function by rotary encoder.
But playing music for a while, I can not control any function by rotary encoder.
if turn off and on the power switch, I can control again but can not control for a while.
Do you have any suggestion?
Looks like the code is hanging somewhere. Have you modified the code? The display has a “heartbeat” symbol that “flashes” every 2 seconds. If that is still moving, then the software is running. If that stops, then the software has hanged somewhere.
Hi,
Thanks for your quick reply.
I have two Mod point for your sketch.
One is I2S is default setting for digital input, another is the volume default setting.
So I tried to re-setup my Arduino nano using your sketch with only one change.
(The change is I2S is default setting for digital input.)
Now I test the board, there is no problem.
Maybe the Volume setting Mod is wrong.
Thank you very much.
You can send me the code you modified and I can take a look. hifiduino — yahoo -dot- com
Thanks!!
Now the arduino is enough stable, so if there is some problem about new sketch, I send you by e-mail.
Thanks again for your kindness!!
Hi again,
I’ve a problem with remote control. I’m using the Apple remote, but I’m not able to let it work. I’ve tested the remote with IRremote library and IRtest sketch, and can see the remote working on the serial monitor window. Everithing else is working fine, only the remote routine is failing, and do not change volume.
Hello, can you give more info?
Several users have implemented the code as-is and the remote works well.
Are you using the Apple aluminum remote? Also, when you use the IRremote library, do you get the correct codes from the remote?
Yes I’m using the Apple alluminium remote I just bought. (Model MC377Z/A)
I’ve checked the codes, and they are different.
here are some:
Up = 77E15016
Down = 77E13016
Left = 77E19016
Right = 77E16016
Hello,
For my remote I get:
Up= EE 87 0B 58
Down = EE 87 0D 58
I only use the third byte (which is the only one that is different). (-In the code I use decimal values)
You can change the code to the codes you get. Notice that it is only the third byte that changes. 0×50 and 0×30 are the two values you use
This is the code you will change:
while(digitalRead(REMOTEPIN)==LOW){
if((IRkey=getIRkey())==255){
// Do nothing
}
else {
if(IRkey==0){ // Repeat
IRkey=previousIRkey;
}
else { // New command
previousIRkey=IRkey;
}
}
switch(IRkey){
case 11: // 11 is the up key, we will use for volume up
if (currAttnu>MINATTNU) // Check if not already at minimum attenuation
{
currAttnu-=2; // Decrease attenuation 1 dB (increase volume 1 db)
setSabreVolume(currAttnu); // Write value into registers
printTwoNumber(13,currAttnu/2); // Divide by 2 to print in whole dBs
}
break;
case 13: // 13 is the down key, we will use for volume down
if (currAttnu<MAXATTNU) // Check if not already at maximum attenuation
{
currAttnu+=2; // Increase 1 dB attenuation (decrease volume 1 db)
setSabreVolume(currAttnu); // Write value into registers
printTwoNumber(13,currAttnu/2); // Divide by 2 to print in whole dBs
}
break;
}
} // End of remote control code
change
“case 11″ to “case 0×50″
“case 13″ to “case 0×30″
Well, I made the change as per your suggestion, but still doesn’t work. Then I activate the debugging function on your sketch and opened the serial monitor. With surprise I found out that the code I get are the same as yours but the third bit is different. I got 0A for up key and 0C for down key. Using these code (case 10 and case 12) the remote work fine.
I don’t know why using the Irtest from IRremote library I got the first series of code I reportet to you….
Again thank you very much for your precious help
Hmmm, that is very strange. Why would the remote emit different codes?
I did buy an Apple TV2 a while back and the remote that came with it did not work. I went to the store and got a new one and that one did work. Perhaps that remote had the different codes.
If it is not too much trouble, do you mind getting all the codes for all the buttons in your remote? … Thanks.
Here are the codes:
UP EE870A68
DOWN EE870C68
LEFT EE870968
RIGHT EE870668
CENTER EE875C68 EE870568
MENU EE870368
PLAY EE875F68 EE870568
Ciao
Hi, my Apple aluminium remote didn’t work from day 1 but I didn’t bother since its function was limited to volume control until I saw the latest post about the “odd” remote which was hex 0A and 0C instead of 0B and 0D for volume up/down. So I just changed the s/w to “case 10″ and “case 12″ from the original ‘case 11′ and ‘case 13′, and bingo the remote is in order now.
Hello LH,
Thanks for reporting. That “odd” seems to be a real feature. Perhaps there are two sets of code: one for US market and one for International markets…
Pingback: Apple Remote Codes « H i F i D U I N O
I
Few days ago my remote stop working. I’ve checked everything and at the end I used the monitor to see if arduino was receiving the code correctly.
It was…..but hey….how came….my remote now is sending different code.
My remote now is sending the same code as your.
After several month of use I had to change the code to the default ones.
My guess is that there must be some key sequence on the remote that will change the code set.
That is very interesting. Thanks for the info!