Ultimate stereo amplifier

Building a home hifi component from scratch was a very early dream. There was finally an excuse to do it.

Similar projects worth following
In August 2016, the 16 year old, bulky Yamaha HTR-5230 was dying. It took $16,000 of real estate. It ground looped randomly, put out a flamethrower of heat, & didn't have a working volume control for the several years. The Yamaha was the pinnacle of amplifiers, at $400 in 2001 dollars. Its Dolby pro logic, effects, & subwoofer brought true memories, even if it sounded flat. The center speaker amplifier soon stopped working. The space for 5 speakers ran out. It became clear the lion kingdom would never afford a space suitable for using the subwoofer. By 2010, it was down to 2 speakers & never used for anything but amplification.

It had been nearly 20 years of buying cheap commercial amplifiers or hacking things together, just to get good enough audio from the PC to not require a separate home theater. They all died quickly. Building a hi fi component from scratch was no longer a dream but a practical solution.


The amplifier section

The decision after decades of planning to make something custom out of old MOSFETS, reading comments on the DROK, & a brief dreams of tubes, was to invest in a bog standard STA540 from $parkfun. It would also be the most compact.


Reworking the HTR-5230 begins

Analog input proved too noisy. Reviewing the available datasheets for the HTR-5230 revealed the TOSLINK input could be extracted from it for use in another amplifier. The dual TOSLINK inputs were multiplexed into a single input by a simple voltage level. The single input went into the 1988 era YM3436 which converted it to I2S. This was configured by simple mode select pins. 

The I2S went into the 1999 era CS4227 which had the DAC. The I2S was routed through the undocumented YSS908 to process the special effects. It could easily be hotwired to bypass the YSS908. 

Everything uses 5V at a fairly high current. The CS4227 is configured for SPI. You can see data on the AD1/CDIN line when changing inputs. CDOUT isn't connected. CCLK goes at 100khz & sends 2 bytes when changing inputs. CS is erratic.

The initialization merely sets the attenuation registers. Their default is 127

reg value
4 -> 5
5 -> 5
6 -> 13
7 -> 13
8 -> 13
9 -> 23

The analog out after attenuation is 1.8V-2.8V. It goes to a butterworth filter recommended in the datasheet, but requiring +/- 25V. The butterworth filter needs a fairly high current & generates a lot of heat. The final output is -3.3 - 3.3V. The filter GND needs to be raised for it to have a chance.

The filter ground fortunately had very few connections. The 1st step was disconnecting the filter ground from the logic ground, which required lifting a few caps & cutting a few traces, but it was perfectly happy. 

The next step is reversing the direction & removing some caps before raising filter GND to 5V. Also very important to look for any other parts which might explode.


It came together manely as expected. The mane difficulty was getting the STA540 to work. For the STBY pin, the datasheet says MAX V for play is 1.5V, MIN V for standby is 3.5V. In reality, STBY needs to be pulled up for play & grounded for standby. Trap for young players.

The CS4227 needed a substitute microcontroller to initialize it, as expected. Quite a few more registers had to be set in a certain order to initialize it, which weren't sniffed by the oscilloscope. The YM3436 needed a few pins biased, as expected. Traces had to be cut. The mane challenge was both chips needed reset to be low for a certain time after powering up. The YM3436 wouldn't initialize if reset started out high.

The complete DAC took a lot of power. The +25V rail wouldn't initialize when connected to the 10V regulator. The 10V came from a 5V regulator with a 5V virtual ground, but the +25V rail started below 5V. The regulator seemed to detect the +25V rail starting below its virtual ground of 5V & shut down by some kind of SCR latchup. +25V ended up connected to the raw 12V. The 5V virtual ground initialized properly. 

The total quiescent current with the power amplifier & DAC was an insane 0.35A. The 2 5V regulators got quite hot. The STA540 needed a large heatsink. The mane problem when playing sound was the DAC needed its ground connected directly to the ground on the STA540. Connecting it anywhere else on either the signal or power ground caused distortion. Connecting to either signal or power ground on the STA540 worked, so the DAC being a DAC went to the signal ground.

This circuit definitely made less 60Hz hum & noise than the HTR-5230. The Baxandall from Elliot sound projects worked much better than the EQ in the HTR-5230. Despite doubts, the decision was made to max out both treble & bass. Put in a single turn pot for the bass to make it easier, but left treble as a multiturn since it would never change.

The distortion experienced on 8/21 ended up being from the op-amp. The LM324...

Read more »


Generate the SPI sequence to initialize the CS4227 from the Yamaha. Someone may find it useful, in another universe.

Assembler Source File - 3.87 kB - 12/28/2017 at 05:19


inc - 26.79 kB - 12/28/2017 at 05:18


  • Reducing noise

    lion mclionhead02/27/2023 at 05:23 0 comments

    A jumper from GND to the switch panel ended up killing all the noise.  It didn't stop the growing number of spontaneous power downs.  The panel seemed to be an antenna.  If it wasn't metal, the volume control might need a ground.  The apartment gained a house 12V power supply which would greatly simplify the amplifier.  The tricky part is the wiring from the amplifier to the apartment 12V.

    A living breathing Yamaha HTR-5230 was spotted in the wild.  It must have been on fleebay, since those are incredibly obsolete.  It must have been rarely used.   It made lions miss their more luxurious past of full sized stereo components & $900 rent.  Who knows if all its relays, copper, & heat made the sound any better. 

    Regaining 6 channel pro logic of the past could be a goal.  The rear speakers would have to go on the ceiling.  The center speaker would have to be an over monitor deal.  The subwoofer could bolt on the desk but it wouldn't leave room for sitting.

    When lions had the 6 channel system, they wore glasses full time & sat away from the monitor.  That's why it worked.  Since then, they sit right up against the monitor. 

  • Increasing glitches & a path towards USB

    lion mclionhead08/30/2020 at 00:25 0 comments

    The amplifier followed the path of so many other amplifiers, with increasing glitches over the years.  The lion kingdom could do better.  There's now a 12V brick which could replace the flaming hot 12V regulator.  The recycled HTR-5230 parts which convert TOSLINK to analog have randomly shut down with increasing frequency.

    The plan was to go to an STM32 based USB soundcard.  Since then, the lion kingdom has made sound recorders using a raspberry pi zero W for storage & networking.  They use an STM32 for audio sampling.  Such a thing could use the STM32 to convert USB to a DAC & feed digital audio to the raspberry pi for recording. 

    It would go a step further, implementing dynamic range compression in the STM32.  The raspberry pi would present a front end over wifi, with VU meters, realtime processing options, recording options, but not EQ.  The lion kingdom has only ever had the EQ in a fixed position.

    This might be combined with the CP-33 upgrade to wifi recording.

  • 24 bit 96khz upgrade

    lion mclionhead01/15/2018 at 20:46 0 comments

    After spotting the guy on gootube who said it took only 3 hours to make a USB audio device out of an STM32F4, the decision was made to do it.  The TOSLINK cable evolved out of a need to use the Yamaha intact & defeat power line noise, originally.  The black & green boards were the parts from the Yamaha required just to go from TOSLINK to analog.  

    A custom USB board would be the most efficient way to expose an I2S output so the audio could be sniffed & go to 96khz.  A big win is being able to plug it into a laptop or a raspberry pi.

    Sniffing audio with any software solution wouldn't allow mixing it in a headphone monitor.  

    192khz seems rather pointless for its use.  

View all 3 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates