Tag: diy

  • Looper Version 1 Complete

    If you’ve been paying attention to this site, you’ll have seen I’ve been working on a eurorack looper for sometime. The first version of this is now done. You can find the source code here.

     

     

    What is it?

    A looper module in the eurorack format inspired by the MLR app which ran with the monome. It records audio to an SD card, so is not limited by RAM constraints. It supports unlimited overdubs, only limited by headroom (e.g. if you layer over too many overdubs, the audio will begin to digitally clip). Once the loop is recorded, you can switch from Record Mode to Play Mode. This allows you to ‘cut’ the loop using the 8 buttons. Each button will jump to a section of the loop, essentially dividing the loop into 8 equal size segments.

     

    How does it work?

    The version shown in this video uses Version 2.0 of my Teensy 3.5 based audio board. This uses the in-built ADC and DAC to process audio. The audio is recorded to SD card. As SD cards are rather slow, especially when writing, I need to use 2 circular buffers. One for reading audio, and one for writing. SD cards are slightly unpredictable in terms of read and write speed (e.g. writing the same size block can take varying amounts of time each time you do it), I had to experiment to get buffer sizes that worked. These may need to change when using other SD cards.

    I achieve overdub by keeping 2 copies of the audio loop, whilst one is being played, the other is being written to. At the end of the loop, the files are swapped (read file becomes write file and visa versa), and the loop starts again. When the Record button is pressed again, to engage overdub, the incoming signal is added to the recorded signal, and written to the write file.

    I designed a separate PCB to deal with the 8 LED buttons. This communicates with the Teensy via I2c. The code is here. It uses a technique borrowed from the Le Strum by 64pixels which uses a shift register to scan the buttons and turn the LEDs on and off. Take a look at this schematic to see how it’s setup. Essentially a single bit at a time is shifted all the way through the 8 bit shift register. Each output of the shift register is connected to the LED and the switch of one of the buttons. So the single ‘bit’ will visit each of the buttons in turn. For each button we can read the value of the switch (is it pressed or not), and decide whether to turn on the LED or not (this is done by turning on the transistor). This is done very quickly, so you can give the impression a button is continuously lit, even though it is actually flashing on and off very fast.

     

    What’s next?

    I’m already working on Version 2 of this looper. I’ve split the buttons out onto a separate module which I plan to mount horizontally in the 1U section of my eurorack case, to save space in the 6U section. Features of the upcoming version 2 are.

    • Separate audio codec (WM8731) for improved sound quality,
    • CV control of the module, will allow for gates to control loop position, as well as controlling some of the functions mapped to the dials.
    • Option pedal input so you can record without having to press the button.
  • Case and new module finished

    Nothing is more motivating than an imminent deadline, and my gig in Berlin served as a good end point to get my new case finished, and a brand new module into it.

    The case was built out of a Habitat trunk, see more details here. I’m pretty pleased with how it turned out. It’s nice and light, and hopefully pretty sturdy. It survived the flight back from Berlin anyway.

     

     

    The new module is actually just a re-working of the GlitchDelay, but it’s using the new PCB I’ve designed. Which uses Teensy 3.5 (again) coupled with an external WM8731 codec (for reduced noise), and has 6 buffered CV inputs. It’s all SMD to keep the size down. The idea is that I’ll be able to produce different front panels, for different module functionality, but keep the back panel the same. I laser cut a panel on ply-wood for the first time. The contrast between the etched and non-etched material is much higher than with the acrylic, which I like.

     

     

    Next on the agenda is to modify the case to squeeze a row of 1U modules in. Ideally I can just use this case, with external noise boxes/instruments when playing out live.

  • DIY case almost ready..

     

     

    Happy Easter! I’ve spent my time off crafting a DIY case to house the modules I’ve been building. As I’ve been trying to perform using only DIY instruments and effects I’ve built myself, then as Jedi must craft their own lightsaber, it seems fitting I should create my own case. Actually, I already have my Chilli Box case, but I’ve rather outgrown it, size-wise.

    The case is based around a Habitat trunk which I got in the sale. I used aluminium rails from Mouser, which I set M2.5 nuts into. I cut these down to the correct length with a hacksaw. These were then mounted onto an aluminium mounting frame from Thonk. The frame went together ok, although, getting the supplied bolts to cut a thread into the aluminium rail was a bit tricky, and I managed to rather chew up the head on one of the bolts. Hopefully I don’t need to get that out again!

     

     

     

    The trunk case has a lip all the way around so I ‘plugged’ this by screwing a block of wood on each side, flush with the lip, that I could then mount the frame into.

    The power supply was just a cheap Chinese board from eBay (TPS5430), that I added a couple of extra filtering capacitors to, and then used Vero board to mount header to for the ribbon cabled to connect to. The filtering caps were 100uF and 10uF, chosen more due to what was on hand than by any form of science.

     

     

     

    Still need to mount and test it with all my modules, let’s see what new and exciting problems that brings..

  • Fun with audio codecs

    For the past few months (yes, it’s a slow process), I’ve been working on a new version of my Teensy based eurorack boards. Whereas my previous boards have used either the Teensy’s built-in ADC and DAC, or the PJRC audio shield, this one uses a separate chip, known as an audio codec, called the WM8731, to perform these duties. The benefits are increased audio quality over the built in ADC/DAC, without the need of the more expensive, and physically large, audio shield. It’s been a bit more challenging than I expected. The first PCB prototype I had made had a number of issues with it. Some were just careless mistakes, others originated from a lack of understanding of the WM8731, and how it uses I2C and I2S protocols. My first board is a mess of soldered on wires and extra resistors to fix issues. It was a useful learning experience, and allowed me to fix the errors and produce a new PCB. Today though, I finally got everything working.

    The main difficulty was that debugging digital chips is hard. If you don’t set everything up correctly it just doesn’t work. Then you’re left scratching your head trying to get to the root of the issue. Is it the circuit that’s wrong? The soldering? The code? Did I burn out the chip when soldering? This meant the whole process took a long time. Also, the chip is SMALL. It’s 0.5mm pitch which is quite tricky to solder by hand. This is my first fully SMD board, so I’m a bit of a novice with SMD. Most of the other components where fine, but this one was a real pain. I tried ‘drag soldering’ which people say is ‘easy’, but I found I just bridged all the legs together. So I opted for slowly and painstakingly soldering each leg, accompanied with copious swearing!

    I’ll post more details on this as I develop it. First job is to port my current effects to this board, and incorporate 6 CV inputs. Finally, I’ll be able to make use of one of the main advantages of modular!


  • Redux the redux

    I’ve had a couple of interesting comments on my AudioFreeze/Glitch Delay module which have contributed to revising the PCB, details of which can be found here.

    1. Why is it so big? Good question! The original AudioFreeze is pretty wide, and that’s because the PCB itself is pretty much that wide. I set out to create a smaller PCB.
    2. Why not use the second ADC on the Teensy 3.6 instead of the separate PIC chip? Well, mainly because I’d missed the fact that it had 2 separate ADCs, but I’d been led to believe that this was not possible by people on the Teensy forum, it turns out it is possible, but it’s not totally straightforward.

    Here’s the finished, reduced size module

     

     

    Reducing the size of the PCB

    Getting rid of the PIC chip reduced the number of components, which meant the PCB could be smaller. Also, I split the module into 2 PCBS. One which has the Teensy on and the audio and power circuits, the other has the interface, the pots, jacks and buttons. The PCBs stack, separated by header and copper spacers.

     

     

    Removing the PIC chip

    The previous version of the board employed a PIC chip to read all of the potentiometers and pass the values back to the Teensy via I2C. It transpired it was possible to achieve this all on the one board, see here for source code. The ADC library for Teensy allows you to access the 2 ADCs on the 3.6 individually. There are currently a couple of issues with this in the Teensy libraries. One of them is that it’s very important the ADC is initialised before the Audio Library (see struct IO – this enforces initialisation order). Secondly, the Audio Library runs at a reference voltage of 1.2V. Because the potentiometers are connected to the 3.3V line, you need to set a different reference voltage for the 2nd ADC. There is functionality to do this in the ADC library, but it doesn’t work (for a couple of reasons, which I’ve raised on the Teensy forum here). I fixed this by setting the registers directly (see set_adc1_to_3v3())

     

    Power issues fixed!

    The previous board also had issues where it just wouldn’t start up when connecting to certain power supplies. It turns out, this is due to the time it takes for the 12V line to stabilise. If it takes to long, the 5V line won’t be at 5V whilst the Teensy boots, and it crashes. This explains why, if I powered the Teensy over USB and Eurorack power, then removed the USB, it solved the problem, although felt like ‘jump starting’ it, like an old car! Thanks to the Teensy forum and BCP Music for this information. The solution was to use a voltage supervisor (MIC803). The keeps the Teensy in ‘reset’ until the supply has stabilised.

     

    So far I’ve made up 3 of the PCBs, all running different firmware (shown here in a DIY case, with a combination of aluminium and laser-cut acrylic panels).

     

  • Glitch Delay – How it works part 1

    The Glitch Delay is the Teensy based eurorack Delay module I designed that you can read more about here. The video shows what it sounds like, but I thought I’d go into some more detail about how it actually works, and how I went about designing it.

    The Hardware

    The brain of the module is the Teensy 3.6. The code running on the Teensy uses the Teensy audio library, and implements a new AudioStream. Because the in-built ADC of the Teensy is used by the audio library, we need another way to read the potentiometers, this duty is performed by the PIC. The PIC reads the pots and communicates the values to the Teensy via I2C (a well supported and fairly simple protocol for inter chip communication). Op-amps are used on both the input and the output to scale voltages up and down. You can find the complete schematic here, but I’ll go into detail on the major sections below. Many elements of this schematic are cribbed/stolen from other open source schematics. I’d highly advise checking out the circuits behind the Music Thing and Mutable Instruments modules whose schematics are all up on GitHub. I’m a relative beginner when it comes to electronics, so it’s highly likely there are elements of this schematic that are not best practice or wrong in some way, feel free to email me with feedback and corrections!

    Audio input/output

    Audio schematic

    Audio In

    The purpose of this section of the circuit it to scale the modular audio signal from (-5V to 5V), into (0 to 1.2V). 1.2V is the voltage of the internal reference in the Teensy. 5V is added to the incoming signal to bias it to be 0V and above. This circuit is an op-amp summing amplifier similar to this.

    When Vin = -5V
    Vout = ( -(5/8.3) + (-5/8.3) ) = -1.2V (approx)
    When Vin = 5V
    Vout = ( -(5/8.3) + (5/8.3) ) = 0V

    As you can see, this has inverted our signal (the op-amp is in an inverting configuration), so the second op-amp inverts it back again with a gain of 1 (e.g does not change the magnitude of the voltage, it simply inverts the signal)

    Audio Out

    On the way out we want to do the exact opposite. Scale from (0 to 1.2V) to (-5V to 5V) this is achieved using a simple inverting op-amp.

    The gain of the circuit is:
    Gain = -(Rf/Rin) = -(100/12) = -8.3
    Max voltage from Teensy = 1.2V
    1.2 * -8.3 = -10V (approx)

    As you can see, this inverts our signal, so the signal is passed through another inverting op-amp with gain 1. The output of this chain will be (0V to 10V) (actually 9.6V, because we are limited by available resistor values). There’s no need to bias, the output capacitor AC couples the output, blocking direct current. Meaning the output signal is centred around 0V, and therefore (-5V to 5V) again.

    I found the power line to be quite noisy. I tried using an external voltage reference, instead of the 5V power from the regulator but didn’t notice much improvement. Everything is fine if the gain-staging is sound. However, with very low input volumes/voltages you will hear noise when you amplify the output. In future I would add a trimpot or panel pot to adjust incoming voltage (e.g. R1).

    Teensy

    Teensy schematic

     

    The Teensy’s main duty is to do the audio DSP. It is connected to the PIC chip via I2C. This uses the SCL and SDA pins on the Teensy (with pull-up resistors to the power line). See here for more information. On the Teensy this is supported through the Arduino Wire interface, and is very straightforward. I shall go into more details on the software running on the Teensy in future posts. The Teensy also controls the LEDs and reads the push switches. There are lots of pins on the Teensy, so it seemed best to connect them here. It could have been done with the PIC, but there aren’t enough pins so you’d need to use a multiplexer.

    PIC chip

    PIC schematic

     

    The PIC chip is connected to all the potentiometers. It reads their values and passes the data to the Teensy via I2C. I’ve connected the programming pins to header so it can be programmed on the board. There’s also a connection for an LED for debugging purposes. Neither of these are strictly necessary, but are very useful at the prototyping stage. The capacitor to ground on the power line is as per the data sheet, presumably to deal with minor fluctuations in voltage.

    PCB design

    All of this was designed in the free version of Eagle. A very powerful, but rather infuriating piece of software (the UI leaves something to be desired, although is getting better). After you’ve designed the schematic you have to layout the board. This is a fun and at times tricky puzzle game. You need to route all of your connections without crossing over another track on that layer. You can use vias to change to another layer of the board which makes things easier. It’s definitely worth spending some time experimenting to get a layout you are pleased with. You’ll end up with something that looks like this.

     

    Glitch delay board layout

     

    You can then send it to a PCB fabrication house to get it made. I used Hackvana, who I was very pleased with. There are a number of alterations I would make on a future board, a major one being that the power connector is too close to the Teensy, meaning I have to improvise a little on the connections. That said, it did work first time, which isn’t bad for a board of this complexity.

     

     

    In further posts I shall go into a bit more detail about how the software works, and further developments.

  • DIY Sriracha Eurorack Case

    This weekend I built a DIY Euroack case out of a cheap tin lunchbox from eBay. I want this case to house some of my Teensy based modules and form an all-in-one guitar focused effects box. The project was reasonably straightforward. I used one of these power boards which supplies +12v/-12V from a 14-24V DC power supply. The board that the ribbon cables connect to is vero board with single header, doubled up. Everything was mounted using 11mm M3 brass stand-offs. The wooden rails are possibly a little thick and will limit the size of the PCB under the module panel. Will have to see how that goes. Putting in thinner rails should be feasible. All holes drilled with my new pillar drill. Much easier, with far less swearing than trying to use a standard power drill. The overall project build cost was around£20. Looking forward to filling this with my DIY modules!

     

  • MIDI Mustard

    For my gig at Thee Sunday Sonics this weekend I decided to make a new USB controller. I was previously using one with many more buttons and knobs than I actually needed. For this project I used the Teensy LC. A low cost version of the Teensy (around £10). It has less memory and computation power than the 3.2, but more than enough to make a simple USB MIDI controller. I used a mustard tin to house it all in. It’s suspended inside using these. It worked a treat in practise but for some reason on the night of the gig (typically), in soundcheck it stopped working and seemed to be interfering with my other controllers. Luckily I bought my previous controller as a spare. Still not entirely sure what the issue was (it works fine again now). My best guess is that there was some form of power issue. I’m hoping to be able to recreate in an environment that not on-stage so I can actually resolve it.

     

     

    Once I’d reverted to my spare everything was fine, and the gig went well. Thanks to Thee Sunday Sonics for inviting me, it was lots of fun.

     

    [EDIT] I’m fairly confident I’ve solved the problem. The software wasn’t consuming and discard MIDI messages it received, only sending its own messages. Updated code on GitHub

  • Glitch Delay – more progress

    I’ve been working pretty hard on my glitch delay module the last few months. As you may remember it’s sort of a cross between my previous AudioFreeze project and a digital delay. It consists of a delay line with a write head and a read head. The difference being the read head is basically looping a tiny buffer behind the write head. This is implemented using 2 read heads which crossfade between each other to avoid popping. It has 2 modes now. The loop window either moves through the buffer, or statically jitters, at a rate controlled by a pot.

    My original experiments were with a Teensy 3.2, but its rather limiting 64k of memory meant I only had about half a second of audio buffer. I’ve now moved to using the Teensy 3.6, which has a whopping 256k of ram! I’ve also implemented 12-bit audio (2 samples stored in 3 bytes), which gives me an audio buffer of around 3 seconds, which is enough to get nice repeating loop effects. I’m using the PCB board I designed for my AudioFreeze project which was designed for Teensy 3.2. The 3.6 is twice the length, but by crafting a tower block of female header I was able to raise the Teensy over the height of the ribbon power connector.

     

    img_0919

     

    Initially I had a very peculiar issue where the module would only work when powered by USB, not when in the modular case. Weirdly, when I was putting the multimeter on it, to test power was getting to the board (which it was), it would sometimes startup, and then work fine. It turned out the case wasn’t supplying enough current. The Doepfer power board only supplys 50mA on the 5V rail, and 100mA on the 12V rail. I tried making a small add-on board with a voltage regulator on, so I could you the 12V power, but it still wasn’t enough. I ended up adding a separate power board, and powering it with a 5V wall adapter directly.

     

    img_0937

     

    With all the extra processing power the 3.6 provides I was able to create 3 separate play heads, all looping audio at different pitches which is mixed together. One plays at 1/2 speed (1 octave down), one at normal speed, and one at double speed (1 octave up). Currently the mix ratios of these are fixed as I’ve run out of knobs on my board!

    Here’s a very simple demo, you can hear the acoustic sound of the guitar in this video, normally I’d want the effect to be totally wet, but it does serve to show you what the original audio is doing..

     

     

    This diagram shows how the processing blocks are organised. It’s the glitch delay block that’s really doing all the work.

     

    I actually played with this live at my last gig at Spirit of Gravity. I hope to incorporate it into my material more when I’ve properly learnt to play it! Next up, I may try to add CV control to all the parameters. I’d also like to move away from using the audio shield, as I’m not really taking advantage of the 16-bit DACs/ADCs. I’m really only using it so I can use the Teensy ADC to read the pots. I’m planning on designing a new PCB and using a PIC chip to handle all of the pots and CV interface stuff and then connect that to the Teensy via I2C, but I’ve no experience of that, so that’s a whole new adventure!

     

    fullsizerender

     

    As always, code is here

  • Build your own AudioFreeze

    I’ve added the Gerber files to GitHub so anyone can build the module if they like. As a disclaimer this module should be seen as a prototype. IT HAS NO POWER FILTERING OR SHORT CIRCUIT PREVENTION, if you plug the ribbon cable in the wrong way you may damage the board and potentially your other modules. Also your case must supply 5V power (some don’t). As this was my first PCB I wanted to make it as simple as possible. I’m merely making it available as a resource for people who want to make their own boards. If you do build your own I’d love to see it. Please tweet me @scolar any pictures or videos!