This is an old revision of the document!


PB702 MIDI Synthesizer


The MIDI Synthesizer gives the possibility to connect your Paper Bits to any Midi Keyboard, such as the MIDI Keyboard. It is polyphonic up to six notes and has four different waveforms: square, triangle, saw tooth and sine.
It's basically an Arduino clone running a small program based on the wonderful Mozzi library.


Paper PCB

Parts

  • Resistors:
  • 1x 220 Ohm
  • 1x 330 Ohm
  • 2x 470 Ohm
  • 2x 1 KOhm
  • 2x 1.2 KOhm
  • 1x 2 KOhm
  • 1x 3.3 KOhm
  • 1x 3.9 KOhm
  • 2x 8.2 KOhm
  • 1x 10 KOhm
  • 2x 47 KOhm
  • 1x 100 KOhm
  • 1x 220 KOhm
  • 1x 1 MOhm
  • Capacitors:
  • 2x 22 pF
  • 2x 1 nF
  • 1x 4.7 nF
  • 3x 100 nF
  • 1x 150 nF
  • Electrolytic Capacitors:
  • 1x 1 µF
  • 2x 10 µF
  • Semiconductors:
  • Atmega 328P-PU
  • OpAmp MCP 6002
  • Optocoupler 6N138
  • Cristal
  • 1x 16 MHz
  • Diodes
  • 1x 1N4148
  • 1x LED
  • Mechanical:
  • 1x IC socket, 28 pin
  • 2x IC socket, 8 pin
  • 1x pin strip 1x14pin
  • 2x pin header, female 90° 1×3, 1×2
  • 2x pin header, male 90° 1×3, 1×2
  • 2x push button
  • 3x jumpers

Software

First of all one needs a bootloader on the Atmega chip. For burning the bootloader follow the AVR & Bootloader manual.
For uploading the program one needs an USB to Serial adapter or an Arduino to mimic one: The Arduino as a Serial Adapter

Mozzi and MIDI

The synthesizer program is based on the MIDI library and the Mozzi Library, have a look at the Mozzi Dokumentation to learn more about it.
The MIDI library can be installed via the library manager, for the Mozzi installation download the Mozzi library and install it like described here: https://www.arduino.cc/en/Guide/Libraries#toc4

Mozzi Mode

There are three different sound quality modes for the Mozzi library. The MIDI Synth needs the HIFI mode. To change that open in …/sketchbook/libraries/Mozzi_102 the mozzi_config.h file and comment out the AUDIO_MODE STANDARD and uncomment the AUDIO_MODE HIFI. It should look like that:

 //#define AUDIO_MODE STANDARD
 //#define AUDIO_MODE STANDARD_PLUS
 #define AUDIO_MODE HIFI

then save the file.

Mozzi Glitch

Unfortunately the latest version of Arduino is responsible for a timing glitch in the Mozzi library. Arduino changed the compiler from O2 to Os. Now the uploaded code is smaller but a timing problem appears, too. Here is an description about the problem here: https://www.instructables.com/id/Arduino-IDE-16x-compiler-optimisations-faster-code/

To fix the glitch one has to downgrade the compiler. Change in: arduino-x.x.x\hardware\arduino\avr\platform.txt the compiler from -Os into -O2.
https://sensorium.github.io/Mozzi/fixes/updates/howto-for-arduino-1-dot-6-11/

Code

Upload that code to your board (Arduino UNO):
mozzi_midi_poli_12_1sec_limit.zip
mozzi_midi_poli_10.7z