Assignment #12
Interface and application programming
The twelfth assignment is about interface and application programming. We have to write an interface that works with a circuit we have made. I’ll create a basic musical instrument controlled by part of the circuit I designed for my final project.
1 – circuit
First, I need to assemble a circuit. I’ll reuse part of my previous work as an input device for the instrument I’m going to program. Because the pandemic limits access to the lab, I’m using an Arduino Nano connected to four buttons.
2 – uploading Firmata code to the Arduino
To connect the Arduino to my computer application, I need to upload a Firmata sketch. In the Arduino IDE, I open File > Examples > Firmata > StandardFirmata, click Upload, and wait for the upload to finish.
3 – Processing
To code my interface I decided to use Processing, a programming platform based on Java. My code uses the Minim library to manage sound and the Arduino library to read signals from the circuit. Inspired by a Minim example, I designed an interface with two lines visualising the sound and four buttons below them. These light up when the corresponding buttons on the board are pressed, providing visual feedback.
Here is the Processing code:
I’m very happy with the result: the interface works well and looks elegant. I’ll explore Processing and the Minim library further to combine interesting sounds with visual elements.
Here are some videos of the interface running:
5 – PCB Design
To complete the assignment, I designed a PCB that could control the application. COVID-19 restrictions prevent me from milling it, but I can still prepare the design for future use. The board is based on an ATmega328P and includes buttons to control the Processing sketch. As usual, I checked the controller’s pinout and drew the schematic in KiCad.
I then moved to the PCB editor and connected the footprints. Since the circuit was fairly complex, I used a two-layer board. Finally, I used the 3D viewer to preview the result.
6 – Symbol design
You may have noticed the symbol of our beloved cult on the board. I added it to make the design more personal. To learn how to do this, I watched this tutorial.
First, I drew the graphic in black and white using Inkscape, then exported it in PNG format.
I then opened KiCad’s “Import bitmap” tool, imported the image, adjusted the contrast, and exported it as a symbol. Only the white areas appear on the PCB, although the colours can be inverted.
Next, I returned to the PCB editor and added the graphic to my footprint library. Finally, I placed it on the board.
One last thing that I did was to move it to the top traces layer, so that it can be milled together with the traces.
Source files
Here are all the source files for the Interface and application programming assignment:
1 - 4 buttons sound interface processing file
1 - 4 PCB Files
