Home > Arduino, Code, DIY HiFi > Introduction and Guide to HIFIDUINO

Introduction and Guide to HIFIDUINO

This blog has been sort of a notebook for me to write down my own learning with Arduino and the TPA boards. Therefore the information presented assumes that the reader’ is learning at a pace equal to mine.

Beginners are overwhelmed with the amount of information here so this post is to help those by outlining the basics of building a controller board for the superb kits produced by Russ and Brian of Twisted Pear Audio. TPA is also developing a controller for their products so this is an alternative to their solution utilizing low cost, and widely available parts. (As of July 2011, the TPA controller board in not yet available, so this is the only “ready-to-run” option)

Basically, all modern audio chips have a software interface and they communicate with a micro-controller through a communication protocol called “I2C”. I have chosen the Arduino platform because I am not a programmer and Arduino is geared towards that audience. In addition, the Arduino community provides a lot of help for beginners and non-programmers.

HIFIDUINO is about building a controller that can talk to those audio chips. So far I’ve interfaced to the OPUS DAC with the WM8741 and the Buffalo II boards. But the same platform can be used to interface to other chips such the WM8804 spdif interface.

The controller consists of:

Arduino board

Any official board or clone will work. The current (v.09) code size is about 14K bytes, so even the bottom of the line Arduino will work. All of he following models work: UNO, Dueminalove, Seeeduino v.2.2, NANO and others. I have used the UNO and the Dueminalove.

Rotary encoder

The rotary encoder is used to change volume and settings. In theory, you can use any “quadrature” or “gray code” encoder. However, I find that the preferred characteristics of the encoder are:

  • About 30 cycles per turn. This gives a good “feel” when changing the volume, changing 30 db per revolution -not too fast or too slow
  • Built-switch. The switch is used to change from volume control to DAC settings control. This is not mandatory, you can implement with a separate switch
  • A rotary encoder with “clicks” is preferred because you can feel the clicks when you select the different settings. This is not mandatory but it provides a better feel

I use a Panasonic model that has been discontinued, but available from Electronic Goldmine. Other candidates are: Bourns PEC11, BI EN12. The current version of the code (v.09) does not require that you build a debouncing circuit as the debouncing is done in the software (I had used the rotary encoder without hardware debouncing or a long while, but I finally added the debouncing capacitors). For more information on debouncing, see: link

LCD display

The code assumes a 20×4 LCD. Any LCD that is compatible with the HD44780 protocol will work with the code: Do a search for “20×4 LCD HD44780″ on eBay. The one I purchased is from Sure Electronics. You can also purchase directly from their website: [link].

As it turned out, a large portion of the code is the user interface and it assumes a 20×4 LCD. Thus, if you use a different form-factor LCD (for example a 16×2 LCD, you will have to overhaul a large portion of the code.

IR receiver and a remote control

The code supports the Apple Aluminum Remote. Any IR receiver should work. However, I would recommend the Vishay TSOP34838. Additional information: [link]

A level converter from 5V to 3.3V for the I2C lines

This part maybe optional. As the I2C inputs of the Buffalo are “supposed to be” 5v tolerant, but the data sheet does not say specifically and I have not determined that to be the case with 100% certainty. (You can easily build it if you do not wish to buy the module)

The best use of this project is for you to experiment with your own choice of components and ideas. You can reuse whatever part of the code you wish (as I have reused code from other contributors. -This is the spirit of open hardware and software of the Arduino community). If you do this you will find that the audio hobby is not just about changing cables, capacitors and power supplies :-)

However, if you wish to just replicate what I have done, this is what you do:

  • Get familiar with the Arduino development environment. At the minimum you must know how to compile code and upload to an Arduino. The Arduino tutorials listed in the side bar are a good start.
  • Procure the parts above and hook them up according to the different hookup diagrams in this blog. The current code does not require that you build a debouncing circuit for the rotary encoder so you can skip the debouncing circuit
  • Download the latest version of the code from the code tab. Compile and Upload to the Arduino
  • Done!
About these ads
  1. Davide
    2011/05/11 at 02:24 | #1

    Dear HIFIDuino,

    Thank you very much for posting this project. It was an easy and fun learning experience. I have made some modification to the code to implement the following, an I would be happy to post it to you.
    1) Possibility to choose dual mono or stereo at compile time.
    2) I implemented other buttons of the remote, now I do not need to use the encoder.
    3) On the other end I did not test the encoder.



    • Branko
      2011/07/06 at 11:11 | #2

      Hi, Davide. Would you share your code. I seek for a solution with dual mono support.




  2. Davide
    2011/05/11 at 06:06 | #3

    Dear HIFIDuino,

    I also have a question: you said you were using a transistor to regulate the contrast of the LCD. Why do you need the transistor ? I hooked the cable directly to the Arduino, played a bit with the values and it works fine. But maybe I am missing something.

    FYI my remote has odd codes, changing them was not a big issue. I have the Arduino 3.3V, so I think that in this case the level converter is not necessary. Am I correct ?



    • Branko Tokic
      2011/07/11 at 09:31 | #4

      Hi Davide,

      any progress with the code?
      Would you please share?


  3. BlogGeanDo
    2011/05/11 at 16:56 | #5

    Hello Davide.

    I think I used a transistor to regulate the current for the LCD backlight (the brightness). The contrast, I use a pot…

    Basically you want to control the current going through the backlight. You can connect the GND connection of the LCD backlight to the collector and then the emitter to GND. The gate, through a resistor is controlled by one of the analog pins of Arduino. Varying the voltage will change the brightness.

  4. Anonymous
    2011/07/19 at 07:32 | #6

    This implementation is valid for the new Buffalo III?



  5. BlogGeanDo
    2011/07/20 at 02:17 | #7

    The implementation assumes that the inputs are wired as Buffalo II. Almost everything applies for BIII, you just have to match the input configuration (which spdif input, etc) to the hardware input configuration…

  6. 2011/12/12 at 22:43 | #8


    Is there a way to detect a PCM or DSD R/T sampling rate in WM8741 chip using I2C controls?


    • BlogGeanDo
      2011/12/12 at 22:59 | #9

      No, the WM8741 does not have any register to detect sampling rate. (It can’t even switch oversampling based on the incoming sample rate)

  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


Get every new post delivered to your Inbox.

Join 183 other followers