Euclidean Polyrhythm generator - code and details

From circuitbending to homebrew stompboxes & synths, keep the DIY spirit alive!

Moderators: Kent, luketeaford, Joe.

Post Reply
User avatar
duff
Veteran Wiggler
Posts: 748
Joined: Sun Mar 10, 2013 2:21 pm
Location: UK

Post by duff » Mon Dec 19, 2016 5:48 am

I can probably replace the power ic but I don't have any on hand. I'll grab one later as there is another project I want a nano for.

The PCB is made by thx2112 and there appear to be various successful builds. It also works fine on a fair few of my modules so it could be that I am the first to find it - I'd also never rule out the possibility that I have introduced the problem somehow!

User avatar
Grumble
Super Deluxe Wiggler
Posts: 1817
Joined: Thu Dec 17, 2015 5:24 am
Location: U aint much if U aint Dutch
Contact:

Post by Grumble » Mon Dec 19, 2016 6:47 am

duff wrote:The PCB is made by thx2112 and there appear to be various successful builds. It also works fine on a fair few of my modules so it could be that I am the first to find it - I'd also never rule out the possibility that I have introduced the problem somehow!
Well the good thing is you found out that triggering a module with a restive input works, but triggering a module with a capacitieve input wont.
But what you could try is to have a resistor (say 10k) parallel at the output (soldered on the connector between the actual output and ground) this way there is always a path for the current to flow even when connected to a capacitieve input module.

User avatar
duff
Veteran Wiggler
Posts: 748
Joined: Sun Mar 10, 2013 2:21 pm
Location: UK

Post by duff » Fri Dec 23, 2016 8:32 am

New nano turned up and I now have this running with just a 1K resistor between the nano pin and the jack. This seems to trigger everything I have tried - including all the modules that failed to trigger previously and most of those that did. Thanks for help Grumble.

Just need my encoders to arrive now - 5 weeks and counting - to actually finish it completely. [If someone in the UK has 3 spares they want to trade get in touch]

User avatar
Grumble
Super Deluxe Wiggler
Posts: 1817
Joined: Thu Dec 17, 2015 5:24 am
Location: U aint much if U aint Dutch
Contact:

Post by Grumble » Fri Dec 23, 2016 9:20 am

:tu:

User avatar
nevetsokyeron
Wiggling with Experience
Posts: 306
Joined: Sat Mar 12, 2016 10:38 pm
Location: Austin TX
Contact:

Post by nevetsokyeron » Thu Dec 29, 2016 1:22 am

Built!

Although I had some problems with my Nano not taking the program - turns out it was a lifted pin on the Nano Atmega chip.

Image

Now - can someone explain what the encoder buttons do?
EDIT - I think I figured out the encoder buttons now that I have my LEDs corrected.

Hooray! :bananaguitar:

User avatar
nevetsokyeron
Wiggling with Experience
Posts: 306
Joined: Sat Mar 12, 2016 10:38 pm
Location: Austin TX
Contact:

Post by nevetsokyeron » Fri Dec 30, 2016 4:18 am

I'm not getting any output on the #2 jack.

What's my most likely culprit? The 2n3904 ?

User avatar
Grumble
Super Deluxe Wiggler
Posts: 1817
Joined: Thu Dec 17, 2015 5:24 am
Location: U aint much if U aint Dutch
Contact:

Post by Grumble » Fri Dec 30, 2016 10:08 am

Why anyone would use a trannie there is still a mystery to me :eek:
Especially if you need no more than 5 volt to trigger the rest of your synth, just use the outputs of the arduino with a 1k resistor in series.

User avatar
sneak-thief
Ultra Wiggler
Posts: 974
Joined: Sun Feb 20, 2011 11:13 am
Location: Berlin

Post by sneak-thief » Fri Dec 30, 2016 2:29 pm

Grumble wrote:Why anyone would use a trannie there is still a mystery to me :eek:
Especially if you need no more than 5 volt to trigger the rest of your synth, just use the outputs of the arduino with a 1k resistor in series.
Because negative voltages can kill unprotected microprocessor input pins. One accidental patch of say an LFO output to the output pins of the arduino (even with a 1k resistor) could potentially break it.
http://involucija.org - post-industrial euphoric deprogramming. LP coming soon on a+w.

User avatar
Grumble
Super Deluxe Wiggler
Posts: 1817
Joined: Thu Dec 17, 2015 5:24 am
Location: U aint much if U aint Dutch
Contact:

Post by Grumble » Fri Dec 30, 2016 4:20 pm

All input pins of the atmega have protection diodes to protect the inputs against voltages exceding the vcc or going lower as gnd potential.
Besides that, the transistors are at the output....
And there are a number of diagrams floating around in this thread with various mistakes and errors. That is very confusing.
Plus: the outputs can source and sink, so that is low impedance compared to 1k.
I will investgate this, I'll take an attiny13 and connect the output via a 1k resistor to a negative voltage and observe when the outputpin will die.

User avatar
sneak-thief
Ultra Wiggler
Posts: 974
Joined: Sun Feb 20, 2011 11:13 am
Location: Berlin

Post by sneak-thief » Fri Dec 30, 2016 10:07 pm

Grumble wrote:All input pins of the atmega have protection diodes to protect the inputs against voltages exceding the vcc or going lower as gnd potential.
Besides that, the transistors are at the output....
And there are a number of diagrams floating around in this thread with various mistakes and errors. That is very confusing.
Plus: the outputs can source and sink, so that is low impedance compared to 1k.
I will investgate this, I'll take an attiny13 and connect the output via a 1k resistor to a negative voltage and observe when the outputpin will die.
Modular levels can often reach -10V, and accidentally plugging an output to an output is always possible. A 1k may protect an output, but Atmel clearly states not to send out of spec voltages. Why take a chance? I even once saw the +/-15V version of a Papareil polivoks filter hit -15V. Piezos can reach even higher.

Not to mention, professionally manufactured ATMega328p modules like Grids use transistors or opamps on the digital outputs. Better safe than sorry.

As for conflicting schematics, what's the fuss? Welcome to synth DIY. People can choose to read the thread and go with the most recent tested one I posted on github or take a chance on the later versions that others posted.

Or better yet, they can ask which schematic is recommended if they're confused.
http://involucija.org - post-industrial euphoric deprogramming. LP coming soon on a+w.

User avatar
Grumble
Super Deluxe Wiggler
Posts: 1817
Joined: Thu Dec 17, 2015 5:24 am
Location: U aint much if U aint Dutch
Contact:

Post by Grumble » Mon Jan 02, 2017 6:40 am

DISCLAIMER: I take NO responsibilities whatsoever when the Atmel processors are used outside their suggested voltages as stated in their datasheets provided by ATMEL!!

Ok, so I did some tests this morning, using this program:

#define F_CPU 9600000L
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
DDRB |= (1<<PB3);
while(1)
{
_delay_ms(1);
PORTB ^= (1<<PB3);
}
}

and a minimum components diagram, using an Attiny13 with a resistor of 22k going from reset to Vcc, a 100nF capacitor between VCC and GND and a resistor of 1k connected to PB3.
I applied a voltage to the current limiting resistor of 1k and measured voltages directly at PB3.
This is what I found:
Applying +15 volt to 1k is no problem, the voltages at PB3 are between +0.5volt and +5.5 volt (measured it with a Rigol scope, so not to accurate...
Applying -15 volt to 1k is also not a problem, the output voltages are from -0.5 to +4.5 volt, so still ok.
I even tried the maximum voltage possible with my power source (being 35 volts) and this sturdy little bugger even survived that!
I think not for long (well at least several minutes) but the current into the processor might give troubles in the long run (about 30 mA, and they do get hot after some time..)

Anyway, what this proves is that the output of an Atmel processor is well protected and as long as there is a resistor in series with the possible dangerous voltage, these processors can take a punch!
I was afraid that the processor might die when the VCC was removed, but even powering the ATtiny with a square wave of 0.6Hz and the 1k connected to -35 volt was no problem (at least not for a couple of minutes)

User avatar
thx2112
Veteran Wiggler
Posts: 515
Joined: Sun Oct 12, 2014 10:10 am
Location: Earth, Sol, Orion Arm
Contact:

Post by thx2112 » Fri Jan 20, 2017 9:49 am

I've been doing the same sort of tests.

Long story short, the Atmel 8-bit ICs are more than capable of driving long (distance) gates or triggers on their own.

With a 1K resistor and BAT54S (and lesser extent a 5.1V Zener) it's pretty much impossible to kill a pin with either static or the highest +/- voltages you get with modular gear.

The only potential problem is that the BAT54S dumps any high or low voltages onto the power rail or ground plane. Some power regulators handle this no problem (though get quite hot at high voltage differences and would eventually shut-down which could put this extra voltage back into the circuit), and others not at all -- but that can be fixed with a Zener on the power rail.

Based on this information the latest revision of the PCB has BAT54S/current-limiting resistor instead of transistor.

User avatar
Grumble
Super Deluxe Wiggler
Posts: 1817
Joined: Thu Dec 17, 2015 5:24 am
Location: U aint much if U aint Dutch
Contact:

Post by Grumble » Fri Jan 20, 2017 10:23 am

That is why you sometimes see a diode connected between the input and output of a 78xx power ic in such a way that it will conduct if the output voltage becomes higher as the input voltage, either caused by a defect or when you switch of the power supply.

User avatar
abelovesfun
Super Deluxe Wiggler
Posts: 1015
Joined: Thu Dec 13, 2012 1:19 pm
Location: Portland, OR
Contact:

Post by abelovesfun » Fri Jan 20, 2017 1:32 pm

I'm still trying to learn arduino - keep on getting an error about not finding the encoder libraries - I must have them in the wrong place - oh well, I got this to learn how to learn arduino....
Super Easy, Awesome DIY kits @ http://www.aisynthesis.com
modular ambient and composery music @ http://www.forcedamage.com/
https://www.facebook.com/forcedamagemusic

User avatar
abelovesfun
Super Deluxe Wiggler
Posts: 1015
Joined: Thu Dec 13, 2012 1:19 pm
Location: Portland, OR
Contact:

Post by abelovesfun » Mon Feb 20, 2017 10:47 pm

I learned how to include libraries (google FTW).
Now I am getting an "'EEPROM' was not declared in this scope" error - has anyone come across this? I'm not finding answers using google.
Super Easy, Awesome DIY kits @ http://www.aisynthesis.com
modular ambient and composery music @ http://www.forcedamage.com/
https://www.facebook.com/forcedamagemusic

User avatar
Grumble
Super Deluxe Wiggler
Posts: 1817
Joined: Thu Dec 17, 2015 5:24 am
Location: U aint much if U aint Dutch
Contact:

Post by Grumble » Tue Feb 21, 2017 6:01 am


User avatar
abelovesfun
Super Deluxe Wiggler
Posts: 1015
Joined: Thu Dec 13, 2012 1:19 pm
Location: Portland, OR
Contact:

Post by abelovesfun » Tue Feb 21, 2017 10:11 pm

Thank you - "learning" Arduino has utterly humbled me.

Fixed that, now I "think" the only error I am getting is a
"a function definition is not allowed here before '{' token"

Which happens at the void setup call here
#define read_delay 50 // for debouncing
int channel_switch;
int reset_button;
int channel_switch_read;

void setup() {
/*
The MAX72XX is in power-saving mode on startup,
we have to do a wakeup call
*/
Super Easy, Awesome DIY kits @ http://www.aisynthesis.com
modular ambient and composery music @ http://www.forcedamage.com/
https://www.facebook.com/forcedamagemusic

User avatar
thx2112
Veteran Wiggler
Posts: 515
Joined: Sun Oct 12, 2014 10:10 am
Location: Earth, Sol, Orion Arm
Contact:

Post by thx2112 » Wed Feb 22, 2017 6:27 am

Are the encoder and LED libraries installed to the proper directory? They in a subdirectory under the source, but need to go in the Arduino libraries directory.

User avatar
abelovesfun
Super Deluxe Wiggler
Posts: 1015
Joined: Thu Dec 13, 2012 1:19 pm
Location: Portland, OR
Contact:

Post by abelovesfun » Fri Feb 24, 2017 7:39 pm

Yes, I *think so.
Its my name/Documents/Arduino/
Image

According to what I've read in how to manage libraries that is the correct location.

They are green in the arduino window:
Image
Super Easy, Awesome DIY kits @ http://www.aisynthesis.com
modular ambient and composery music @ http://www.forcedamage.com/
https://www.facebook.com/forcedamagemusic

User avatar
thx2112
Veteran Wiggler
Posts: 515
Joined: Sun Oct 12, 2014 10:10 am
Location: Earth, Sol, Orion Arm
Contact:

Post by thx2112 » Sun Feb 26, 2017 2:40 pm

Hmmm... Give me a sec...

User avatar
nevetsokyeron
Wiggling with Experience
Posts: 306
Joined: Sat Mar 12, 2016 10:38 pm
Location: Austin TX
Contact:

Post by nevetsokyeron » Sun Feb 26, 2017 8:54 pm

Questions...

1. is there away to adjust the encoder sensitivity in the code? My encoders seem way too jumpy between single clicks. Sometimes I have to turn the encoder back and forth a few times to get a value I want because it's jumping too far.

2. what is the normal output voltage for the output jacks? Some of my gear won't trigger. My little ZeroScope shows voltage around 2-2.5v (if I'm reading it right).

3. If that's normal output voltage for the triggers - Can I modify anything to get more voltage (like 5v) to the outputs?

User avatar
thx2112
Veteran Wiggler
Posts: 515
Joined: Sun Oct 12, 2014 10:10 am
Location: Earth, Sol, Orion Arm
Contact:

Post by thx2112 » Mon Feb 27, 2017 4:22 pm

Around line 235...

Code: Select all

#define read_delay  50 // for debouncing
Try a higher value than 50.

The output should be 5 volts. What is the voltage out of the voltage regulator?

User avatar
thx2112
Veteran Wiggler
Posts: 515
Joined: Sun Oct 12, 2014 10:10 am
Location: Earth, Sol, Orion Arm
Contact:

Post by thx2112 » Mon Feb 27, 2017 4:25 pm

abelovesfun wrote:Yes, I *think so.
Its my name/Documents/Arduino/
Image

According to what I've read in how to manage libraries that is the correct location.

They are green in the arduino window:
Image

Did you install the libraries fresh from the zip file or what's on Github? If not, can you try replacing the libraries with the ones there? Perhaps there's a conflict between library versions.

User avatar
nevetsokyeron
Wiggling with Experience
Posts: 306
Joined: Sat Mar 12, 2016 10:38 pm
Location: Austin TX
Contact:

Post by nevetsokyeron » Sun Mar 05, 2017 11:11 pm

thx2112 wrote:Around line 235...

Code: Select all

#define read_delay  50 // for debouncing
Try a higher value than 50.

The output should be 5 volts. What is the voltage out of the voltage regulator?
I finally got around to testing - I'm getting 5v at the voltage regulator and everything around the output jacks looks correct. Still getting about 2v on the output pulses.

Is there a way in the code to change the pulsewidth of output pulses?

About to try the encoder value change.

User avatar
thx2112
Veteran Wiggler
Posts: 515
Joined: Sun Oct 12, 2014 10:10 am
Location: Earth, Sol, Orion Arm
Contact:

Post by thx2112 » Sun Mar 12, 2017 8:59 am

Any luck? I've been trying to (unsuccessfully) recreate the problem.

Are all of the trigger outs the same voltage?

Are all the related components the right value?

What's the voltage at the transistor end of the 10K resistor?

The pulsewidth is changed on line 174:

Code: Select all

int length = 50; //pulse length

Post Reply

Return to “Music Tech DIY”