The TFT HiFiDuino Chronicles: 21 months in the making..

Since the very beginning of my Buffalo III project, I had decided that I would use an Arduino to perform all of the control functions (source selection, volume control, setting of parameters, etc.).

At first I thought that I would just do basic interfacing, that is control the Buffalo by interfacing with the built-in controller. After taking a closer look at HiFiDuino’s work it became apparent to me that direct I2C interfacing was the way to go. Since I wanted to use a better display than the one used in HiFiDuino, I shopped around for a nice color TFT screen. I bought one from Adafruit and got busy. After a few hours of figuring stuff out and coding I got to this point:



The date was March 3, 2012.

On that day I started a thread at announcing my Buffalo controller.

At this point since a number of people had expressed interest in the project I thought it a good idea to look for a less expensive TFT, sourced through Ebay rather than Adafruit. $50 for a 2.8″ TFT is indeed a bit steep. I came across this little gem:


At $20 the price was right, but it was not compatible with Adafruit’s display library so I searched for a compatible library. I came across Harl Henning’s UTFT library which appeared to be exactly what I needed. It was compatible with a large number of TFTs, including the ones that I had on hand. I took care of some signalling issues (the new TFT needed 3.3V signalling but the Arduino Mega is 5V) and proceeded to adapting the code to the UTFT library.
At that time I discovered that HiFiDuino had also just discovered the UTFT library and was planning to use it as well. That was a nice surprise. He had got a hold of a 3.2″ 400×240 TFT which was also available on Ebay so I also ordered one and decided to standardize on that. The date was April 15, 2012. It was Easter.

While waiting for the 3.2″ TFT, I continued my work on adapting the code to the UTFT library. After having tried various fonts, including making a few of my own, I settled on these:


By the end of April the 3.2″ TFT had arrived and I confirmed that it worked. This is what it looked like with no code changes (they would be necessary since I wanted to make use of the total screen real estate).


At that time the weather got pretty warm so I froze all DIY activities for the summer. The DAC was not really finished but it was functional at the time so I was in no rush.
It was not until late November that I resumed the project. The new Arduino Due was becoming available in stores and I was anxious to see whether the improvement in speed would actually translate to real world improvement in Buffalo response times. Before the end of November I had received the Due.


Since the Due was built using 3.3V logic, it was now easier to interface with the 3.2″ TFT and also the I2C lines would no longer need level change to the 3.3V that the Buffalo liked.

At this time I realized that there where 2 obstacles that I had to overcome:

1) The UTFT library was not compatible with the Due.
2) The Due did not have any on-board EEPROM so I could not save my code settings.

The first problem was solved 10 days later when a couple of lovely people at took it upon themselves to make changes to the UTFT library so as to support the Due. The hacked version of the library worked like a charm. I was very impressed with how little time it took these guys to adapt the library.
The second problem I tackled on my own, by adding a 24LC256 EEPROM chip to the design and adapting the code.

This is when I first came up with the idea of designing a custom shield for the controller. It would accommodate the 24LC256 as well as the necessary parts for electrical isolation between the Arduino and the Buffalo.

By mid January I had made sure that my code ran equally well on the Due as well as on the Mega, so I thought that I would produce a short video demonstrating the difference in processing power. That video has since gotten more than 2.000 views per month. Here it is:

By the end of February I had proceeded with polishing the code and had a rough draft of the shield.

About a month later I had a (nearly) working prototype of my new shield:


At that time, once again, the weather got too good for DIY so I suspended the project until September.

While I was on summer leave I got a little bored so I resumed the project. It moved along pretty fast, and soon I had a final version of the shield:


..and a v.1.00 of the code:


I proceeded to release the actual code and schematics for the shield on September 3 & 7 respectively, as well as some basic instructions on building it.

The next step was to make the code more Buffalo-III SE friendly, since most people buying Buffalos were going for the SE. I had one last request: to give the option of always-on, in other word to make it possible to bypass the “on/off” portion of the code. That was pretty easy to implement. At last, I made a few aesthetic changes. The end result was v1.06b, released at December 11, and it looked like this:

IMG_6903_fix_&_crop_res IMG_6905_crop_res

(the above screens are from the Buffalo-III SE version of the code)

And that’s it so far.

Buffalo Shield revision for B3SE

As I said, I will release a new revision of the Buffalo shield that will have better support for the B3SE.

Since that will probably take some time, in the meanwhile, this is what B3SE (or 32s or II) owners should do to their shields in order to support the B3SE:


The idea is to connect the photosensor side of one of the optoisolators directly to the IP_S header on the B3SE. In order to do that, you will have to cut one trace on the PCB and solder directly onto one of the optoisolator’s pins. That’s pretty much it.

On the new revision of the shield there will be a jumper where you have to cut the trace plus an extra pin so that you don’t have to solder onto the isolator’s pin.

Buffalo Shield v.1.1 for TFT HiFiDuino

Following my previous post on TFT HiFiDuino v.1.00, this is what you need to know in order to build my Buffalo Shield.

First of all, here are the DipTrace files (schematic & PCB): Buffalo Shield v.1.1 for TFT HiFiDuino (schematic & PCB) (10265 downloads )

And here is the relevant build & wire guide: Buffalo Shield v.1.1g for TFT HiFiDuino (documentation) (7097 downloads )

This is what DipTrace thinks the board ought to look like:

And this is what it actually looks like:

Close enough..

This shield features:
– Galvanic isolation for the I2C signals as well as 2 digital outputs (Arduino -> Buffalo) and 1 digital input (Buffalo -> Arduino).
– EEPROM chip (24LC256) either in SMT or DIP footprint.
– Backlight control for the TFT through a PWM-controlled transistor.
– Headers for two rotary encoders.
– Output for power relay (for remote on/off).
– Header for IR receiver.

This is the schematic for the shield:

And this is the resulting PCB:

This is a description of the various headers:

IR: Use a standard 38KHz IR Receiver Module, like the TSOP4838.
1: Signal (Pin 9)
2: GND
3: 3.3V

RotaryEncoder1: Use any simple rotary encoder.
1: Left pin (Pin 7)
2: Right pin (Pin 6)
3: Selector pin 1 (Pin 5)
4: Middle Pin & Selector pin 2 (GND)

RotaryEncoder2: Use any simple rotary encoder.
1: Left pin (Pin A3)
2: Right pin (Pin A4)
3: Selector pin 1 (Pin A3)
4: Middle Pin & Selector pin 2 (GND)

1: SDA
2: SCL
(note: this is the I2C connection to the Arduino. SDA should be connected to pin 20 and SCL to pin 21)

1: GND
2: SDA
3: SCL
(use this if / when an isolator IC (U2) is not used to send the I2C signal to the Buffalo)

1: Out 1 (Pin A2)
2: Out 2 (Pin A7)

1: TFT Backlight LED (dimmed by Pin 8)
2, 3: 3.3V (for TFT power & pin RD)
4: GND

1: GND
2: Vin (8V-12V)
(connect here the power supply to the Arduino)

1: GND
2: 3.3V out (Pin A0) in case of Due, 5V in case of MEGA
(connect here the power relay that powers on the DAC)

1: Buffalo Vcc (3.3V)
2: SDA
3: Sidecar Control (Pin 3)
4: Lock LED input (Pin A1)
5: SCL
6: Buffalo GND