|
ARDUINO NANO |
x 1 |
Arduino ADSR Digital Envelope Generator
It's incredible how many things you can accomplish with (as per today standards) tiny processors like ATmega328p with the essential help of open hardwares (who said "arduino!") and softwares. It's even more incredible how astonishing results one can have without the need to be a professional in the sector of circuit design or a full time programmer!
Some day ago I have had just the time to have fun by tinkering with an arduino-based wavetable oscillator that another brilliant project catched my attention: a digital, ADSR envelope generator running on arduino nano.
In this instructable I will show you the shield I have designed and the code modifications I have done starting from a brilliant project from "m0xpd" called ADSRduino.
Background and Features
The base code of this project is a "m0xpd" (Paul Darlington) work and all credits are due to him. His ADSRduino project was more than an inspiration here, since I could learn a lot by "studying" the code he shared with us.
This project is not a mere copy of that, anyway, and I modified it towards my needs.
First of all, with respect to the original project, I made some pins swapping to have the shield compatible with a 492X DAC library so that we can change the envelope firmware with two different approaches: by modifying m0xpd code, or eventually relying on such library.
More interesting is the extention of envelope curves. The original project outputs a classic ADSR envelope, in two different modes: "normal" or looped (a.k.a. retrigger). In addition to this, I coded a "biased semi-invertion" mode to the envelope, just to show that we have only scratched the surface.
Hardware and Design Choices
The hardware mainly consists of an arduino nano (ATmega328p) and a MPC4921 digital to analog converter.
As I said, pins are wired differently from the original project because I wanted the shield to be also compatible with arduino MCP492X library. This library is based on default SPI library and use those specific serial programming pins.
In particular (function, original project pin -> new pin)
/CS, 6 -> 10 (could be any pin, hardware design choice)
SCK, 5 -> 13 (nano SCK)
SDI, 4 -> 11 (nano MOSI)
/LDAK, 8 -> 9 (could be any pin, hardware design choice)
Gate In, 2 -> 8
Loop mode, 3 -> 2
You can switch between loop mode and single envelope mode with a latching switch connected to D2_LOOP; you can switch from a classic ADSR mode to a biased semi-inverted mode with a latching switch to D3_INV.
Another slight hardware modification from the original project is the voltage limiter circuit, the original being a 5.1 zener diode to ground. This one is instead based on two schottky diodes as per Doepfer notes.
A hardware switch input to trigger the envelope has also been introduced here. It's a simple switch that pulls to +5V the gate input as far as it is kept pressed. Notice that to have this working even without a gate signal grounding the pin at rest, I had to add a pulldown resistor to the microcontroller gate input (D8). As an alternative approach, I could have assigned one of the already wired spare microcontroller pins for this function and solve with two additional lines of code, but it's a simple hardware modification and avoids cpu load so it was a no brainer.
Even if the shield is built around the original ADSRduino project, being open firmware we can thing at modifications/implementations to it. This is why I also wired 4 digital and 3 analog additional pins (all left unused in the original sketch), for future uses/sketches.
Note that all digital inputs (gate_in excluded) are not voltage protected, so if you will use them to input any control voltage from an external module not working in the 0 - 5 V range you should consider to add an external voltage protecting circuit.
Even if the board is equipped with a full 8x2 IDC connector, this projects is powered by +5V only.
Sketch and Biased Semi-Invertion
The code is well documented both in m0xpd dedicated page and the sketch itself. It's verbose (in a good way!) and you should read it: it's great value. I kept my additions as verbose as possible, just to simplify future mods.
The envelope invertion coded is not exactly the ususal ADSR invertion, but what I should probably call a "biased semi-invertion". Works like this:
- Attack phase starts at maxium, positive value (+5V) and goes down to "zero" according to user defined velocity
- Decay starts at zero and drives to sustain level (not an inverted sustain level!)
- Decay starts from sustain leven and drives toward zero (not +5V).
All levels/times are set by acting on dedicated potentiometers.
It's "biased" since voltage is always in the 0 - 5V ballpark and doesn't go negative.
Here follows a link to the "modified" sketch (github). Upload it to your arduino NANO the usual way:
https://github.com/baritonomarchetto/Programmable-Envelope-Generator
I also made a simple sketch to check DAC functionality: it loops the DAC output to 0V, then 2V, then 5V at a frequency of 1Hz. This comes handy if you have the suspect your DAC is malfunctioning. You will find this sketch at the previous link too.
Would it be possible to code a classic inverted envelope without additional hardware?
Well, yes and no. For what concerns the release driving toward +5V instead of 0V, there are no problems. It can be easily done with a couple of lines of code if you want to keep the semi-invertion option too, or even easier if you don't. Another story is having the envelope span the 0 to -5V range with the current hardware. This could be achieved with the addition of an opamp in inverting configuration at the DAC output, anyway.
Hey: the silkscreen shows an ASDR envelope, not ADSR!
Glad you noticed it, yes, that's another "special" feature I will describe in a week or two because I have not the time now, must deal with climate changes, overpopulation and things like that, you know... nuclear holocaust eventually? Are you still reading? ehm ... ok. A feature is not. Sorry. What a fool. I moved without the needed attention the envelope phases names wrong during the n-th redistribution of components. Good eye anyway :)
Don't worry: the linked board has that error fixed (and many improvement too)!
Components List
Please notice that the uploaded Gerber files and the following BOM are those for an updated and upgraded version of the ADSR (version 2) with overvoltage/inverse voltage protection and fully inverted output. Pictures of the actual, populated PCB are those of version 1.
All components values are silkscreened on the PCB to make assembly easier.
Here is the list of components required to populate the PCB:
Microcontroller, DAC, Op-Amp
- 1x Arduino nano 328p
- 1x MCP4921 12 bit DAC
- 1x TL072
Capacitors
- 1x 0.10 nF non polarized
- 1x 0.47 nF non polarized
- 3x 100 nF non polarized
- 2x 10uF electrolitic
Resistors, Potentiometers
- 4x 10K ohm ressitors (up to 100K ohm should work)
- 1x 100K ohm resistor
- 1x 10K ohm resistor
- 1x 220K ohm resistor
- 1x 330K ohm resistor
- 1x 4.7K ohm resistor
- 3x 1K ohm resistor
Diodes
- 2x BAT43 Schottky
- 1x 1N4004
Others
- 1x IDC connector female 8x2
- 2x 8 pin IC narrow socket
The board is intended to be mounted perpendicular to the front panel. If your synth case is not deep enought, you can lock the board on the case bottom and use wires to gain electrical connection with elements (potentiometers, buttons, jacks and so on) on the front panel.
Arduino ADSR Digital Envelope Generator
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Marco Guidolin
- Arduino Voltage Controlled Wavetable Oscillator Lurking for a simple digital filter for my modular synthesizer, I got aware of the existence of a li...
- Kurzweil K1000 K1200 Display Replacement PCB IntroductionThe Kurzweil K1000 is a classic synthesizer series that was produced from 1988 to 1992. ...
- Variable Waveshape Low Frequency Oscillator One of those modules you should want in your arsenal when starting a "DIY modular adventure" is the ...
- Discrete Voltage Controlled Amplifier Together with the Power Supply Unit, Voltage Controlled Resonant Filter and ADSR, another modular's ...
- Arduino ADSR Digital Envelope Generator It's incredible how many things you can accomplish with (as per today standards) tiny processors lik...
- Voltage Controlled Multimode Resonant Filter After getting my hands dirty with a linear Power Supply for my modular, it was time to develop a PCB...
- BA8 - Power Bus Bar While designing the Linear Power Supply PCB, I forced myself to keep dimensions within the 10 cm x10...
- ALR350 - DIY Linear Regulated Eurorack Power Supply Modular synthesizers are extremely attractive objects. With the right selection of modules, they giv...
- ArcadeHID - Multi HID Interface for Arcade Projects IntroductionIf you are an arcade enthusiast you surely know how important is to have the right perip...
- Korg PME40X External Selector "Clone" DIY Korg PME40X External Selector "Clone"I am a PME40X user, and I like this multi effect very much....
- CompuLab - a DEC H500 Inspired Logic Trainer CompuLab is a simple logic trainer I designed as a labour of love for one of those "ancient" pieces ...
- Arcade Jamma Prototypes Development Board Contrary to what one would expect, the Arcade world is not dead but growing thanks to thinkerers com...
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
113 0 0 -
DIY Laser Power Meter with Arduino
163 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
156 0 2 -
-
A DIY Soldering Station Perfect for Learning (Floppy Soldering Station 3.0)
563 0 2