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
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 16, 2016 5:40 am

Do you use the Parola MAX7219 library? Since this may be at fault: http://forum.arduino.cc/index.php?topic=252091.0

User avatar
whoop_john
Veteran Wiggler
Posts: 693
Joined: Sun Mar 17, 2013 12:03 am
Location: London UK

Post by whoop_john » Fri Dec 16, 2016 6:11 am

Grumble wrote:Do you use the Parola MAX7219 library? Since this may be at fault: http://forum.arduino.cc/index.php?topic=252091.0
I don't use Arduinos or Atmel chips, I am coding directly for the PIC18F2520 for this project. I have an interrupt running that allows 96 time divisions per beat, up to a tempo of 180bpm, which I think should be enough for jazz.

I will be adding a one-shot LCM option that will calculate the least common multiple of all active sequences and output a single pattern, say for being sampled or for being triggered at key moments. The LCM of sequences of length 16, 15, 14 and 13, for example, would output 21,840 steps and stop. For 16, 8, 4 and 2 it would only output 16 steps.
Ⓞⓝⓔ ⓓⓐⓨ ⓨⓞⓤ ⓦⓘⓛⓛ ⓦⓐⓚⓔ ⓤⓟ ⓐⓝⓓ ⓕⓘⓝⓓ ⓨⓞⓤⓡⓢⓔⓛⓕ ⓓⓔⓐⓓ ⓐⓝⓓ ⓨⓞⓤ ⓦⓘⓛⓛ ⓢⓣⓐⓨ ⓛⓘⓚⓔ ⓣⓗⓐⓣ ⓕⓞⓡ ⓣⓗⓔ ⓡⓔⓢⓣ ⓞⓕ ⓨⓞⓤⓡ ⓛⓘⓕⓔ

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

Post by duff » Sat Dec 17, 2016 11:38 am

I just put my Euclidean together and found I have rather 'noisy' triggers and as a result they don't actually trigger half of my modules. It would appear that patching via a buffered multiple removes the noise and leaves nice usable triggers. This affects all triggers and is the same whether the LED display is present or not. I assume this is ground related but I am not really sure where to start. Have I simply fried a transistor? Or should the pads 100K and BAT45S behind the reset jack not be shorted together? Any assistance appreciated.

The scope shot below shows the triggers coming out of the Euclidean. You can see the 'noise' and the triggers themselves seem to decay rather than end. This shot reflects the output regardless of which of my PSUs I use or what it shares the PSU with, including if it is on its own.

Image

This next scope shot shows the triggers when patched into a buffered multiple and you can see they are nice and square. This reflects the trigger outputs regardless of whether the multiple shares the PSU with the Euclidean or whether the signal is read before or after its buffer.

Image


Note - I don't have any encoders at the moment so these are simply missing.

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 » Sat Dec 17, 2016 12:57 pm

The top figure shows a typical scope signal when there is no connection between de ground of the scope and the ground (0 volt) of the device under test (DUT).
As you can tell from the sinusoid signal it is 50 Hz (2 full sinusses in 40 Msec = 20 Msec/sinus = 50Hz)

So my guess is that you miss a connection inside the module or from the scope to the DUT.
The amplitude of the triggers is ok though (close to 5 volt)

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

Post by duff » Sat Dec 17, 2016 1:15 pm

Grumble wrote:The top figure shows a typical scope signal when there is no connection between de ground of the scope and the ground (0 volt) of the device under test (DUT).
As you can tell from the sinusoid signal it is 50 Hz (2 full sinusses in 40 Msec = 20 Msec/sinus = 50Hz)

So my guess is that you miss a connection inside the module or from the scope to the DUT.
The amplitude of the triggers is ok though (close to 5 volt)
Yes. I think I must be missing something obvious somewhere though as my testing appears to suggest there is no missing ground connection

I can measure continuity between ground on the header and all points that should be at ground on the PCB, including the jacks. I also have ground continuity to the sleeve of any cable plugged into the jack. The scope is then connected to the sleeve of the jack at the other end of the cable which also shows continuity when tested.

:hmm:

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 » Sat Dec 17, 2016 2:01 pm

In THIS the GND of the arduino is not connected to anything, but should also be connected to the other GND's.
Measuring continuity, how much resistance do you actually measure?

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

Post by duff » Sat Dec 17, 2016 2:13 pm

I just beep tested and didn't pay attention to the actual resistance. I can't check now as I am out but can measure more closely later.

I should clarify that I am using one of synsi's pcbs, so this schematic.

Image

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 » Sat Dec 17, 2016 2:45 pm

I think I see it: I think the transistors Q1 to Q4 are either of the wrong type (should be PNP in stead of NPN), or drawn wrong (Emitter and Collector switched)
This way the scope always sees a high impedance, hence the induced hum!
Edit: I see the 2N3904 is an NPN transistor, so the in drawing the Emitters and Collectors are switched.

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

Post by thx2112 » Sat Dec 17, 2016 8:45 pm

Yeah, there's something wrong. The trigger should be sharp and clean with no ringing or noise.

Image

Do all the channels look like this?

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 » Sun Dec 18, 2016 2:27 am

Connect the transistors like I suggested, or remove the transistors and the resistors R17, 2, 4 and 6 and use the outputs of the arduino directly to R16, 1, 3 and 5.

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

Post by duff » Sun Dec 18, 2016 7:02 am

Thanks for the inputs.
Grumble wrote:Connect the transistors like I suggested, or remove the transistors and the resistors R17, 2, 4 and 6 and use the outputs of the arduino directly to R16, 1, 3 and 5.
Probing the NPNs they don't seem to be connected as per the schematic. The base and collector appear to be as drawn but I can't seem to work out where the emitters are connected to. It does not appear to be VCC, in fact I seem to see M Ohms of resistance between the emitter and every point I tried on the board except ground where it is in the Ks.


Following more testing I have found that simply probing the signal appears sufficient to make it trigger - this is with or without the probe grounded. As such the scope shots I posted above (which were taken without the triggers being patched anywhere else) are misleading since it would appear that they actually reflect the working state - although possibly also show a different problem.

As it stands I can patch straight from the Euclidean to my Toppo 281, Syncussion, Turing Machine, Barton Clock Divider or FCUK Enevelopes and they will react to the triggers just fine. However, if patched to my TH/Timo Bass++, either of my Barton Analog Drums, either of my Barton Decaying Analog Noises, my TH/Fonik CMOS ADSR or my fallabiels 808 Snare none will trigger unless patched via a buffered multiple. If not patched via a buffered multiple as soon as the probe of my scope is introduced to measure the trigger signal (at a point on or off PCB) it suddenly starts triggering successfully until the scope probe is removed again.

Pic of board in case that shows any oddities:

Image

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 » Sun Dec 18, 2016 7:31 am

What happens if you trigger straight from D11, D12, D13 or/and A3?
(Maybe to be sure have a resistor of 1k in series)

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 Dec 18, 2016 8:12 am

Are the encoders working okay?

Can you check that the 5V line from the Nano isn't broken between the Nano and the triggers?

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

Post by duff » Sun Dec 18, 2016 9:14 am

Grumble wrote:What happens if you trigger straight from D11, D12, D13 or/and A3?
(Maybe to be sure have a resistor of 1k in series)
Straight from the pin looks to trigger the modules (or at least the couple I tried) from the list that don't work when just patched straight from the jack.
thx2112 wrote:Are the encoders working okay?
The encoders are currently missing.
thx2112 wrote:Can you check that the 5V line from the Nano isn't broken between the Nano and the triggers?
Looks like I misunderstood the schematic. The emitter of the NPNs are indeed connected to the 5V coming out of the nano. Does it generate this itself as I see no connectivity with the regulator but can read 5V when powered.

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 » Sun Dec 18, 2016 10:10 am

duff wrote:
Grumble wrote:What happens if you trigger straight from D11, D12, D13 or/and A3?
(Maybe to be sure have a resistor of 1k in series)
Straight from the pin looks to trigger the modules (or at least the couple I tried) from the list that don't work when just patched straight from the jack.
Oke, so the nano works as it should be
Looks like I misunderstood the schematic. The emitter of the NPNs are indeed connected to the 5V coming out of the nano. Does it generate this itself as I see no connectivity with the regulator but can read 5V when powered.
The nano has a power supply ic on board that provides the atmega with 5Volt, but it has limited power, so thats why there is a secundairy power supply to provide 5 Volt to the rest of the circuit.
The transistors are wrong! They cant work this way ( if someone can prove me different ... please do!)

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

Post by duff » Sun Dec 18, 2016 11:17 am

FYI - I don't have schematics for all the modules, but it looks like the modules that are not triggering all have inline caps on the input as my 'schematic' below shows whereas the ones that are do not.

input ----||----> the rest of the circuit

Grumble wrote:The transistors are wrong! They cant work this way ( if someone can prove me different ... please do!)
I tried switching the NPN around so that collector and emitter are swapped and the result is exactly the same as described previously. I'll try swapping it for a PNP now, but just in case I have failed to switch legs correctly (for some reason my brain finds working out which leg is which on a transistor a really hard task) here is a image showing what I did. Note the legs aren't shorting it is just the camera angle.

Image

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

Post by duff » Sun Dec 18, 2016 11:49 am

Hmm, switching in a PNP (2n3906) appears to stop the module functioning. Not sure if I had the legs all wrong but I have a 4 year old buzzing around at the moment so I'll have to come back it later when I can focus more easily.

User avatar
cygmu
Super Deluxe Wiggler
Posts: 1661
Joined: Mon Feb 15, 2016 3:33 pm
Location: UK

Post by cygmu » Sun Dec 18, 2016 1:28 pm

I can't quite see what you've done in the photo but it doesn't look right: starting from the original configuration, you just need to turn the whole transistor around, leaving the base (middle pin) where it was originally but swapping the other two.

(I don't think a PNP will work by the way)

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

Post by duff » Sun Dec 18, 2016 2:15 pm

The pads are SOT23 so I didn't think I couldn't just rotate the device. So instead I bodged on a TH 2n3904.

So it was
E---B
--C--

But I wanted (if I understood Grumble)
C---B
--E--

Hence the twisted legs

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 Dec 18, 2016 3:06 pm

If you take the transistor out and jumper the output straight through what does it look like?

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

Post by duff » Sun Dec 18, 2016 3:21 pm

thx2112 wrote:If you take the transistor out and jumper the output straight through what does it look like?
I think putting the PNP in has broken the nano as the module doesn't seem to boot up and the nano appears not to talk over USB any more.

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 » Sun Dec 18, 2016 5:16 pm

duff wrote:Hmm, switching in a PNP (2n3906) appears to stop the module functioning. Not sure if I had the legs all wrong but I have a 4 year old buzzing around at the moment so I'll have to come back it later when I can focus more easily.
I wrote:
I think I see it: I think the transistors Q1 to Q4 are either of the wrong type (should be PNP in stead of NPN), or drawn wrong (Emitter and Collector switched)
This way the scope always sees a high impedance, hence the induced hum!
Edit: I see the 2N3904 is an NPN transistor, so the in drawing the Emitters and Collectors are switched.
So you should change the NPN for a PNP (thats what you did) OR switch the collector with the emitter, (thats what you did TO!)
So now it still won't work.
The new problem has to do with the power ic on the nano is (probably) blown...

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 » Sun Dec 18, 2016 5:36 pm

FYI - I don't have schematics for all the modules, but it looks like the modules that are not triggering all have inline caps on the input as my 'schematic' below shows whereas the ones that are do not.
I missed this part.
Now the failing triggers start to make sense...
As the schematics are drawn, the trigger outputs are open collector (ish)
Thats why modules with a resistor to gnd (or whatever) are triggerable, there needs to be a path for current, thats why you got triggers when you put the probe on the trigger outputs: this provided (albeid high impedance) a path for current to flow.
So I come back to my earlier suggestion: ditch the four transistors and have a resitor of about 1k in series from the output of your nano to your trigger outputs.
Do you use the same software as with the other diagram? Because I think that the transistors are a failed attempt to cconstruct an inverter.
Realy unnecesary since each output of the atmega can source and sink 20mA

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

Post by duff » Mon Dec 19, 2016 4:49 am

I'm using the software that goes with the schematic and the trigger at the nano pin is not inverted. I thought the transistor was part of an output protection scheme but may well be completely wrong on that.

I have a new nano on order so I will switch to just using resistors in series as you recommend and which from the previous test looks like it does the business. Thanks for your input.

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 4:57 am

Can't you just replace the power supply ic?
I know its small, but far lower in price as the nano!

Who made this pcb and are there examples of this version that run ok?

Post Reply

Return to “Music Tech DIY”