Category: DAC

30
Dec

Interfacing a HD44780 LCD with Raspberry Pi over I2C

I have decided to add a 16×2 LCD to my Raspberry Pi 3 based network audio player with PCM1794 DAC in order to see what is currently playing and the bitrate of the output without having to check my phone. I don’t like the number of wires that parallel LCD connection requires so I started looking for a 16×2 LCD with I2C interface which is not too expensive.

I found a very cheap 16×2 LCD on Aliexpress and even cheaper I2C backpack for it. I personally chose green foreground with black background as it looks nice in my enclosure, but there are other options too: https://www.aliexpress.com/item/1709948156.html

First test:

I decided to use LCDproc as it is a mature solution that works (almost) out of the box with HD44780 based displays over I2C, it just needs a driver and proper configuration. It is easy to control it via a telnet-like TCP protocol with Python, PHP, C++ or any other language of choice and it has many options such as managing a scrolling text, widgets, icons etc. which reduced my code to only a few lines.

My Github repository contains everything needed to pair HD44780 based LCD displays and LCDProc on Raspberry Pi via I2C. It includes installation instructions for installing on Moode or other Raspbian/Debian based OS.

  • play.php – My script to fetch currently playing song on Moode Audio and push it to the LCD via LCDProc, you can edit this one to fit your needs
  • client.php – LCDProc PHP client library by Peter Clarke (@theapi)
  • LCDd.conf – My /etc/LCDd.conf which works perfectly with the display linked above
  • hd44780.so – Driver for LCDProc HD44780 I2C displays by @wilberforce. You should copy it to /usr/lib/lcdproc/

I am running Moode Audio v6.2.1 which is based on Raspbian so it should work with any other Debian/Raspbian based OS, and most likely with Ubuntu too. I have written a small script which parses /var/local/www/currentsong.txt (a file automatically updated by Moode) and displays currently playing song/output bitrate info on the LCD. You can rewrite the script to work for any other OS, display size or purpose.

09
Jan

Inexpensive PCM1794 DAC based on a cheap Chinese board

I was in need of a DAC which will be used as my main audio source. The requirements were simple:
– Digital inputs switching. I wanted to use the same DAC whether I am listening from my DIY Volumio streaming device or watching a movie/playing Xbox.
– Of course I also want the best sound quality.

After reading this article, the PCM1794 datasheet and talking to a friend of mine who works in a professional audio equipment manufacturing company I decided to try the PCM1794 from Burr Brown for this project. I did a quick search on Aliexpress for readily available PCBs based on PCM1794 and I came across one that looked well made. The PSU part is well separated utilising:
Four separate transformer windings with 3 bridge rectifiers (MCU+LCD; digital section PSU; analog section PSU)
Five on board regulators (LM7805 for the uC/LCD, LT1968-3.3V for the AK4118 and PCM1794 digital supply, LM317(5V) for the PCM1794 analog VCC, LM317/337(+-15V) for the opamp supply.
Ground planes


The board costs only 47$ so I expected cheap capacitors and probably fake AD827 opamps. After 20 days I received the board. I was right, they used cheap caps(except the big filter Nichicons, which seem good) and the opamps are probably fake at this price so I started planning mods to the board.

The first thing I did was to test the board before doing anything so I know if it works as expected. I plugged in all required windings, plugged my set-top box as digital source with an optical cable and flipped the switch…

F*ck… The thing is not even working…

Chinese PCM1794 AK4118 board

The first thing I did was to measure all the supplies. I found out that the LT1968-3.3 had 2.0V at its output so the AK4118/PCM1794 didn’t get enough voltage to work. I desoldered the LT1968 and soldered a LD1117V33. It finally worked. Good thing is I don’t have to return it to the seller and I can start with the mods.

After inspecting the board and following some traces I have annotated the photo of the board of all planned mods for convenience.

PCM1794 DAC planned mods

I have done the following modifications:

1. Change all big diodes in the rectifier bridge to SB5A0 fast recovery diodes because the old ones were standard Chinese diodes with shady letters on them.

2. I checked all resistor values according to the following OPA1611(single version of OPA1612) schematic and found out that the 8200pF capacitors were actually 220pF(marked on board as 820pF) and the 2700pF were actually 270pF(marked on board as 270pF). Resistor values were right according to this schematic.
OPA1612 as I/V converter
Changed those to Wima FKS2 capacitors with the right values and also changed the 2200pF metallized film capacitors in the feedback of the I/V stage with same value Wima FKS2.

3. Changed all electrolytic capacitors to Nichicon UPS which are low impedance, high temp range capacitors suitable for PSU usage. Some of the capacitors were 47uF instead of the 10uF according to the PCM1794 datasheet.

4. The final thing to do was change two of the AD827(probably fake) to two OPA1612 opamps in the I/V stage and change the third AD827 in the differential to single convertor stage to OPA2132.

PCM1794 AK4118 OPA1612 OPA2132 DAC

I will now let the DAC burn in for a couple dozen hours and I will start listening!

15.01.2019 UPDATE:

Below is a picture of the full setup in a temporary enclosure consisting of the following:
– A DIY AC filter
– 2x15VAC+2x9VAC R-Core transformer feeding the DAC board
– 2×7,5VAC feeding the XMOS reclock and Raspberry Pi
– Raspberry Pi 3 running Volumio fed by a LT1083 + CRC filter PSU(on the black prototype PCB)
– JLSounds XMOS, with it’s reclock fed by an LM317 + CRC PSU(also on the black board)
– The modified chinese PCM1794 board
– An LCD display+MCU+rotary switch that came with the Chinese board used to switch digital inputs and display current signal frequency, considering to remove that and put a white on black OLED connected to the Raspberry to display current song, bitrate, res etc.

While still burning in, the sound of the PCM1794 is amazing. TBH I have never expected such a detailed sound that is still warm and pleasant to listen to from a delta-sigma DAC except for the most expensive Sabre pros. I don’t believe the TDA1541 myths anymore.

The good thing is that the whole streamer/DAC costed less than 250$ including the trafos, raspberry, xmos, memory card, DAC board and all the components for the upgrade. It allows me to listen to music from online streaming services such as Spotify and Tidal, USB SSD and I can still switch to the toslink coming from my TV with one click and use the DAC for Xbox(pass-through) and Netflix.

raspberry volumio xmos pcm1794

I will make a full blog post about the whole streamer/DAC once I am done with lower noise discrete PSUs and the enclosure.

UPDATE 10.02.2019:

As a final update to the DAC board I decided to replace all the analog audio power supply LM317/337 regulators (opamp supplies and PCM1794 AVCC supply) with DIY discrete regulators with very high Power Supply Rejection Ratio and very low outpud impedance in the audio spectrum. The schematic is designed by a friend from our local audiophile forum (Thanks, Sandy!). Some measurements of the discrete regulator:

The red line is the noise of the discrete regulator, the blue line is the self noise of the measurement setup. WARNING: The numbers are offset by 100dB because of the measurement setup, so -30db must be read as -130dB:
Discrete regulator measurements

So the PSRR of the discrete regulator is ~ -125dB.

For comparison, measurements of the previous regulators (LM317). WARNING: The numbers are offset by 60dB because of the measurement setup, so -20db must be read as -80dB:

LM317 PSRR measurements
LM317 measured PSRR: ~ -83dB

Also, the discrete regulator has a lot better reaction to load impulses compared to the LM317/337.

I hate soldering SMD to such tiny boards with my not so good soldering iron but the end result is worth it. A photo with the all three discrete regulators soldered and fit to the board:
PCM1794 Discrete Regulators Fitted

15
Aug

TDA1541 and ECC88 DAC Part 1

It all started a few months ago when I put together a TDA1541+OPA49720 schematic on an experimental board along with a regulated PSU based on LM317/337. The plan was to push the digital signal from PCM2707 to the TDA1541 via I2S. The moment I started this thing I was immediately amazed by the sound of TDA1541, it sounded very warm to my ears and I decided I need to finally build a proper USB DAC, as I listen to all my music collection(FLACs,APEs,WAVs) with my PC as a source.

However, at that time I didn’t have enough time to continue with this project so I put everything in a cupboard and now I decided to finish it finally. The schematics were revised and SPDIF input is now planned along with the USB so DIR9001 is needed.

I found a nice PCB(thanks to Simonov) from my favourite forum Bgaudioclub to move over the parts from the experimental PCB as a PCB is always a better option, especially for audio/video circuits which can easily “catch” RF noises.

Click for the first part of the DAC schematic (before the tubes).

PCB picture:

A forum mate’s implementation as mine is not ready yet. Pictures of my DAC coming shortly.

As for the tube stage I decided to use a CCDA circuit inspired by a post in the diyAudio forum. The SK170 is used to null out the DC voltage offset in the output of the TDA1541. As you can figure out, the OPAMP section of the board above can be obstructed when using a tube output stage like the one I’m writing about. Here is my redraw of the circuit. The output is around 1.2Vpp which is enough for my purposes.

And the PSU:

As you can notice, this PSU has an EMI filter circuit before the transformer. The transformer has 2 secondary windings – 250VAC and 7-12VAC. The anode supply is then filtered and regulated by a capacitor and an IRF840 mosfet. The voltage rises slowly to keep the tubes safe by charging C3 through R14 to a reference voltage created using 4x75V zener diodes(D1-D4) which makes the regulator output 243V after the ~7V dropout of the mosfet. The heater supply is a classic LT1083 regulator circuit. Output voltage must be adjusted to 6.3VDC via R17. If you have a transformer with a 6.3V secondary you can heat the tubes directly from the secondary winding dropping the heater supply part, but that can increase hum.

I use PCM2707 in a standard circuit for a USB to I2S converter, in order to add an USB input to the DAC. A post will follow with pictures and sound quality review when my DAC is completely ready.

Thank you for reading.