PART 3: THE CIRCUIT
So the Ethernet shield allows our Arduino to communicate with your phone, but how can the Arduino control the audio signal going to the speakers? This problem is solved using the fantastic PT2258 IC. This little guy receives commands over the I2C (pronounced eye-squared-see) bus and has six channels of control to match our six channel amp. Basically what this chip does is take six audio inputs and can control the volume from a range of -78dB to 0dB. The various types of commands it can receive are located in the datasheet and will be discussed more later.
We now need to figure out how to wire this little guy up. If you are a beginner, STOP. This is another learning opportunity. Go buy a cheap soldering iron. You will not need a good one for this project. You should be able to find one for under $20. Now go find an old printer, computer, toaster, etc. and rip it apart. Find some circuit boards and have at it. Soldering is tricky and takes quite a bit of practice to master. Find a tutorial of your liking (trust me, there are plenty out there) and learn.
Not too bad, huh? Now you can scratch “Brutally tear apart and defile a toaster” off your bucket list.
Time for a choice. There are two routes you can take for hooking the PT2258 chip up to your Arduino. You could buy a prototyping board such as this and wire it yourself, or you could do as I did and design your own PCB to make things easier and neater. (I have attached the board file for those of you who don’t feel like designing your own) Either way you are going to be following the schematic in the PT2258’s datasheet EXACTLY. Do not skimp out on capacitors or resistors. These are necessary elements of the circuit and without them you may be severely disappointed in the sound quality.
There are three types of components needed: capacitors, resistors, and the PT2258 IC itself. Each has a different, but equally important role in the circuit. The capacitors store a charge and release it if there is a sudden drop in power from the supply side of the input. When wired in the configuration shown in the datasheet, the capacitors function to smooth the audio signals and remove sharp or sudden spikes. Resistors are generally used to lower voltage or hinder current flow. In the configuration shown in the datasheet, with one end connected to the source and the other to ground, the resistors are called “pull down resistors” meaning when there is no input signal, the circuit is pulled down to ground. This has the handy effect of removing annoying static or buzzing when nothing is being played through the system.
If you chose the second method of designing your own PCB, head on over to Sparkfun’s excellent Eagle tutorial. Eagle is a piece of software used for designing and manufacturing PCBs.
We also need some way to get audio to the PT2258 chip, right? An easy way to do this is to pick up a couple 3.5mm through hole jacks. This allows you to input whatever source into the system you want. We will then need some way to transfer the audio output of the PT2258 chip to our amp. I used more 3.5mm jacks on the PT2258 board and a few RCA to 3.5mm adaptor cables. There also needs to be a way to connect this board to the Arduino so stick a few male headers on the board connected to +5V, GND, SCL, SDA, CODE1, and CODE2 (CODE1 and CODE2 are used to change the I2C address of the chip to allow more than 1 PT2258). I then used these cables to connect the board to the Arduino.
When your schematic is all finished, it should look something like this. The reason I have two sets of male headers is for daisy chaining boards for larger systems.
Also notice how the connections in the datasheet match those of the schematic.
Next you need to convert the schematic into an actual board. If you used the Sparkfun tutorial you should already know how to do this! Mine ended up looking like this.
Click here for Part 4: Assembling the Board
House Audio Sch.brd (56.9 KB)
House Audio Sch.sch (139 KB)