Home > Arduino, Code > Updated Code for Buffalo II DAC

Updated Code for Buffalo II DAC

January 10, 2011 Leave a comment Go to comments

This new version supports both SPDIF and I2S/DSD input (in accordance to Buffalo II input wiring)

  • At power-on, the controller defaults to SPDIF input. You can select the default mode by changing a variable in the code
  • Manual selection of SPDIF or I2S/DSD
  • When selecting SPDIF, the DPLL bandwidth defaults to “lowest”
  • When selecting I2S, the DPLL bandwidth defaults to “best”
  • These settings have been empirically determined to be the best for each interface. They can be also manually changed.


  • NLCK  indicates that there is no input signal or the DAC cannot lock into the signal
  • When there is no input signal, the input selection (left arrow) is displayed: SPDIF or I2S/DSD. The left arrow indicates input selection, not the actual signal
  • SR is the incoming sample rate; it displays zero when there is no input signal
  • Fi is the PCM filter setting: Sharp roll off or Slow roll off
  • Jt indicates whether the jitter eliminator is engaged or not
  • PL indicates the DPLL bandwidth setting

  • “LOCK” indicates that there is a signal and the DAC is locked into that signal
  • When there is a valid signal, the type of input signal is displayed: I2S, SPDIF or DSD (no left arrow indicates the actual signal type)
  • The sample rate is calculated to the 1 Hz resolution and displays correctly whether the signal is I2S or Spdif
  • In display mode, only the volume can be changed. Volume can be adjusted from -99 dB to 00 dB and can be independently changed with the knob or the remote control


  • Pushing down on the rotary encoder (the knob) will engage “select mode”. A  side bar is displayed to the left of the screen to indicate that you have entered “select mode”
  • Every push of the knob will move down the arrow to indicate the parameter that can be changed
  • IN: input selection. The user can select SPDIF or I2S/DSD
  • Fi: PCM filter selection. The user can select fast roll-off or slow roll-off
  • Jt: Jitter eliminator switch. The user can select ON or OFF
  • Pl: DPLL bandwidth selection. The user can select “Be” (best), “<L” (lowest), “L” (low), … all the way to “>H” (highest)
  • If there is no selection activity for a few seconds, the controller reverts to DISPLAY mode. This time out can be adjusted in the code


  • Up button (1) increases the volume 1 db at a time. Holding the button down will continuously increase the volume
  • Down button (3) decreases the volume 1 db at a time. Holding the button down will continuously decrease the volume
  • The rest of the buttons are not currently mapped to any function, but there is support in the code to read all the buttons
  1. January 10, 2011 at 13:32

    Hi glt,

    Does this use the same method of volume control as the volumite?

    Are you using a motorised pot as well, or are you only using remote control?


    • Hifiduino
      January 10, 2011 at 17:15

      Hi Phil,

      Yes, it uses the same method as Volumite as the software interface is dictated by the DAC chip.

      The design uses a rotary encoder. Rotary encoders do not have absolute position but can freely rotate either way. Because of this, I don’t have worry about moving the volume knob when changing the volume with the remote control. You can change the volume with either the knob or the remote. The value of the current volume is always indicated in the display.

      • January 11, 2011 at 14:50

        Learn something new every day!
        That is genius :p

        Cheers mate🙂

  2. Russ White
    January 10, 2011 at 15:34

    Good work!🙂

    • Hifiduino
      January 10, 2011 at 17:10

      Hi Russ, thanks!

  3. Matt
    January 11, 2011 at 08:01

    Thank you for sharing this code, it’s really helpful! I am using the TPA 4:1 Mux receiver (http://www.twistedpearaudio.com/digital/cs8416mux.aspx) to use additional inputs (2 Toslink, 1 Coax and 1 USB).

    I suppose I can map another button on the remote to an additional Arduino function to select the right input. Any specific thoughts on this? You might have a smart suggestion I didn’t think of. Your input is much appreciated.
    Thanks again!

    • Hifiduino
      January 11, 2011 at 19:02

      You are welcome. Yes you can map any of the buttons of the remote to do something else (I’ve only used 2 of the 7 buttons in the remote). In the case of selecting an input, you don’t want to use the “repeat” codes of the button.

      The apple remote uses the NEC protocol where holding down the key will generate repeat codes. With this remote, this happens quite fast. When you code the selector button you will want to ignore the repeat codes (ignore holding down the button) and only act upon a click.

      You can also use one button to cycle over all the input choices. Look at the part where I select the DPLL bandwidth.

      Hope this helps…

      • Matt
        January 11, 2011 at 21:47

        This definitely helps. I’ll share my results once I’m done with the update.

    • Branko
      May 26, 2011 at 21:45

      Hi Matt,

      any progress with the Mux I try to do the same but would need some help to start. would there be any way to show the input 1 to 4 in the hifiduino display (spdif 1 ;spdif 2 … or maybe input: CD, input: TV …)?

      • Matt
        May 31, 2011 at 05:59

        Hi Branko,

        This project is still on my table, but work has kept me from finishing it.
        Basically you will need to add some programming to select the right input for the Mux (00, 01, 10, 11). You can assign a value to every input and send that information to the screen (comparable to the way the original code is sending text to the display).
        I don’t have this code yet, but let me know if I can be of any help. I’m sure many others will be able to support you as well.
        Happy programming!

  4. January 12, 2011 at 05:52

    Love your blog and info. Very useful.

  5. guglielmo
    February 4, 2011 at 21:54

    Hello, after all your tests which is in your opinion the best Arduino to start to program my ES9008 Dac?I’d like to start with your code.
    Thans for your interesting blog.

    • BlogGeanDo
      February 4, 2011 at 22:05

      Hi Guglielmo,

      All “Arduinos” are basically the same. If you are not interested in saving a few bucks, I would go with the UNO. It is also the fastest when uploading code (you save a few seconds :-)). If you wish to save a few bucks, then go for the Seeeduino clones. The code I’ve developed is less than 10K bytes in size. The earliest Arduinos can accomodate 14K of code and the newer Arduinos, 32K of code.

  6. Antonio
    April 20, 2011 at 10:42

    Thanks for the great resources you are providing us with.

    Just a little help to me, if possible. I’m looking for the best components (hardware and software) for implementing a switch s/pdif – I2S for my buffalo-II dac.

    this code is a great resource. But I need hardware also… is there anybody that would like to write down a list of the best hardware componets to buy?

    Thanks in advance


  7. BlogGeanDo
    April 25, 2011 at 19:16

    What kind of hardware components are you referring to?

    • Antonio
      April 25, 2011 at 19:55

      display, arduino boars and harware switch. I already have the Buffalo II DAC, but I miss all the components necessary in order to implement the I2S / Spdif switch.
      I was looking for a kind of ‘list for dummies’.
      Thanks for your help.

  8. BlogGeanDo
    April 25, 2011 at 21:43

    There is a guide here: https://hifiduino.wordpress.com/2010/12/08/introduction-to-hifiduino/

    An I2S/SPDIF switch can be implemented with a 4-pole relay, similar to TPA’s OTTO

  9. Antonio
    April 26, 2011 at 09:02

    BlogGeanDo :

    An I2S/SPDIF switch can be implemented with a 4-pole relay, similar to TPA’s OTTO

    This would be the best solution for me, but I was thinking this not possible beacause I2S and Spdif have different deep switch settings on Buffalo-II and because this DAC has not been designed for ‘on-the-fly’ switch.
    It is not this way?
    Thanks for your support.

  10. BlogGeanDo
    April 26, 2011 at 19:01

    It will work if you use ttl-level (3.3v) spdif. Let me do some digging to see how would it work with consumer level spdif because you need to use the level translator in the Bufffalo II board

    • Anonymous
      April 26, 2011 at 19:24

      Thanks, I appreciate!

  11. BlogGeanDo
    April 27, 2011 at 00:49

    I wrote in this post: https://hifiduino.wordpress.com/2010/12/17/musiland-mini-i2s-to-buffalo-ii-dac/
    “You must have a TTL-level SPDIF and bypass the comparator (SPDIF switch set to “OFF” or “1″) for this to work. If you pass the SPDIF signal through the comparator (SPDIF switch “ON” in the DAC), then I2S will not work because the comparator is also feeding pin D1, and even if there is no SPDIF signal, the comparator will hold Pin D1 low.”

    So if you want to switch between i2s and consumer spdif, then the single relay method will not work. For this to work you will have to use another relay (a single pole) to automate the comparator switch

  12. BlogGeanDo
    April 29, 2011 at 21:54

    Here is a better way to switch I2S and consumer SPDIf with one 4-pole relay: Leave the comparator switch off, tap the boosted SPDIF from the input side of the comparator switch and use that as the input to the relay

  13. September 14, 2016 at 14:49

    free porn

  14. September 14, 2016 at 15:11

    thai massage dublin

  15. September 14, 2016 at 16:18

    internet praszka

  16. September 14, 2016 at 17:00

    Modern sofas

  17. September 14, 2016 at 18:11

    gdc interiors

  18. September 14, 2016 at 18:13

    soundcloud plays free

  19. September 14, 2016 at 18:43

    Pokrov spiritually religious movement

  20. September 14, 2016 at 19:06

    Custom patches

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s