Category Archives: Uncategorized

Serial midi on the Raspberry Pi Zero W

The Raspberry Pi Zero W (rpi0w) has a lot of properties to make it a great musical instrument (CPU power, affordability, portability, power demands). First thing on my list is serial MIDI in, to hook up my octatrack. I compiled the following guide to equip the rpi0w with MIDI in.


  1. Install Rasbian (my version is 2017-04-10)
  2. Midi requires the serial device “/dev/ttyAMA0” to be exposed through the rpi0w’s header pins. Unfortunately, the bluetooth service is internally connected to this serial device and only the “/dev/ttyS0” soft serial device is available through the GPIO. Lets change this:
    1. Disable bluetooth: “sudo systemctl disable bluetooth.service”
    2. Add “enable_uart=1” and “dtoverlay=pi3-disable-bt” to /boot/config.txt
    3. Remove “console=serial0,115200” from /boot/cmdline.txt
  3. Midi has a typical baudrate of 31250, a non supported one by the rpi0w. Let’s reprogram the 38400 rate to behave like a 31250 one.
    1. Add “init_uart_clock=2441000”, “init_uart_baud=38400, and “dtparam=uart0_clkrate=3000000” to /boot/config.txt (each on its own line, do not add the double quotes). The 38400 baud rate will now operate at 31250 baud.

The last lines of your config.txt will look something like this:

Screen Shot 2017-04-26 at 20.10.59

Reboot your rpi0w to make the changes effective.

Upon login, install “wiringpi” to check the configuration of the GPIO. Issue a “gpio readall”. Physical GPIO pins 8 and 10 should display an ALT0 mode:


The configuration of your rpi0w is good to go!


On the hardware side, I followed Joseph’s instructions on SamplerBox, using this schematic:


Run the python program supplied on the SamplerBox page to test the Midi in. The python program should output “note on, note off” messages upon incoming midi notes.

Midi & Alsa

To hook up the midi input to the Alsa audio system, I’m using ttymidi. To install ttymidi, you have to make a small change in the Makefile.

  1. Download ttymidi with “wget”
  2. Untar and edit the toplevel Makefile, add “-lpthread” to the all: statement.
  3. Make and sudo make install
  4. Run with: “ttymidi -s /dev/ttyAMA0 -b 38400 -v”

Development with STM32F7 discovery

A few pointers regarding development with an STM32F7 discovery board. My intention with this powerful board is to be able to sync wave files to a tap-tempo BPM (kinda Ableton Live like), and take the device up on stage with my band.

The board:


The STM32F7 disco runs at ~200Mhz, has support for DSP instructions (hardware floating point unit) and a lot, lot more. My first step was to make development easy, fast and “Arduino” like – since I’m really comfortable with that. I tried available options like STM32WB, Keil, Eclipse IDE plugins, etc but those did not work for me.

My current development setup is build around the great examples by postspectacular who offers a day-course synth building focussing on the STM32F7 disco. Check out his github repo! His setup offers a flexible makefile that compiles all projects without the need for an IDE. The examples are clear, step by step and easy to follow and extend upon.

My only extra need was more debug information. The Arduino way of just outputting over Serial.print did not work. So I did some research regarding gdb, the GNU project debugger. Since the makefile also supplies an ELF file, setup was quick:

I’m working in example 05, so to make debugging possible I edited the ex05.make file and changed the CFLAGS line to this:

CFLAGS += -O2 -ffast-math -g

Less optimisation (O2 instead of O3) and a -g flag to include debugging symbols.

I compiled the st-link gdb-server for OSX (texane on github). From the directory: /Users/Arthur/Development/embedded/tools/stlink/build/Release/src/gdbserver I’m running the st-util utility with: ./st-util -m -n

In an other terminal I’m running the arm gdb with the compiled ELF from example 5:

arm-none-eabi-gdb -tui –eval-command=”target extended-remote localhost:4242″ bin/ex05/app.elf

Or, if I just want to test the compiled application:

cp bin/ex05/app.bin /Volumes/DIS_F746NG/

update: guess you’ll have to upload the new compiled binary to the board using the last command, before initiating a debug session!

Matrix mixing craziness

A few weeks ago I did a small experiment with summed matrix mixing:

sounds great, crazy, untamed etc. I decided to explore summed matrix mixing a little bit further and today I started building a new prototype, that got out of hand quickly!

A single attenuverting channel (a 1 to 1 matrix) looks like this:

Screen Shot 2016-04-01 at 20.52.44

Although interesting, a more advanced matrix would offer a lot more possibilities. I decided to go for a 4 x 3 matrix, since I had those parts available. A 4 x 3 matrix offers 4 input channels that can be annenuverted and routed to 3 output channels, in any configuration. The test configuration will be configured like this:

Screen Shot 2016-04-01 at 20.56.58

And, it got out of hand. 4 channels “in” means:Screen Shot 2016-04-01 at 20.58.42

this, and to have 3 channels “out” — multiple this by three! Which leads to a breadboard like:


;) Time for extensive testing!

Schematics, eagle files and build notes for the umodular

As promised, attached to this post you’ll find the schematics in PDF and the eagle files for the umodular. Released as open source hardware, so hack away and please provide feedback! The eagle designs are not editable using the free version because of the size of the PCB, sorry. Check the list below; one of the outstanding wishes is to divide the large board into smaller, attachable boards – all below the 100mm x 80mm constraint.



Following is a list of todo’s, build notes and other observations I did while building the prototype. Future versions will include features and fixes from this list.

vco: own design, open source and open source hardware
vco: replace CA3046 with modern matched transistors BCM847DS
vco: pulse should also work, even without controlling it through PWM width with a voltage
vco: triangle out
vco: sine out
vco: trimpot for base frequency
vco: option to follow osc 1 pitch

vcf: for now working with MFOS “Simple State-Variable VCF” design, open for non-commercial use but (c) Ray Wilson
vcf: replace ray’s filter with own variant
vcf: voltage controlled resonance in LP filter
vcf: more filter options (BP, HP, LP)
vcf: dual filter?

adsr: Working with a design by Rene Schmitz, permission for use granted.
adsr: vc for d and s?

vca: cost effective to develop version without THAT 2180?

mix: Update mixer volume control. Sounds like highpass filter now

pcb: all TL274 -> TL074
pcb: fix potentiometer orientation. All pots are inverted! full left is now +5 should be -5
pcb: check log pot instead of lin pots
pcb: footprint 78xx != footprint 79xx! Replace footprint of 7909 with actual footprint!
pcb: a nice manual routing, reducing the amount of via’s. Busses for power.
pcb: general layout
pcb: add small capacitors for decoupling
pcb: integrate Arduino more
pcb: split pcb in two for better shipping etc? multiple parts, max 100*80 to also enable eagle free software
pcb: add designators for capacitors! value, type and placement. For all components!

power: work on a DC adapter solution
power: replace the 6 3300’s with 6×1000’s because 2×3300 seems to be enough power

functional: Have “standard” switchable (flip switch) connections between vCO’s VCF VCA and mix out
functional: Dual/triple VCO mixer
functional: all individual modules with dedicated cv and audio paths? Save in shipping, saves in prototyping costs.
functional: have a module connector with +9v, GND, -9v and 4 audio and 4 cv paths. Modules can grab audio or cv from one of the paths and return audio or cv on the paths.
functional: 4 oscillators with LFO switch
func: digital LFO using Arduino

vcf: 560nF -> 560pF
adsr: replace 10uf with 10nf or 1nf
adsr: R72 -> 1k
adsr: R86 -> 1k
vca: 1n34a -> 1n60 (1n4454)
vca: QUAD_OPADMPP TL274-6A should be non-inverting
vca: add 100ohm to GND and 1000uF to GND inbetween TL274-6C out and THAT2180A pin 2.

edusynth, the boards!

Boards have arrived from China, Fast service! Ordered 10 board 24 hour rush on friday night because of Chinese new year and tuesday (today) the boards have arrived already. Boards look great, unfortunately green because of the 24h rush service but good quality.  20160202_212549 copy-1600  Unfortunately I made some errors, which I’ll document here for future reference.

The picture above shows the board missing Eagle layer 25 (tNames) which I used to designate the input and outputs pins… Illustrated below:


The Gerber file for production was created (by me) without this layer. I have to better check the Gerber’s in the next round.

20160202_212606 copy-1600

The holes to mount the board are only 2mm which seems too small to be of actual use. Well, during construction of the boards I might find a handy solution. Next time: bigger mounting holes. Also, the holes for the capacitors are too small. Update the capacitor footprint for the next time.

20160202_212619 copy-1600

The footprint for the various pots have a small error. The drilling holes for the three connectors are as big as their soldermasks, resulting in soldermasks being completely drilled away. Measurements with a DMM indicate that the holes will work because of the through plate connection. Next time: fix footprint for pots

20160202_212717 copy-1600

Last one (rotated). Some traces are very close to the edge of the board. Extend the board a little with regard to the traces.

Now on to the actual construction!

edusynth, getting there!

Making progress! Because of the start of a new semester at my university, I tried to finish a first version of the edusynth. And, also to my own amazement, I did! Here’s a first 3d brd view of the eagle file:


Dual VCO, VCF and VCA. Dual ADSR and a number of OPS (CV, mix and split). Board are ready according to pcbway – I’m waiting for delivery… First try outs to follow. Also, the edusynth is full open source / open hardware thus schematics and code also underway.

Senk, a 5v µModular

Been busy building a 5v µModular system for students to learn about and experiment with sound. Design should follow the classic synth setup like for example a Minimoog, with added patchpoints. Part of the design is finished, as follows:


Input of [1] is an Arduino PWM wave. This wave is passively filtered to a DC voltage (ranging from 0v to 5v). This resulting voltage will be one way to drive the voltage controlled oscillator. [2] is necessary to shift the voltage to a more musically interesting range including lower frequencies (-2v to 3v). The range is not amplified to i.e. -5v to 5v because the Arduino PWM only has limited resolution (10 bit = 1024 values). The shifted voltage is inverted because of the sawtooth oscillator under [4].


[3] shows the voltage scaler (1v -> ~18mV) and the exponential converter as already discussed on  The 1k tempco should be coupled to the CA3046 array.


and finally [4] shows the sawtooth core for the Senk. Previous designs of me had an inverting schmitt trigger followed by an inverting buffer in the waveform reset loop. This design features a non-inverting schmitt trigger, sidelining the inverting buffer and a number of resistors. Deploying of the BC550 resulted in the best waveforms, as shown by this youtube video:

Next features I’m working on:


Oscillator pulse out, oscillator sub out and mixer section.

Screen Shot 2015-12-08 at 22.23.45

Mixed waveform looking cool in simulation :) Output needs AC coupling.

A temperature controlled CA3046

So, finally started work again on the heated CA3046. First, the results of the previous post regarding the CA3046 were reexaminated. Indeed, when building the schematic from that post: tempchip

and heating that circuit with a hair dryer:

the base voltage of the NPN transistor changes along with the temperature.

The next step I took was connecting that output to an opamp comparator to be able to switch a heating circuit on and off. Passing a certain voltage level, should turn off the heater. Tested with LED’s and, once again, the hair dryer:

Ah, nice! The heater section is inspired by one of the (great!) electronotes from the past (S-019). The LED section of the circuit was given an own comparator because the heater and the temp sensor are in so close balance, that the opamp doesn’t switch to negative.

And the result, the schematic:

Screen Shot 2015-10-29 at 12.29.47

Nice touch (I think) is that the circuit contains 2 LED’s: one is lit when the CA3046 is not at temperature and the other lights up when the CA3046 is at temperature (because of the comparator U1).

Next step: combine this heater with the actual exponential converter circuit.

Oh don’t forget to GND the substrate of the CA3046 (pin 13). Update: or should this be the most negative potential (-15V?). Better be sure before connecting that CA3046…

SSHing to a Raspberry Pi behind a firewall (Eduroam)

The firewall at my university (Eduroam) prevents direct connections between two computer on the network on all ports. SSH-ing to an other computer is therefor not possible. However, when a connection is ESTABLISHED, this connection can be reused – for example the other way around! Let’s work on this.

Requirements: rpi, external server

Automate your ssh login from your rpi to your external server using (this link). Execute these commands using “sudo” because the startup script we’re going to edit is run as root.

edit /etc/rc.local and add:

ssh -fN -l [username] -R 2210:localhost:2222 [external server ip]

The 2222 is the ssh port on my rpi. Your rpi could use 22 (default) or any other port. The 2210 is the loopback port (per this link). Upon reset, this line should be processed without errors. Then, on the external server, connect back to the rpi using:
ssh -l pi -p 2210 localhost

and your ssh session is available!