Assignment #11
Output devices
The 11th week of the Fab Academy program is about output devices and using a controller to instruct a device to do something.
1 – components
Once again, the coronavirus pandemic prevents me from accessing the lab, so I’ll use an Arduino board for this assignment.
I’ll combine the input devices from my earlier assignment with output devices that provide visual feedback. A MIDI output will also let me connect the device to music production software and start making some noise!
The output devices will be:
- 1 x MIDI socket that will send out MIDI notes and MIDI CC
- 1 x LED that will blink constantly in order to communicate that the device is running
- 1 X LED that will blink when a MIDI note is sent
- 2 x LEDs that will blink when MIDI CC is sent, with variable brightness to also show a representation of the value (the higher the value, the brighter the light)
I’m going to add these output devices to the board I made for the input device assignment.
2 – code
The code is quite long, but it is not too complicated. I used analogWrite to control the brightness of LEDs connected to PWM pins, with an integer value mapped to the gyroscope’s movement. I also added an LED that lights up when a button is pressed and the device sends a MIDI note, plus another LED that stays on while the device is active.
3 – testing the device
Once the code was uploaded, I connected a MIDI-to-USB adapter to the device. I had to adjust the serial port’s baud rate, but otherwise everything went smoothly. I then mapped the controller’s movements to instruments in the open-source music software LMMS. At one point, I noticed that the MIDI socket’s GND connection had broken, yet the device still worked. I’ll repair it, but I would also like to understand why it continued to function.
4 – designing a board
To complete the assignment, I designed a board that could drive these output devices without an Arduino board.
I left the input devices out of this board to avoid duplicating the previous assignment and the final project board.
The COVID-19 emergency prevented me from manufacturing the PCB, but I still designed it to practise my skills.
I used an ATmega328P again, checked its pinout to connect the components, and drew the circuit in KiCad.
I then moved to the PCB editor and routed the connections. Although I could not mill the PCB, KiCad’s 3D viewer gave me a preview of the board.
5 – board for final project
With the code and prototype for the input and output devices complete, I moved to KiCad to turn the breadboard circuit into a PCB. This will serve as a support board for the Satshakit I made during the electronics design week.
I used FlatCAM to generate the G-code and the Stepcraft to mill the PCB. You can see the result on my final project page.
Source files
Here are all the source files for the Output Devices assignment:
1 - code with LED + MIDI
2 - board with ATmega328P
