As part of our final project for ECE 4760: Digital Systems Design Using Microcontrollers, we built a guitar amplifier with remote distortion and digital effects capabilities controlled from a smartphone via bluetooth.
Musicians often need to modify the configuration of their amplifiers when performing in concerts. This job is generally delegated to “roadies” who walk on-stage between sets to make adjustments. By building on top of generic amplifier circuitry we’ve been able to increase the capabilities of the standard guitar amp to allow remote control over all aspects of the amplifier’s sound.
There are two methods of interfacing with the amplifier. The first resembles a classic guitar amplifier where the user controls the analog effects via knobs connected to analog potentiometers. As is standard, the input of the amplifier comes from a ¼” TS Male Auxiliary cord attached to an electric or acoustic guitar. We have a ¼” TS female to 3.5 mm TRS male adaptor. This in turn connects to a 3.5 mm adaptor which is wired directly into our circuit.
The second style of interfacing with the amplifier is via the PIC32 microcontroller which controls and applies digital effects. These sound effects are outputs of a Belton BTSE-16 chip, which, through onboard DSP, synthesize various effects. These effects include chorus, flanger, phaser, tremolo, delay, reverb, and various combinations thereof.
As part of our ‘stretch goal’, the primary standard to which we’ve conformed is determined by the Bluetooth Special Interest Group (SIG). The standard for Bluetooth that we will be following is set by IEEE 802.15.1. The standard essentially sets the MAC addresses available for our use as well as limits our applications to the 2.4-2.485 GHz ISM band.
A large portion of the project was devoted to building and testing standard analog circuitry for generating our desired effects. The schematics for these are included below.
Our input goes through a common emitter amplifier with the 10k and 100k resistors deciding the gain of the circuit. The 100 nF and 10 uF capacitors decide the frequency response of the circuit with a lower input capacitance creating a more treble-heavy sound and a higher input capacitance creating a more bass-heavy sound. The schottky diodes act as clipping diodes creating the distorted sound we hear at the output.
Our input goes through a high pass filter into a unity gain op amp (pins 1,2, and 3). The treble potentiometer adjusts a high-pass filter that sets the cutoff frequency below which no frequencies can pass. The bass potentiometer adjusts a low-pass filter that sets the cutoff frequency above which no frequencies can pass. The mid potentiometer acts as a band-pass filter that amplifies the center frequency about which treble and bass act. The level potentiometer changes the magnitude of the output signal by altering the gain of the second op-amp (pins 5, 6, and 7). Pins 4 and 8 are the ground and Vdd (8.84 Volts) of the op-amp respectively.This schematic was found on Run Off Groove. We modified the circuit to use LF353 op amps, as they gave the desired performance and were readily available.
We used a TPA3122D2 15 Watt Class-D power amplifier in order to drive the signal to our speakers. The class-D amplifier uses pulse width modulation to take our analog input signal, convert it into pulses, and amplify the signal. In order to set the voltage high enough to drive the speaker, a capacitor is placed between the FET-driven output and the bootstrap pin. The amplified pulse train is converted back into an analog signal with the passive low-pass filter (capacitor and inductor) out of the ROUT pins of the chip (pins 12 and 13). This low-pass filter acts as an integrator to the PWM. Finally, we add DC offset to our signal with our 470 uF capacitor in order to output a audible signal to our speakers, without negative output.
Digital Circuitry and Microcontroller Integration
An even greater portion of the project was dedicated to digital design and microcontroller programming…
The HC-05 bluetooth module handles almost all responsibilities associated with establishing a bluetooth connection with any other bluetooth-enabled device. The HC-05 communicates over UART with the PIC which both transmits and received data. The chip works by publishing a bluetooth service and allowing another client – the smartphone – to pair with the module. Through the use of a bluetooth terminal on a smartphone (eg. blu-term) one can send data and test the uart connection with the PIC.
The Pic32 is a class of 32-bit microcontrollers manufactured by Microchip. It was used as the main control center for the guitar amplifier. Its integration into the project can be seen in the left hand schematic describing how the overall projct was wired. Using UART, it was able to communicate with a smartphone using bluetooth. Then, using various pins as digital output, it selcted various multiplexer signals as necessary, as well as the correct outputs to the speaker. In addition, using SPI, the microcontroller was used to control various 100K digital potentiometers. As a result, it was crucial to use the PIC in the project, as otherwise integration would not have been possible
In our main method, we follow typical procedure in first initializing protothreads, enabling interrupts, declaring input and output pins, opening SPI channel 1 for the digipots, setting initial values for SPI CS pins, and then scheduling the main thread. Pin mappings were as follows:
- RA0, RA2, RA3, RB4 –> Digipot Clock Select (CS) pins
- RB3, RB7, RB8, RB9 –> DFX Chip Binary Select Signal
- RB5 –> Digipots SDO (MOSI) Pin
- RB14 –> Digipots SCK
- RA4, RB13 –> Output Multiplexer Select Signal
The command thread begins by spawning a thread which waits for input through a serial command-line interface. By pairing the HC-05 chip with a smartphone running a terminal interface, the PIC is able to send data and receive input commands from a user. In put is entered and received in the form of a key, value pair. Following a data entry, the command is examined and particular tasks are performed depending on the data received. The following explains the various command a user may input:
- Key: ‘d’ –> Value: Number which translates to 4-bit binary input to DFX chip. Also sets output mux to DFX chip.
- Key: ‘s’ –> Sets output mux to distortion.
- Key: ‘n’ –> Sets output mux to normal (signal through tonestack only).
- Key: ‘t’ –> Value: Send value via SPI to digipot controlling treble.
- Key: ‘b’ –> Value: Send value via SPI to digipit controlling bass.
- Key: ‘v’ –> Value: Send value via SPI to digipot controlling level.
- Key: ‘m’ –> Value: Send value via SPI to digipot controlling mid.
All hardware and code can be replicated given an individual has access to all the parts required and as listed in the sections below. Hardware conforms to all IEEE standards as discussed below in the conclusion section. There are no patents or copyrights associated with our project’s code. However, the only patented piece of hardware is the Accutronics Digital Sound Effector which is also described in detail below. This hardware also conforms to IEEE standards.
Portions of hardware that had to be scrapped included a multiplexer circuit. Initially, we wanted our amp to be able to select between digital and analog effects through a multiplexer chip. However, due to impedence issues, we chose a different design as detailed in the schematics setion.
A function deliverSPICh1Datum was called whenever we wanted to send SPI data over channel 1. This was called whenever a command altering the resistance of a digipot (configured via SPI) was made. Calls to this function were performed after Clock Select (CS) was toggled low for the specific line over which data was sent, and before CS was reset to high to end the transaction.
Using the HC-05 chip, bluetooth was used to control all aspects of the other circuits built for the project. Using a UART interface, bluetooth was very effective in controlling the amplifier. It was implemented using the protothreads DMA UART libraries. In the interest of time, we did not develop a front end for the bluetooth, however, using a bluetooth terminal on an Android device instead. Future work would involve building a fully functional front end to the amplifier.
Our goal for the distortion portion of the circuit was to take our input signal through a raw distorted effect and output it through our class-D amplifier to our speakers.
Figure 10 presents the ‘clipped’ signal that is outputted from the distortion circuit. Our final distortion circuit was protoboarded and presented with the distortion effect being clearly heard through our speakers.
Our primary goal for the tonestack was to implement both analog potentiometers as well as digital potentiometers that could control the bass, mid, treble, and level functionalities of our guitar amplifier. The 100 kilaohm digital potentiometers wwould be controlled via smartphone through our HC-05 Bluetooth module and PIC32 microcontroller while the analog potentiometers would be controlled via physical tunable knobs on the guitar amplifier.
The analog portion of the tonestack was successfully wired on a breadboard and soldered onto a protoboard. The values chosen were 250 kilaohms for the bass/treble potentiometers and 100 kilaohms for the level/mid potentiometers. The effects themselves worked very well both on an oscilloscope as well as through our Class-D amplifier. Figures 16 and 18 present the bass and treble potentiometers tuned to their highest values, respectively cutting off the high and low frequencies from the signal input. Figures 22 and 24 present the bass and treble potentiometers tuned to their lower values, passing far more high and low frequencies from the signal input. Figure 17 presents the level potentiometer tuned to its highest value increasing the gain of the circuit. This capture can be compared to Figure 23 which presents the level potentiometer tuned to its lowest value (peak-to-peak value of the signal increases from 1 Volt to 9.6 Volts as level increases). Figure 19 presents the mid potentiometer tuned to its highest value amplifying the center frequency of our input signal. A small amount of ‘clipping’ is noticable due to our mid-potentiometer exceeding the dynamic range of our two 250 kilaohm bass/treble potentiometers. Figures 20 and 21 present the level and mid potentiometers tuned to their respective ‘half-way’ marks. Each potentiometer had a clear effect on the signal input when driven through the class-D amplifier to our speakers.
We attempted to implement the digital portion of the tonestack through two separate methods. Our first implementation involved driving both the analog and digital potentiometers through a mux. The select signal for the mux was controlled via smartphone through a standard bluetooth interface. We decided to scrap this initial design due to the excessive amount of wiring required through the muxes, which made the mechanical construction of our guitar amplifier impractical. Our second implementation involved placing both the digital and analog potentiometers in parallel directly into the circuit. This design worked perfectly allowing the user to control the digital potentiometers across a much wider range due to the additional presence of the analog potentiometers. Once again, each potentiometer had a clear effect on the signal input when driven through the class-D amplifier to our speakers
Unfortunately, 6 hours before our demonstration, an AC-DC transformer was accidentally connected to our digital potentiometer’s power rail, resulting in a voltage spike that completely burned out all of the digital potentiometers, our protoboarded analog potentiometers, as well as our instrument’s pickup. In order to present our work, we rewired 10 kilaohm digital potentiometers onto a breadboard. Each potentiometer is tunable through our bluetooth serial and can be driven through our class-D amplifier. Additionally, we rewired the analog potentiometers onto a separate breadboard, which could also be driven through our class-D amplifier. We expect that, once the 100 kilaohm digital potententiometers are rewired in parallel with the analog potentiometers, the entire tonestack will work as envisioned again.
Digital Sound Effects
The goal of the digital sound effects chip was to be able to play 16 different effect, at the choice of the user. The choice was made over a serial terminal on the bluetooth interface. By selecting numbers between 0 and 15, the user could hear various effects on a speaker. In order to test this chip, we tested changing effects, and viewing the effects on an oscilloscope. Figure 13 in the gallery is an image of a pure sinusoid before digital effects were applied. Figures 14 and 15, which are clearly different, show effects 3 and 12, respectively. Seeing these waveforms confirmed that the chip was working. In addition, using the ukulele as an input, we were able to hear various effects as outputs on the speaker.
During testing, there were various issues that occured with the sound effector chip. First of all, we were not able to see any output when using the schematic provided by the manufacturer. As a result, we decided to remove all active components in the schematic, and passively filter the output. This gave us the desired results. In addition, we decided to remove the left channel of the sound, as it was found to be unnecessary to hear desired outputs.
Class D Amplifier
The goal of the class D amplifier was to be able to drive sound through a 15 W -8 ohm speaker. Normal outputs did not have enough power to drive the speaker. The class D amplifier uses PWM based on the input waveform in order to output the correct waveform with enough power. When wiring the Class D amplifier, this led to a few problems. First, if output wasn’t filtered correctly, loud clicks were visible in the waveform as well as in the sound. It was also difficult to test due to the pure volume of the sound from the speaker. In addition, there were cases that even though there was an input, it would appear that the PWM was not functional.
In order to fix these issues, we first capacitively coupled the board with a 1 uF capacitor. This ensured that the PWM would work, as input power was smooth and consistent. Volume control was basd on the amount used as VCC. It is important to note that for the chip to function, this had to be at least 10 V. When the waveforms were viewed on the oscilloscope, after filtering of the PWM, outputs looked like all of the input waveforms, but with amplitude of approximately 5 V. The power from this was enough to drive the speakers with the desired outputs.
In integration, we hoped to have bluetooth control whether effects should come from the digital effects or distortion, both driven from output of the tonestack, or sound from just the tonestack. We were able to confirm that our multiplexer control of the circuit, with select signals from bluetooth, was able to select which input to drive the class D amplifier with. In addition, in develoopment, integration had completely worked before perfboarding the tonestack. However, after the aformentioned AC-DC spike, some parts failed, and integration had not worked. In addition, power may not have been consistent enough from an AC power supply to give the desired outputs. When outputs were reached, some appeared to be very noisy. Integration is a big goal for future improvements of this project. We hope to PCB all circuits and ensure consisency in integration
There are a few key improvements that we aim to make to our guitar amplifier in the future. First of all, we aim to replace our 250 k-ohm bass and treble potentiometers with 500 k-ohm potentiometers within our analog tonestack. This should allow for more significant effects by changing our cutoff frequency range as well as prevent any possible clipping at our output. Secondly, we aim to rewire our 100 kilaohm digital potentiometers in parallel with our analog potentiometers to achieve our digital/analog switch capabilities. Other portions of our design that could be improved include the overall integration of the circuitry as well as the aesthetic presentation of the final prototype. Moving forward, we hope to fabricate a PCB with streamlined connections that will both ensure quality and miniaturize the size of the amp. Additionally we hope to house the amp in a wooden case that will protect and improve the quality of the overall product.
Our design conformed to all relevant IEEE standards. This was this case since most of the complex signal processing was performed by industry-standard chips and externally integrated circuits. For instance, the HC-05 chip conforms to all standards set out by the IEEE Bluetooth Special Interest Group (SIG). Not to mention, the BTSE-16FX DSP chip is a standard module included in many digital guitar amplifiers and conforms to IEEE standards.
Intellectual Property Considerations
As for intellectual property considerations, all source code was produced by members of our group. All external packages such as protothreads were used with permission of the instructor. Similarly all analog circuit designs and external modules (Digital Sound Effector, Bluetooth chips) were adapted from open-sourced, publicly available schematics and therefore required no legal agreements be made with original authors. As a result, our designs could potentially be patented with few to no Intellectual Property conflicts. As we have open-sourced our designs, our work may also be published in any magazine or journal.
Our project was executed with close attention paid to the IEEE Code of Ethics. During our planning, design, and execution phases, we held ourselves to high ethical standards which included working to not only ensure our project met all quality technical standards, but also holding ourselves to a professional working standard. We made sure to constantly interface with other students, TAs and Teaching Assistants with a respectable level of maturity and made an immense effort to work out all technical problems that arose internally within our group. With specific regards to the Code of Ethics, our project is absent of any potential unsafe factors which intentionally endanger the public or environment. As we have open-sourced our designs, we have minimized any potential conflicts of interest and false claims about the technology used.
By designing this guitar amplifier, it has been our intention to improve the current amps on the market by adding useful capabilities that are absent in any current designs. As such, we’ve strove to make as great an impact on this market as possible given the time constraints and available resources. Therefore, throughout our design process we have seeked honest criticism in all forms from our peers and have worked to enhance out own technical compentence in order to unerstand the greater limitations imposed on us by the technology used.
Our project includes a Bluetooth Module, AC-DC wall outlet power supply, and several voltage regulators which are all subject to FCC standards:
Our HC-05 Bluetooth module uses the Bluetooth Specification v2.0+EDR protocol, operates on a 2.4GHz ISM band, and has an emission power of <=-84dBm. It also operates at 3.3V and includes authentication and encryption protocols for data transfer. Included in our design is an AC power adapter with converts a 12V AC wall outlet output to a DC current with a voltage that may be stepped down to work with our circuitry. In addition, several voltage regulators were used to power the various components of our project. Since several components required 3.3V, 5V, and 9-12V voltages, we used linear voltage regulators to step down the output of the AC power adapter just described. These components and respective specifications adhere to FCC standard restrictions and thus our design is capable of operating legally in the US.