Arduino drum machine

They should all have the same value. Calculations don’t get much easier than that :grinning:

(ok, you don’t want to use small values because then you end up wasting current, but you can aim for the value of the potentiometer you’re replacing divided by the number of resistors, and then grab some resistor value you have enough of in the same order of magnitude.)

3 Likes

@jackwildchurch thanks very much for sharing this code. I am really new to Arduino and have managed to have the Mini Pops working. I am trying your MIDI out code, but I am noticing the clock output (pin 13) is not spitting out analog sync out. Is this expected? thanks!

You should be getting analog clock out of pin 13. How about pin 12? Is it outputting the reset signal at the start of each pattern cycle? If it’s functioning as expected in all other ways, I can only suggest double checking the wiring/ground.
Another thought - how are you testing the output? I suppose there’s a slim chance the signal might not play nicely if a certain piece of equipment is particularly ‘fussy’ about the signal it needs clocking to. Do you have an oscilloscope to see exactly what’s going on?

2 Likes

Thanks for your quick reply. I was testing a prior code before (with no MIDI out capabilities) and I did get clock out (synched to a Behringer TD-3 and also checked with my pocket oscilloscope).
I have not connected it to a DIN jack yet, but I do get RESET on PIN 12 (checked with both LED and oscilloscope).
Let me try reloading the previous non-MIDI OUT code in the meantime to check I do have clock out on PIN 13.

Thanks!

1 Like

Hi again. Just reloaded the previous INO file. It does send clock out via pin 13 (checked with oscilloscope). Conversely, it does not send anything via pin 12.

Thanks,

David

Hi. That’s strange - I’m at a loss as to what could be happening there but hopefully it can be resolved. All I can tell you is that I do get MIDI clock, along with analog clock & reset on their respective pins without any issue on both machines I’ve built around this code.
Anyway, if anything further occurs to me, I’ll post here but feel free to ask if there’s anything I could check regarding my builds.
Cheers!

2 Likes

Thanks again. Yes it does sound weird. I am using the code in this previous post of yours:

Still not analog sync out :frowning:

Best,

David

Hi. I just uploaded that sketch to one of my builds to confirm things and all is working as expected.
I’m really at a loss I’m afraid.

Perhaps some other kind soul out there has some insight or suggestion? I myself am not much of a coder - I didn’t do the actual MIDI out coding here, it was kindly shared with me, but I’ve tinkered with the patterns and samples for my own builds. However, the sketch above has all the original content and it seems it’s worked fine for others so I’m confident the issue you’re having can be resolved!

Thanks again. I am thinking the NANO could be at fault? I am using the one with the Chinese chip (CH341 I think?) with the ATMega 328P old bootloader. I’m at a loss since the other codes do send out analog sync clock on Pin 13, but the MIDI code does not.
Maybe someone could guide me on which sections from the MIDI code I could cut-paste into the non-midi code? I am really too new to Arduino for figuring that out in a safe way.
Best,

David

Hi again,

I have a couple questions for you Arduino gurus:
D7 mute (bass drum) does not work at all with any of the various codes for the Minipops. I have doublechecked all connections and they are fine. Interestingly enough, D7 resistance to ground, measured with a multimeter, is around 5 Kohms, whereas for most other D pins (D2, D3, etc.) the resistances seems to be inifinite.
Another funny thing is that with the MIDI output codes, the analog clock sync out (D13) does not work at all. For the codes with no MIDI out, the analog sync out works fine.
Last but not least, I am using a high-bright LED via a 22K resistor on the Reset out for an indicator. I take it that it is normal for it to shine not in perfect timing (e.g. it lights a bit before the first beat of the bar) but what I cannot seem to be able to fix is a loud pop everyime the LED goes on and off. I even tried to drive it with a transistor, but no cure.
D11 (audio out) and D12 (reset) resistance to ground is only about a hundred ohms.
Is it likely I have a faulty NANO board here?
Last question: is it safe to implement a volume control by using a 10K pot wired leg 1 to ground, leg 3 to D11 and wiper to OUT capacitor? Is it OK to ground D11 at all (when volume is at zero?)
Thanks for any help.

David

This doesn’t add up, it is the same pin you are referring to, right? If you’re sure about your wiring and still see this, it is likely your Arduino is faulty. 5V over 100ohm = 50mA, which is more that the Atmega IO pins can supply. You might even be superceding the 200mA rating of the internal regulator (if you’re using it). Replacing the Arduino is definitely worth a try.

Yes, but it is advisable to buffer the signal after the attenuator. 10k output impedance is on the high side.

2 Likes

Hi, thanks!

Yep, D12 is the Reset (output) pin. Theoretically you can connect an LED indicator and still use it for reset purposes, but with every LED blink, a huge pop is generated.
Am I right in assuming that if I shorted any “D#” pin configured as output to ground this could be damaged? If so, D11, which is the PWM DAC audio output could be damaged by using the potentiometer as described in my previous comment? BTW audio still works OK, but D11’s resistance to ground (once again, with the Nano completely removed from the circuit and unconnected) is too low.
I am buffering the 10K pot volume already, btw.
Also I am puzzled why D7 won’t mute when shorted to ground. Funnily enough, when using the Clock In sketch, D3 won’t mute either (but only with that sketch).
Best,

David

A pot won’t short the pin to ground (unless you connect the wiper to ground. Don’t connect the wiper to ground.)

1 Like

You are correct. In the minimum volume condition, there would be a 10K path to ground from D11, but no direct short. My bad. Still, D11 has this ridiculously low resistance value when measured against ground…

Hi guys, great stuff. I have a question regarding midi out connectivity.
Do you connect ground to pin 2 of the midi socket? Should ground be connected?
I’m using TRS out (Type A midi to trs), but this is the same i guess.

Thanks :slight_smile:

P.S. Is anyone found a MIDI IN solution yet?? ))

1 Like

On MIDI outputs (only outputs, no inputs), ground should be connected to the shield of the DIN socket.

3 Likes

Thank you! I’m using TRS for midi output(Type A), so ground is a Sleeve of the connector. which is a pin 2 on the DIN. Am i right?

According to this article:
https://minimidi.world/

1 Like

Yep, pin 2 is the shield which is connected to the TRS sleeve.

2 Likes

Cool, thanks.

I get a clock bleed into the audio path, it is only noticeable on a high levels, but annoying enough. I thought it might be via the ground connections.
I unsoldered the ground for the midi to test it… same bleed and it still works.

Well, i believe these are the compromises)

1 Like

You can connect pin 2 and shield to ground via 100 nF capacitors on MIDI IN, but they say that’s for “RF grounding” so probably not relevant.

2 Likes