Turtle Bitch: an USB audio system for gaming

The amount of hobby projects I start, or let alone finish, has decreased quite a bit since I started my professional career. Nowadays my projects are usually things that do not exist in a market, or that only exist in an unsatisfactory form. This project falls into the first category; given the vast increase in the amount of gear marketed towards the gamer community I am still perplexed why I had to build this USB DAC / amplifier for my weekly fixes of online gaming with friends.

Front panel
One knob is for voice chat and another one for main volume; one button for muting the microphone and another one for playback mute.


There are some headphones on the market which allows the user to adjust the volume separately for voice chat and game audio. It narrows down the list of headphones to purchase to just a few products. Moreover, the functionality is also often implemented with software, which is way too unreliable for me. The same functionality could be achieved by using a software mixer without any special hardware, but given how often Windows seems to update itself and break features that is a path that I was not willing to travel.

The key design choice was that I wanted to use two separate USB audio chips, one which is dedicated to voice chat and one that handles everything else. Both chips need to have separate volume controls. I also threw in an optical audio input (with TI DIR9001) for a network media player, and decided that I could do the mixing with an FPGA. I ended up using two separate chips just so that it would be easy to distinguish the chips from each other in Windows; I was already familiar with TI PCM2707, and chose to accompany it with a C-Media CM108AH that also had a microphone input. Both chips can be configured to use I2S for inputs and outputs.

Turtle Bitch PCB

One of the most difficult things to get right was to make sure that the USB bus would work reliably if both chips were active. Through trial and error I found out that the USB 2.0 hub inside Microchip USB5742 seems to work well, and ended up integrating a Muxtronics Nanohub on the board.

After leaving the USB audio chips the I2S buses go through Si86xx isolators as I wanted to ensure that none of the USB power supply noise gets into the sensitive analog parts. After isolations I am using TI SRC4190 sample rate converters as I didn’t really want to spend the time to do the sample rate conversions on the FPGA.

Around the time of designing this I spotted an advertisement in a magazine, promoting the compact MAX1000 FPGA board and was immediately interested. After waiting for a couple of months I finally got my hands on one, and as a result this amplifier is also sporting an Intel MAX10 FPGA. The FPGA does the mixing, and its Nios II softcore processor also controls all the buttons, knobs and switches of the user interface.

For the DAC I am using a Cirrus Logic WM8731 which was yet another chip I was already familiar with. It acts as the I2S master, and has both headphone and line level outputs. Initially I was going to use passive speakers so I hooked it up to an TPA3116 class D amplifier circuit with the option of having a preamplifier output as well.


Back panel
From left to right: USB, Toslink in, DC in, preamp out, speaker terminals.

I have been using this system for over a year now and it has worked well. If I were to do a re-spin, I would change a couple of things; first of all, having the DC input next to the Toslink input was a bad idea as it is possible to jam the barrel plug to the Toslink connector and damage it. Moreover, sometimes Windows does not find the USB devices after boot unless I reconnect the USB lead – probably it would have been wiser just to have two USB connectors on the back.

I have built two of these boards, one for myself and one for a friend, and have no interest in building more as bringing the cost down would require quite significant effort. Therefore I challenge manufacturers to stop fiddling with RGB leds and offer something as good as this amplifier to the rest of the world. That is, unless you are still busy trying to make an usable solid state relay

For those who are curious to find out more, check the schematic. The schematic and the information in this blog post has been licensed under CC BY 4.0.

Bad product design: Wharfedale DX-1, part 2

A long time ago I wrote about a subwoofer I had that tended to break down whenever I moved it for cleaning. I have since sold the unit, but I was contacted by others who have the same problem and I would like to share my findings.

First of all, every time the TDA7294 blew up for me it broke nothing else on the PCB, so you can probably repair the device just by changing the chip. If you wish to prevent it from breaking again, read on.

The subwoofer has three modules inside; a switch-mode power supply, preamplifier board (with all the backpanel connectors and potentiometers) and the main amplifier. I looked for a suitable amplifier board on AliExpress and found one which uses TPA3116 which is one of my favourite chips. It cost five dollars at the time. I wanted to keep the preamp as it was as it worked and I didn’t want to redesign the back panel.

I designed a new power supply for the amplifier board out of a toroidal transformer I had at hand. I created a simple PCB which provides an unregulated 12-24 V line for the main amplifier, and a regulated +- 12V for the preamp.


After that it was just a matter of hooking up my custom power supply to both of the amplifier boards. There was some problem with the mute signal of the preamp so I eventually left it unconnected. The preamp has the output signal labeled “S+ GND S-” and you can connect those directly to the amplifier board (I left S- floating).

Embedded Linux datalogger

I have been building an FPGA FM receiver for quite a while now – I have had too many hobby projects running at the same time. Just for the sport I have decided to do the downconversion in digital domain – as a downside the ADC sample rate is then quite high even when undersampling. I plan to keep a GNU Radio design as the golden reference to aid debugging. However, this created another problem; how to sample a few seconds of the high sample rate data so that I can process it with a computer?

I decided that this would be a perfect excuse to learn some embedded Linux so I ordered a Terasic DE10-Nano board from Mouser. My plan was to store the data to the SDRAM memory and then use the on-chip hard processor (HPS) to transfer it to my PC.

The best place to get started is the Golden Reference Hardware Design (GHRD) for the DE10-Nano board. It worked fine. After that I tried to compile all the GHRD stuff myself using a tutorial from Bitlog, which is basically a practical and compressed version of a Rocketboards.org guide.

However, the GHRD just blinks a few LEDs by sending commands from HPS, and I want to send information the opposite way. I was able to figure the rest out with the help of a wiki page from Critical Link. Basically I use the modular SGDMA dispatcher and write master components to adapt the streaming output of my block to the F2H-SDRAM interface. The H2F is used to configure the DMA blocks. My advice is that you should just use these blocks instead of trying to write your own. You don’t need any fancy drivers if you are happy using devmem. You can then copy all the memory mapping stuff from the devmem source code.

Platform designer view of my datalogger

In addition I have routed a few of the FPGA IOs to the I2C core on the HPS side. It is used to control the sampling clock generator. The FPGA design is basically just a FIFO for clock domain crossing.

Even though Altera forums are full of threads where people are struggling with the FPGA-HPS interconnect I found out that it more or less works just like you would assume as long as you do not try to take any shortcuts. For example, make sure to regenerate the preloader every time you change some of the HPS properties.

I am able to access the HPS shell with the USB serial port connection to initiate a data logging event. I then redirect the output to a text file which I can download to my computer over an SFTP connection. I can also use the SFTP connection to send programs the cross-compiled programs onto the board.

Teardown: Microboards Orbit 3 CD/DVD duplicator

I have been building an automated CD ripping machine for a while now, and during the research phase I stumbled upon some commercial solutions developed by Microboards Technology. The older designs are made by Champion Duplicators Inc. which Microboards acquired in 2000.

Overall view of Microboards Orbit 3.

The loading mechanism used in these devices seems quite novel, so I decided to buy one on eBay for further studies. I could possibly use some of the parts in my own design as well – I have first-hand experience in how tricky mechanisms are to get to work right.

These units weigh about 12 – 15 kg – therefore the shipping from USA was not cheap! The dimensions are 388 x 254 x 241 mm. While the volume may seem big, it does contain three optical drives which take a lot of room.

Without the sheet metal cover.
Serial number sticker.

The loader mechanism is based on a big servo which pushes a spring-loaded metal sheet. Basically the metal sheet has a circular opening, which gets aligned with another hole when the servo moves it. The other hole is not perfectly round but has some flanges on the sides, ensuring that only one CD gets loaded per stroke.

Close-up on the loader mechanism.

Underneath there is a spindle which moves up and down on a rail. This moves the CD vertically. The trays of the DVD drives have slots cut in them so that the arm of the spindle can move even when the tray is open. The red and black wires on the left belong to the limit switches of the spindle arm carriage.

Lower part of the loading mechanism with the spindle.

When the CDs have been processed, they go to a conveyor made of polyurethane belt. As the unit is quite old (some parts have a manufacturing date of 2006, others 2009 and 2010) the belts have already gone bad. When the unit was powered on, it would not pass the self-test because the belt of the spindle arm was slipping.

The unit has three IDE drives, two of which can record. The third one can be used to read the master disc which the two other drives write. Obviously using two drives instead of one is faster.

The optical drives.

The unit also has a hard drive. According to the manual it can be used for ripping audio CDs.

IDE hard drive.

There are two controller boards. One of the boards sits on top of the whole unit, and is used for interfacing to motors and limit switches.

Interface board, connected to motors and limit switches.

The main board is buried under the optical drives. It boasts a handful of CPLDs and an FPGA.

Location of the main board in the unit.

The entire thing is powered by a beefy APS power supply.

Power supply specs.
Power supply.

As I have no use for a device which makes a zillion copies of a CD I am planning to use some of the parts of this unit to create my own ripping station. The brains will get replaced by a modern single-board computer and I will reduce the number of drives to just one. I am also trying to get the volume and the power consumption of the device down.


Bad product design: Wharfedale DX-1

When I moved to a new apartment a few years ago I decided to get a 5.1 home theater system. Wharfedale Diamond speakers are quite nice so I decided to get Wharfedale DX-1 home theater. I have been pretty happy with it except for one major annoyance – the amplifier inside the subwoofer tends to break when I move the subwoofer for cleaning.

Broken Wharfedale DX-1 amplifier module, based on TDA7294.

I changed the TDA7294 chip the first time this happened, but now I think that I will get a class D amplifier module from China and use it instead. I will post some pictures when I complete the mod.

Making an usable solid state relay

Using a microcontroller to control a device which uses mains power can be dangerous. There are products which try to overcome this problem, but I think they still have a lot to improve. If we take a look at the Sparkfun catalog, the Beefcake Relay requires you to find a safe enclosure for your project. On the other hand, the PowerSwitch Tail  comes in a nice enclosure but supports only American power plugs. Moreover, the low voltage connector is a screw terminal which is slow to mate and de-mate. Industrial solid state relays, like eBay Foteks, also require a proper enclosure.

Finding an enclosure which has suitable dimensions is quite easy, but there is quite a lot of boring work if you want to use connectors instead of just running a cable through the enclosure wall.

DIY solid state relay used to turn the heat bed of 3D printer on and off.

Recently I upgraded the heatbed of my 3D printer so I had to figure out a solution to this. I decided to use Schurter 4300.0301 for the mains connection and a 5.5mm DC plug for the low voltage connection. The circuit board, which implements the functionality from the application circuit of the MOC3043M datasheet, is soldered directly to the terminals of the mains connector. The whole thing fits nicely to a Kradex Z56 enclosure.

I hope decent commercial MCU controlled mains switches emerge soon.

Boot selector for Amiga

Over the holidays I had once again the pleasure of tinkering with my friend’s Amiga 500. This time helped him with flashing the HxC firmware to his Gotek floppy drive emulator which he had mounted in an external drive case. The flashing went smoothly, but in order to be able to boot from the Gotek device the Amiga needed a hardware modification.

This came as no surprise as we had done our homework. There are multiple products in the market but I did not really like them as they connected the IC pins to a DPDT switch with a long wire in order to swap the signals in pins 13 and 14. The CIA ICs are getting rare, and although unlikely, killing one with ESD would ruin the day. Moreover, the required switch type greatly limits the selection of switches and mounting methods one can use to make the solution as neat as possible. The prices of the existing solutions are also quite high if you consider the shipping costs as well.

For those reasons I created my own design. It is a really simple solution which uses a 74HC153 multiplexer to do the switching. The top side of the board has a precision DIP socket for the even CIA. The bottom part has the turned male pins for plugging the whole thing to the original IC socket. The circuit will draw its power (approx. 2 mA) from voltage supply of the CIA chip.

You can build your own Amiga Boot Selector by using these Gerber files amiga_df0_df1.zip. The project is licensed with a CC BY 4.0 license.