Introduction

Theory

Hardware

Software

Design/ Testing

Conclusion

Appendix

References

MCU Synthesizer
Hardware

Midi Interface

The midi device and the microcontroller needed to be electronically isolated to prevent damage to both devices and to keep the current loop that transmits the midi messages from sinking into the mcu. We use an opto-isolator to perform this task. We first designed the opto-isolator circuit using the 4N35 opto-isolators available in lab. At a 31,250 baud rate a bit is sent every 32 microseconds, the rise/fall time of any following circuit needs to be about 5 microseconds. Even with a 51KOhm resistor attached between the base of the 4N35s BJT and ground to lower the fall/rise time the fall/rise time was not fast enough to reproduce the signal properly on the other end of the opto-isolator. We changed the 4N35 to a high-speed 6N138 and with a 51KOhm resistor between the output BJTs base and GND we obtained a much faster fall/rise time. The signal looked more like a square wave but still had a logarithmic growth that was not ideal. The 6N138 inverts in the input signal which is a problem. RS232 protocol requires a serial signal to idle high, a low start bit, and a high stop bit. To invert the output of the 6N138 we used a simple transistor (npn BJT) inverter with a 10KOhm resistor at the input (base) and a 1KOhm from output to VCC. This inverter fixed the non-ideal logarithmic growth at the output of the 6N138 since all outputs of the inverter can only be VCC or GND. After being isolated and then inverted the midi signal is now ready to be sent to UART to be sampled 31,250 times per second.

 

 

LCD/potentiometers/Pushbuttons

Potentiometers and pushbuttons were used to select the many options of our synthesizer, while the LCD displays the menu of the current settings you can change. We ordered 10KOhm trimpots with knobs to adjust the attack, decay, sustain, release time. The output of the potentiometers will be between 0-5V, this range gets read into an ADC to convert into a value that corresponds to a time on the interval 0 -1000ms. Active low push buttons are used to select which menu you display on the screen