Pages

Tuesday, 15 November 2016

Korg Mini-Pops DIY Drum Machine

Korg Mini-Pops DIY Drum Machine 




This is a really cool build;  It a recreation of the Korg Mini-Pops drum machine, an instrument which has been on a ton of records the most famous of which might be Jean Michelle Jarre’s ‘Oxegen’ album, hence this clone being called the ’O2’.  



The brilliant Jan Ostman built this using only an Arduino nano and a few barebone parts.  Jan is giving away the full details on his website and is only asking for a $3 donation in return.  Bargain!


***Update***
If the linked website is no longer working, use the Internet Archive to visit a cached version of the site (copy and paste the address and choose a date from around when this pages was posted: around Dec 2016).

***MIDI update***
From the forums of Look Mum No Computer, somebody has posted the code but with the MIDI update;
(Read the forum for more info and schematic).

***More Advanced Model Update***
If you'd like to build a more advanced version, head over to the NoiseyMaker website for more info and a nice detailed guide.  This version builds on the original & adds some advanced features like a display and even pitch control of the samples.  Also the drum patterns have been updated to be a bit more 4/4 time 'electronic-style', rather than than some of the 3/4 time waltz in the original code (you could always copy & paste these over to the old code if you wished).

....



I started by building my first version using a cheap Maplin plastic enclosure, but I thought it was worth spending a little more time on it so I got the table saw out. 














Because the table saw has a maximum cutting width of 7cm, I based the case around this limitation.











The switches mute the individual drum hits. The pots select the pattern and its tempo.





































V3.




***UPDATE Arduino Drum Machine****
Simplified Schematic

Ok, so this 'simplified' schematic might not actually make things any simpler!  But some people have asked for it, so maybe it'll help clear somethings up a little bit - especially how to wire up the audio output and pots/switches.  This was drawn from memory so I hope it's correct - give me a shout if not and I'll update (the pots might work in reverse, but they'll still work).  I'd also urge you to look at the schematic on Jan Ostman's website for more help;

https://janostman.wordpress.com/the-o2-source-code/

Thanks!

118 comments:

  1. Replies
    1. Thanks Jan! I've also built your string synth but haven't had chance to write it up yet, here's a video for the time being;

      https://www.youtube.com/watch?v=KQcI7oKE1pc

      Thanks for sharing all your hard work - I've learnt so much!

      Delete
    2. Great Work! It has such a nice sound.
      Is it for sale?

      Delete
  2. Hi, really nice build! I am planning on making this my next project and I have some questions. I see a MIDI jack in one of the pictures, is that somehow hooked up to a CD4067 to drive a sequencer? How did you implement that? I have used an Arduino Uno for several projects, but I've only read the datasheet for the CD4067 and have no experience with using one.

    ReplyDelete
    Replies
    1. MIDI output was added into the code so now the drum machine can set the tempo of other instruments - no CD4067 was needed. Notes and volts have a great series about Arduino and MIDI;
      http://www.notesandvolts.com/2015/07/midi-for-arduino-understanding-midi.html
      They originally built an Arduino synth, then came back to the project later and added the MIDI. Maybe you might be able to figure out how to add the code yourself after reading (it also has a MIDI out schematic);
      http://www.notesandvolts.com/2015/05/auduino-synth-midi.html
      If not, maybe this guy might share the code if you ask nicely ;-)
      https://www.youtube.com/watch?v=Ecw_Zp5uELk

      Delete
    2. Ah, so it's really MIDI out! Thank you for the info, hopefully I can get it figured out from here.

      Delete
  3. NIce project, really very cool :)
    I try to make it and didn't work :( I read we don't need the MUX as the original scheme. I try many combinations, tested the speaker, checked the cables.... nothing :(
    I'll keep trying :)
    Thank you for this project :)

    ReplyDelete
    Replies
    1. I got it :) It works so well, I post this cause some people could have the same problem. I used a wrong capacitor at the end (yes, stupid). I mess up the values in the store and in home, I couldnt even read the the numbers (very tiny numbers), so I couldnt check. And the drum machine it was not working directly connected to the speaker, he must have that end circuit. But, the synth works well without the filter. Thank you anyway.

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. I have a question it can interest others also. I really have no clue how to generate the patterns. I really would like to make my owns. Sorry my ignorance, I think it's the part with "B00100101", but no clue to this moment how to generate this part of the code. Thank you so much :) When I finish with a proper box, I will show if you are interested :)

    ReplyDelete
    Replies
    1. Hi Jo, I haven't really looked into the code yet (Jan Ostman wrote it not me!), but where it starts "B00100101" could well be where you could program a new pattern. If you look, there are 16 "B00100101"'s in one block of code, which is probably the 16 steps that make a drum loop. '0' is digital for off, and '1' is digital for 'on'. Elsewhere in the code you are shown the drum sounds;
      Patterns GU BG2 BD CL CW MA CY QU
      You can see there are 8 instruments that make a drum kit, and there are also 8 numbers in "B00100101"
      So it maybe possible to program the drum kit this way. Say if you just wanted the bass drum (shown as BD) to play and nothing else, you type "B00100000", or if you wanted no sounds to play: "B00000000". I'm only guessing this, so I could well be wrong! But it wouldn't be too hard to give it a try & if it doesn't work, just re-upload the original code and it'll work again. Let me know how it goes please! & yes, I'd love to see the version you've made. Thanks!

      Delete
    2. Right you are Mr. Hoskins. The eight numbers in the line of code after the letter B represent the eight intruments and each line of code represents a pattern step. I've swapped out more than half of the stock patterns with old breakbeat patterns just for fun. "Take me to the Mardi Gras" sounds great on the MiniPops!

      Delete
    3. Oh wow cool! I shall be adding my Gabba pattern to this ASAP! Thanks for letting me know ;-)

      Delete
    4. Hi guys! I've been working out how to get round the limitation of one bar patterns on the Arduino Drum Machine.Eureka! Programme each bar in a different rhythm slot and with careful planning rotate the pattern knob at the right moment.16 different bar patterns should be enough for most people.
      I hope to build the ADM and String Machine soon.Great projects,more please!

      Delete
  6. Your wooden box is amazing, how did you do the writings?

    ReplyDelete
    Replies
    1. The writing on the perspex? I used a banggood laser engraver, which you can read about here; http://bloghoskins.blogspot.de/2016/08/banggood-2500mw-laser-engraver-setup.html

      Delete
  7. God job it's nice project for musicians

    ReplyDelete
  8. God job it's nice project for musicians

    ReplyDelete
  9. God job it's nice project for musicians

    ReplyDelete
  10. There's a YouTube video called "greed minipops first look" that shows "hihat" instead of "maracas"? Hope that helps.

    ReplyDelete
  11. Now we know how to reprogram the 16 rhythms, how do we reprogram the samples? In particular there's no snare drum.I know where each sample is (they're labeled BD,CY etc) but how did Jan convert a sample into arduino code?Failing that, can we take a trigger out from perhaps the hihat channel to an external soundbox?

    ReplyDelete
    Replies
    1. I think a clock trigger is already present on pin 13;
      pinMode(13,OUTPUT); //Clock output

      There aren't actually any audio samples included in the code, the sounds are made up/represented as data (Is this what wavetables are?). So here's how the bass drum is represented;

      const unsigned char BD[1076] PROGMEM =
      {
      126,122,118,114... Lots more numbers here
      };

      You can see from the code, after 'BD' you have a number, in this case [1076]... that's how many numbers are below in the brackets that make up the sound that gives you a bass drum... like plotting a sound on a graph. The cymbal is a lot longer 'sample', so CY[9434] has almost ten times the amount of data... this is where most of the Arduino's limited memory is spent on this part of the code.

      The other parts of this line of code;

      const unsigned char BD[1076] PROGMEM =

      const - this means this part of the code won't change ("constant')
      unsigned - I think this is a way of declaring that this part of the code is made up of numbers without any decimal points after it (integers aka int - numbers with decimal points require a lot more processing power)
      char - ok I'm googling this now :-) To declare a variable of type character we use the keyword char. - A single character stored in one byte.

      Basically google is your friend when it comes to trying to figure it out! If you want to dig in deeper with the code, there's a good free online course called CS50 which you can study on the EdX website;
      https://www.edx.org/course/introduction-computer-science-harvardx-cs50x

      ...Saying that, I've not finished this course yet, so take anything I say about coding with a very large pinch of salt!

      To convert a sample I think something like Audacity is used... maybe google 'convert a wav into data with audacity'? I not done this yet, but I imagine something like that would be the answer you're looking for.

      Cheers,
      Gary

      Delete
    2. I found this with google -http://manual.audacityteam.org/man/sample_data_export.html
      Hope this is of help to people who want to load there own drum "samples" into minipops.

      Delete
    3. This may sound stupid but where does the 5v supply come from? Does the Arduino output 5v on pin 27 when it's plugged into the USB supply?I plan to use a 9v battery going to pin30(vin),so a divider will give me approximately 4.5v for the pots.

      Delete
    4. The nano gets the voltage from the USB and passes it through to output 5v on pin 27 & 3.3v on pin 17. To power a nano with a 9v battery the most common way is to use a 7805 which will regulate the 9v down to a constant 5v... Here's a nice article;
      http://jumptuck.com/2011/11/15/voltage-regulation-friend-7805/

      Delete
    5. ...oh and thanks for the link to the audacity article, it's got my little brain thinking what could be possible :-)

      Delete
    6. If you're building the entire circuit from scratch there's a really good article over on the arduino website showing how to breadboard an arduino... it also shows the 7805 power supply. Just watch out for the ATMEGA328p pinouts as they don't follow the order found on the pins on the Arduino (ie, you won't find 5v on pin 27 etc)...
      https://www.arduino.cc/en/Main/Standalone

      Delete
    7. @Chunky54 =did you succceded into loading new samples with the audacity code export?im downloading it now to chek . Thanks for the info!

      Delete
    8. I was wondering if anyone had any luck converting audio files to numeric data.
      I have been trying to convert my own drum sounds for a couple of weeks now. I converted my wav to a 16 kbps 8000 kHz mono file first. This is how one tutorial instructed me. I have been using Audacity and a couple other programs to change to the numeric values. I have not had any success.( I was able to make files formatted for Teensy audio) I have been combing through Github and googling bits of code but I have only found 5 examples of these numeric values. And it turns out they all came from Jan Ostman.Any information on what exactly they are would be greatly appreciated (Are they bytes of the sample plotted?)as I could google and search Youtube more accurately. Also any tips on how to convert would be so very appreciated!!!
      hard to believe only one man knows how to convert these(Jan Ostman) but maybe?

      Delete
    9. Weirdly enough I've been working on this recently... I'm making a sampling drum pad. Hopefully I'll publish the full article *soon* (take that with a grain of salt -it could be months!). It sounds like you are almost correct with the samples, but maybe set the project rate at 16384 (easier for the arduino to calculate?) and don't forget to resample (audacity -> tracks -> resample).

      Then you export the audio as 'other uncompressed files' -> Export as WAV - Unsigned 8bit PCM.

      Then you need to run a python script to convert the file, so you'll need python installed on your computer (you can get it on the microsoft store if you're running windows).

      You need to download the python file; https://github.com/sensorium/Mozzi/blob/master/extras/python/char2mozzi.py (I copied and pasted it and then had to tab every line once to get it to run).

      To keep it 'simple' I created a folder on my desktop that contained the .py file and my newly created audacity file.

      Then you need to open terminal/command prompt and type cd to change directory then and paste the location of the desktop file (mine was C:\Users\User\Desktop\pythonCode). Hit enter to change. Once you've changed the directory so it's looking into this folder, you can run the python script. You need to tell it to use the python script, then which file it needs to convert, then the name of the header file, the file name, then the kHz rate. So you should have something like this in the command prompt;

      char2mozzi.py "C:\Users\Circus\Desktop\Snare01.raw" "C:\Users\Circus\Desktop\Snare01_int8.h" SNARE01 8000

      Here's a good article that helped me;
      https://groups.google.com/g/mozzi-users/c/6rQfp-b4ofQ/m/Guar6IcsBQAJ?pli=1

      Then you'll have a header file you can drag into the arduino IDE. you can either import the .h file into the main code page, or just copy and paste the needed numbers into the file you'd like to replace. The memory is tiny on the arduino though, so if it's too big a sample it won't be able to load it.

      Hope this helps (took me a while to figure it all out!)

      Delete
    10. First of all thank you so much for posting this project!!
      Secondly thanks for the quick reply. I have been doing pretty close to what you have described above. But I will have to try with that specific software. I actually found a app late last night called wav2header by Richard Wardlow based off of wav2sketch by Paul Stroffregen(used to format Teensy audio)which is a utility which will auto generate the required header files from 22.05kHz or 44.1kHz .wav files. You just put the wav files in a folder and run the app and it gives you the numeric(headered?)data.(the numeric data from wav2header has negative numbers so this may be a problem?)
      However it seems it is not that simple. When I substitute the numeric data of my drum sounds with the ones by Jan Ostman I get glitchy type sounds. Some might be useful for a different sort of kit. In fact when I switch sounds from other sounds by Jan in the minipops sketch it does not work. Again glitchy, I get sounds but not the normal snare or kick for instance. I have tried other numeric data from Jan's other drum projects and I scavenged some from Github. So far only glitchy percussive like sounds.Looking at the rest of the sketch I see many potential reasons for this.
      I have been systematically changing parts of the script. I am getting a lot of interesting sounds so all will not be lost but I am not optimistic about finding a swap and play solution. I am suprise more people have not caught on to this project. With your great instruction I was able to complete it in about 20 minutes.I am a composer who only has been doing arduinos for about a year. Also for 5 dollars you can have a great sounding drum box. Well thanks again!!! Look forward to seeing your next article!! No rush I have dozens of projects right now.Take care!

      Delete
    11. Before using the mozzi sketch I was using audacity and a converter called encodeAudio (I think). All I could get was distorted sounds, but using the python script everything is turning out loud and clear (talking of which, you should normalize the samples in Audacity before converting). Don't forget you'll probably need to change the number of cells if you paste new samples into the drum machine code. Here's a 909 kick I made using the char2mozzi convertor;
      https://github.com/gary909/Arduino_Drum/blob/main/909Kick8bit.h
      & a clap
      https://github.com/gary909/Arduino_Drum/blob/main/Clap8bit.h
      These are definitely working, at least on the project I'm working on at the moment (I've not tried with Jan's code), and they contain lots of negative numbers - so I don't think that's the problem.
      Thanks and good luck!

      Delete
    12. Thanks for the info! I downloaded EncodeAudio but it would not run on my machine.I was going to try on my Linux machines or Mac.
      I am going to get back into that part of the project this weekend hopefully. I have been able to get a lot of useful sounds by changing the 4564 in the code below to between 1-300.
      if (trig & 2) {
      samplepntCY=0;
      samplecntCY=4564;
      This gets rid of the distortion. A high hat may not sound like a high hat but at least I get a good sound out of it.Instead of those awful noises. All the bad sounds I tried again using this process and all 20 or so gave me favorable results. You can "tune" the timbre by starting at 1 then trying 5, then 8, then 15,etc. Generally if you stay below 800 or so you are safe from that nasty distortion. (It is supposed to match the sample count above in the code I believe)But I prefer lower values Should be able to put together quite a few interesting kits! But like I said this weekend I want to get back to having a kick sound like the kick etc.
      I also changed the pattern length to 128(127)steps instead of 16(15) in the code.
      Programed some indie type beats. 128 steps allows for a lot more variation. My ultimate goal is to have different types of kits for different genres. Then make them available if people are interested. Also ran Pins 14,15,16,and 17 out to a breadboard to LEDs to monitor the sequencer steps. Provides whole note,quarter note,eighth note,and sixteenth note. Ran pin 13 clock out to LED for 16th. All follow tempo of course. Had it hooked up at one point where it flashed to each individual note of every channel.Have to experiment with pin 12 reset before I put in an enclosure.
      Found some other "numeric" drums scavenging through Github.
      Have a very busy week ahead but look forward to trying your code!!
      Thanks again!!

      Delete
    13. I think the number 4564 is the amount of numbers that make up that particular sample (ie if you were to count the numbers between the [] you'd find there were 4564. If you look in the link I sent to the 909 sample you can see there are 6453 present (obviously I haven't counted this!). I imagine if you shorten that number, the sample will cut off sooner... however I guess the way the memory works on the arduino is that unless your sample count matches up to the exact length of the new sample, you might start playing part of the previous sample if it's longer than your newer one. Maybe that makes sense? Anyway, it might lead to some interesting samples!

      Delete
  12. Thanks once again! I'm learning all the time.I've noticed someone on Jan's blog asking how to put samples from his actual Minipops into the nano so I'm sending the audacity link to him.Can I send your blog link too?I won't without your permission of course.

    ReplyDelete
  13. Done some initial testing,getting there slowly.Pattern pot appears to be wired in reverse on schematic so I swapped connections (I wanted Oxygen to be fully clockwise).Tempo pot correct but overall seems too fast. Does anyone know how to slow the clock down?

    ReplyDelete
    Replies
    1. Oh sorry - I must've drawn the pot in reverse :-( As for the tempo, are you using a 10k pot? Linear is also needed, not logarithmic (it'll say A or B after the 10k). On line 754 there's also a line that reads: uint16_t tempo=3500; You could try changing this, although it might cause an error elsewhere in the code (I've no idea as I've not tried it). Best of luck!

      Delete
  14. Replies
    1. The price? Or the prize? Hopefully I'm going to have a few for sale in the next couple of months or so ;-)

      Delete
  15. Hi Hoskins,

    I´m having a lot of problems with the code. A lot of errors are appearing when i try to compile the code.



    Arduino:1.8.5 (Windows 7), Tarjeta:"Arduino/Genuino Uno"

    C:\Users\REBE\Documents\Arduino\minipops\minipops.ino: In function 'void setup()':

    minipops:2: error: 'ss' was not declared in this scope

    ss.com

    ^

    In file included from C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:30:0,

    from sketch\minipops.ino.cpp:1:

    minipops:632: error: expected unqualified-id before string constant

    ISR(TIMER1_COMPA_vect) {

    ^

    minipops:632: error: a function-definition is not allowed here before '{' token

    ISR(TIMER1_COMPA_vect) {

    ^

    minipops:895: error: expected '}' at end of input

    }

    ^

    exit status 1
    'ss' was not declared in this scope





    I´m loosing the faith in the project...Thanks in advance

    ReplyDelete
    Replies
    1. Are you using an Arduino Uno or Nano? Make sure you're compiling to the correct board, hopefully that'll clear the error. If not, are you sure you've copied & pasted the code correctly? Download from github, rather than copy & pasting. Try something like code compare to see if your version introduced any discrepancies. Failing that, maybe install an older version of the Arduino IDE.

      Delete
    2. Thanks for your unvaluable help. Your blog is becaming my holly bible. You're lighting my way ;)

      I'm using mano (a chinese copy of it)

      I'll check your pieces of advise at night. Thanks again

      Delete
    3. Compilation and upload to nano succesful!!
      Thanks mate!!

      ....but now i´m having problems with the circuit,could you tell me something? The only polarity to mind about is the electrolitic capacitor,right? Just to verify,looking at your scheme the positive would be on the right?

      Thanks in advance

      Delete
    4. The cap's positive side (the side that has the longer leg) should be facing towards the audio jack, the shorter leg (negative -) should join to the 1k resistor and 100nF capacitor (the 100nF has no polarity). Make sure the audio jack is correctly wired up... google image search 'audio jack positive negative' and you should figure it out. Cheers!

      Delete
    5. hi again to everyone!!
      I´ve mounted it almost 20 ntimes in a breadboard,and nothing.
      I´ve tried many combinations and it doesn´t work,i don´t know what i´m doing wrong.
      I´ve tried with another board of nano,just to check it´s not faulty.I´m using the right electrolitic capacitor (10uF) at the end in the right position.I´m using a ceramic (100nF)capacitor with 104 written on it,the right resistor (checked with a multimeter)....i´m wiring up the jack mono out correctly....
      I don´t know what to do next.

      thanks again to everyone

      Delete
    6. Something i´m doing is wiring up pins D2-D10 directly to ground ,instead of doing it with switches...but in the same way it should work,right?

      Delete
    7. My electrolitic capacitor is 10uF 50v ,is that the right value?

      Delete
    8. Hey again, first of all don't worry; it might not be fun for it not to work, but hopefully you'll learn why and gain some useful knowledge in the process. I can say for certain the circuit works if it's wired up correctly, so now you just need to go through and find the fault.

      Your last question: My electrolitic capacitor is 10uF 50v ,is that the right value? Yes, this should work fine in the circuit.

      Second: wiring up the pins directly to ground: If you're not following the circuit exactly, then this might be the cause of the problem. I can't remember which way around it's set up, either the circuit is triggered when not connected, or when it's connected. It's possible you have a working circuit but it's set to 'off' (eg the play button is set to 'stop' and all the voices are muted or a mixture of this).
      I guess you have two options here, keep the circuit as it is and play around with grounding and un-grounding the connections (maybe keep half the instrument voices set differently from the other half, so you'll hear something it it starts playing), then concentrate on the different wiring of the play button.
      Or you could just get hold of the switches and set it up with those (if you can only get one switch, connect it up to the stop & start switch... I think it's D2??), and if it still doesn't work, then you'll know the fault is elsewhere. BTW You can get 100 switches from banggood for $3;
      https://www.banggood.com/100pcs-SS12D00G3-2-Position-SPDT-1P2T-3-Pin-PCB-Panel-Mini-Vertical-Slide-Switch-p-1186328.html?rmmds=search&cur_warehouse=CN

      So if it's still not working after that, I'd look to see if the circuit is grounded/powered ok. How have you set it up? On a breadboard? Make sure the ground/5v is connected back to the arduino to complete the circuit (eg, is the ground connected from the breadboard to the arduino).

      Hopefully you should be able to get it to work after this. You could upload a photo to imgur or somewhere & I could try and look for you, but it might be hard to tell from a photo.

      Delete
  16. Mr. Hoskins,i'm so so grateful.
    It works. It works.I tried with a mylar capacitor instead of the cerámic one,and it works perfectly,that was the stupid begginer mistake.
    Thank you for your time and patience. I owe you a beer,a Big Big one.

    ReplyDelete
    Replies
    1. Great stuff, I'm glad you got it working! Cheers!

      Delete
    2. Hi hoskins,i've got my minipops almost finished.
      Something curious happens.It is a little noisy,something like a soft electric whistle.I've soldered a Led on 3.3v pin to non connected pin on "run stop' switch and when i switch it on ,the whistle stops and a little murmur starts....

      Any idea,tip,advice...?

      Delete
    3. Have you included a resistor as part of the LED circuit? Maybe try that first. If not, maybe you're powering it through USB through a computer? Try a decent usb phone charger, that might help filter some of the noise (or a battery)

      Delete
    4. Spot on,once more Mr. Hoskins. I´ve included the resitor into the circuit (i thought powering the lrd with 3.3v it wasn´t needed),and found a better phone charger.No more noise. I don´t know how to express my gratefulness. Thanks again

      Delete
    5. No worries, hopefully I should have some more tutorials for DIY synths in the near future. Cheers!

      Delete
  17. Great ! I’m italian sorry for my bad english !
    I built a minipops with your tutorial and everythings work perfectly !!! Many many many thanks !!! But please update midi output clock code
    I try to Made myself but brrrrrrrrrr.
    Pleaseeeeeeeee !

    Thank you in any case

    ReplyDelete
    Replies
    1. Hey Fabrizio... send me an email; gary909 at gmail dot com

      Delete
  18. Hi Mr.Hoskins again,
    I've been playing with my minipops and i'm so proud of it. I wouldn't have got it without your help.
    Now i'm messing around the clock out. I connected a wire directly to pin d13 (+) and another one to ground (-),both to a minijack socket. It syncs with my tb03 ,but the signal,as i see it,is not so clean. It sounds perfectly with my bassline,it gives swing and personality to the sound,but i'd like to enhance it.
    Any ideas...maybe should i include any resistor to the circuit?

    Thanks in advance

    ReplyDelete
    Replies
    1. By the way...son i will try to implement midi,i have the code ;)

      Delete
    2. Hey David! I've never used the clock out so sadly I can't give you any advice... I guess it sends a repetitive pulse that other instruments then sync to from pin 13... which then must be connected to the tempo control? You could open the code and see whats happening on pin 13? Maybe you could then change the code somehow? Sorry, I've never looked into this, so it's all a guess! Good luck!

      Delete
  19. Hallo Mr Hoskins,
    thanks!
    I love the Minipops (I have a real Minipops 35)and your little Machine.
    But i have no Idea why my O2 stay on one Pattern?
    I checked the Connections , Voltage on Pins etc...but it is only possible to mute 5 Tones via Muteswitches.
    The Tempo and Pattern-Potentiometers not working.
    The Start/Stop-Switch doesen't work.
    I would so gratefull for any Idea!

    Best Regards
    Mike

    ReplyDelete
    Replies
    1. mhh...i can control the Arduino only with the Monitor-Funktion, but not with the Switches Pots etc.

      Delete
    2. Hey Mike, Can you confirm the arduino has worked with other projects? Could be a problem with that, or maybe the switches etc?

      If you can mute 5 parts, then those switches you can assume work ok, so maybe move a working one to a non-working part, if it works there then the problem was the switch, if it doesn't work, then the problem could be arduino port.

      Are you using Log or Linear pots? I'd double check that; Log pots will give 'jumpy' results.

      Maybe build small circuits with some of the parts to confirm they are working (eg a light dimmer with an on/off switch and swap out all the parts with that)

      Hmmm... Are you using an Arduino on a breadboard (eg you've built the arduino from seperate parts?)? If you've done it this way, the pin out numbers are different from those found on a purchased arduino. Google & compare 'arduino pin out' with 'atmega328p pinout'.

      ...If you're using a arduino Uno and not a Nano, double check with google to see if the pin outs on these are the same.

      How did you add the code to the arduino? Copy & pasting can give errors (it adds extra HTML info etc)... try to find the downloadable .ino(I think that's what it is anyway). Use an online code comparison site (google 'code compare') to see that your code matches exactly. Try using different browsers if it's different, or paste it into a notepad file first (I think notepad strips the extra HTML info, but I could be wrong).

      ...Apart from that you can only really check the connections again. Sometimes it helps to re-build it from scratch? I can confirm the circuit works though, so keep trying.

      Best of Luck!

      Delete
    3. Okay..the Mute-Problem is fixed...it was a Pattern with only 5 Voices..;o)
      All Pattern are present and i can mute all Tones if i like.
      I checked with an LED the analog-read-inputs and the Current goes korrekt to A4 and A5.
      Then i opened the Arduino ide and run the Monitor.
      It is possible to changed Pattern, Tempo...all my losing Funktion via the Monitor with "j,k, f,d, and Space", but i see no analog read on the Monitor if i turned the Potentiometers.
      In the Scetch is only a serial-in at "A0".
      Where's the analog 4 and 5?
      Is it possibble, that i get a wrong Scetch without the Potentiometer Options?




      Delete
    4. Yeahhh...everything is okay!!
      In the scetch was a little Mistake...it was missing a semikolon..,o)
      Thanxs, very mutch for your Support!

      Delete
    5. Hey Mike, glad you got it working!

      Delete
  20. Hello there, thank you for sharing this project and for answering literally all questions, youve got quite the endurance.

    Id like to ask you if theres a way to START and STOP the drum machine, because as it is, it just runs forever, you just mute it.

    Another question is if theres a way to make the patterns longer, like not 16 steps but 32 or more, or 10, 13, etc.

    Also, the part where you discussed the possibility to add our own samples is very interesting, did you get any further on that? Cheers

    ReplyDelete
    Replies
    1. Hey! Thanks for the kind words, I try and help because I remember what it was like to spend hours working on something and for it not to work... In fact it's still a fairly common occurrence! Just remember though, Jan Ostman created the project (and all the code) and I only posted some easy to follow instructions (so take everything I say with a grain of salt!).

      There's already a start/stop switch on Pin D10 (I think), and you could also easily add an on/off switch by putting a spdt switch on the red cable of the battery.

      I guess you could increase the steps, but that would involve re-writing the code... Have a look at line 72 to 351 on the code pasted on Jan's website.

      Possibly it's limited to 16 steps due to memory capacity though, I'm not really sure because I haven't tried. On line 72 increase 'patlen' to maybe [32], then double the pattern parts listed below that. You never know it might work! At least that's where I'd start of I was attempting it. Just keep an eye out when you compile it... I think the memory was already at 97% full.

      Most of that memory is used on the audio samples (found from lines 353 to 632 in the code... The longer numbers in the instruments list means its using more memory)... Which brings us to your last question...

      It should be fairly simple to replace the audio samples, once you've converted them in audacity (there's a link somewhere in the comments I believe linking to a tutorial), then copy and paste those numbers in place of the old ones... Be aware though, something like a 808 bass drum would be too large to fit in the memory, so you'll either have to use other very short samples, or use a different/more powerful Arduino (mega or the like), but then you'll have to ammend the code so it works with the new board (the pin outs etc aren't the same).

      ...could be a great project though! I'd start with adding new samples, then once that is working, start playing with the pattern length.

      Anyway, my programming skills are awful, so I might be completely wrong with the above advice, but by playing around with the code you might get it working, or at least learn something from it.

      Hope it goes well.

      Cheers!

      Delete
    2. Hello there! Thank you for your reply. I replied when i was fit for understanding what you wrote lol. I went back to this project and its a little cool machine. I found the samples really come alive with a bit of reverb and such stuff, as they are they are super dry and hard to the ears, so they need some makeup.

      I think ill upload bigger samples but less instruments, that will make for the extra space needed.

      And now a question ive got, is there a way to control with a toggle switch the sample rate at which the instruments are played back? I mean, what could be the way to tell the arduino to change the playback sample rate in real time with a potentiometer or toggle? Im thinking toggle its easier, because it involves just 2 options, but what do i know lmao cheers!

      Delete
    3. If memory wasn't so limited you could probably just use different samples of the same instruments, then use an 'If' statement to choose between them, eg If switch high; play this sample, else; play low quality sample. Saying that, I've never tried it so you should certainly give it a go, choosing the sample quality with a potentiometer would also be cool, I'm not sure where you'd start with that though. I'd google for similar projects and see what code other people have used and then incorporate it into the drum machine code. Good luck!

      Delete
  21. andrew.e.sloan@gmail.com22 June 2018 at 14:03

    Hi there I made it and am so happy with it.
    I would really like to know if what I am writing here is really true or if it is total rubbish... it works for me!!!!!
    I had a slight problem now maybe I am wrong and have copied things wrongly> I all ways seem to have the daftest things happen to me!!!
    SO when I upload the code fron Jan's site I have no trig signal.
    I traced this down to the trig off pulse beinn not at the right level in the if routine brakets.
    I found if I moved up a level the digitalwritefast(13,LOW) like this

    samplecntBG2=1136;
    }
    if (trig & 128) {
    samplepntGU=0;
    samplecntGU=2816;
    }
    digitalWriteFast(13,LOW); //Clock out Lo
    Serial.print("13off");
    }
    }

    }
    Then my trig output works.

    ReplyDelete
    Replies
    1. Hey Andrew, Thanks for stopping by. Programming is not something I'm very good at so I couldn't really give you a definitive answer! But looking at that section of code it looks like it's made up of 'if' statements (aka 'if this is true do this'), so it's possible the code is functioning ok with line moved up, as long as the statements still hold true. As to why it didn't work in the first place, perhaps you copied & pasted the code and the browser you were using added some extra formatting? But at least you got it working! Thanks!

      Delete
  22. How can i convert a WAV sample to Data?
    I tried with 'sample export' in the Audacity and no success
    Thanks a lot for this work!

    ReplyDelete
  23. Hi Dave, I've not tried it so sadly I don't know. Somebody had posted a link somewhere on this blog with a tutorial, hopefully that will help you. Just be aware the Arduino memory is tiny, so you'll have to use very short samples. Thanks

    ReplyDelete
  24. Hello, I am very interested in giving this a try but I have never messed with electronics and to be quite honest, I can barely understand the schematics due to my lack of knowledge in this field. Do you have any recommended material I should study before I try & build this so I wont make any silly mistakes?

    If I can successfully build this, I really want to give the synthesizer a try!

    Thanks!

    ReplyDelete
    Replies
    1. Hey! Luckily there`s millions of tutorials on the internet covering everything you could possibly need... just search `arduino tutorial` on youtube and you`ll be good to go. A good place to start is to do the arduino blink sketch (where you flash a light built into the arduino), then do the same sketch with with an external LED and resistor. From there its not a giant leap to build the drum machine. The drum machine itself is a really easy build and you`ll learn a lot by just trying and eventually getting it to work. Maybe build it on a breadboard before you solder it, but apart from that just dive in and try. If you prefer books `Make: Electronics` by Charles Platt is highly recommended. Good luck!

      Delete
  25. Hi Mr.Hopkins , first of all i want to thank you for sharing so valuable information online.(excuse my poor english , im writing from chile ,south america . I have tried everything to get this circuit working aand get nothing , would it be ok to write you an email with an image of my protoboard ,ive had experience building other synths in arduino but have already ended the posibilities of what could be wrong.
    Im using- 100nf (electrolitic 104 capacitor)
    1k resistor
    10uf (50v capacitor)
    and an arduino Mega 2560.
    Thank you for such valuable work .
    Felipe.
    Pd: would be very apreciated if you could give me a way to send you an image or drawing of myprotoboard THANKS!!!HELO S.O.S
    PHOTO LINK
    https://ibb.co/2YxLjrH

    ReplyDelete
    Replies
    1. Hey Felipe! I just looked at your picture and it looks ok, although I can't see all of the connections (the capacitor looks like it's facing the correct way!). If I had to guess what the problem could be I would say it was the Arduino Mega... I don't have one, but I think the pin outs might be in a different order? That's where I'd start to investigate if I were you. If you can get hold of an Uno or Nano, that might be easiest. Otherwise you'll need to compare the output pins from a mega to a Nano and either change where the wires are plugged in, or in the code change the pin number. Hope this helps, thanks!

      Delete
  26. Hi , wow didnt expect such an instant response , we where with my friend staying all night trying to work it out and we ust had another arduino , a duemilanove and IT WORKED THERE , you are right it was the pint out of the Arduino Mega , its now 6am and time to sleep but with a smile on our faces after playing around with the drum sounds . YOU ARE AMAZING , very inspired by your dedication of free information sharing .THANK YOU!!
    :)

    ReplyDelete
    Replies
    1. That's great news - I'm glad it helped :-)

      Delete
  27. hi again i was wandering how could i add an on off led to this project , ive been searching online but havent found an answer , thanks!

    ReplyDelete
    Replies
    1. It's pretty easy you just need a resistor and an led. I'd probably use a 1k resistor but you could go down as low as something like 330 ohm. The smaller number on the resistor the brighter the glow (less resistance)... but go to low and the LED will break. Take a look on this page, at the last picture to see a diagram of how to wire it up: http://bloghoskins.blogspot.com/2016/12/simplified-schematics-for-making-string.html

      Delete
  28. What value do the potentiometers have?

    Thanks :)

    ReplyDelete
  29. Hello! I tried to have a look at Jano's website for the code, but his page was deleted. :'( Does anyone have the code? I found it on GitHub, but it appears to be broken, since the Arduino Create Webapp rejects it. I tried to fix it, but am not a very gifted programmer. So, if anyone has the code, please share it here! Thanks!

    ReplyDelete
  30. As Federico_L mentions it appears Jan's website is no longer available - you can still find it via the wayback machine: https://web.archive.org/web/20170918060106/https://janostman.wordpress.com/the-o2-source-code/

    And the referenced Arduino code from the site is still available on github : https://gist.github.com/anonymous/c85c864c337501680505#file-o2minipop-ino

    ReplyDelete
  31. Olá amigo !! Que projeto legal. Vou montar uma também. Em formato de pedal pra guitarra.

    ReplyDelete
  32. Você tem o esquema elétrico atualizado com a saída MIDI ?

    ReplyDelete
  33. AWESOME! Very nice job. I will try to do it this week or so.
    Have you thought about using a rotary switch or encoder for the pattern knob?
    It will make thing a bit easier and more accurate in my opinion.

    ReplyDelete
    Replies
    1. Thanks! I didn't actually write the code for this, but I'm sure you're free to swap out any parts you want. A standard pot actually works fairly well though!

      Delete
  34. Hi. Been thinking of getting into Arduino Projects for a while now. Saw this page and jumped straight in,(Total beginner). Worked first time, Sounds Amazing.. Brilliant start to my new hobby.. So glad i found your page. Thanks for getting me started. Probably a Helios One next.

    ReplyDelete
    Replies
    1. Hey! Thanks for the kind words, I'm glad you got it working :-) Since I wrote this page some clever person has added MIDI-out to the code (so the drum machine can sync its tempo to sequencers and things, it's pretty cool and definitely worth doing). I think the code is available here ->

      https://lookmumnocomputer.discourse.group/t/arduino-drum-machine/2501/20

      ...look for the file 'O2minipops2midiout' and the schematic (you just need to add a couple of resistors and a midi-din socket). Make sure you double/triple check the connections are correct on the midi pins, otherwise you might damage the equiptment you connect it to.

      Delete
  35. Hello Blog Hoskins & all the other O2-fans,

    I will tinker the O2 minipops the next days. As I dont have a Nano I will try to make it with a Uno. My main target is to use a teensy board. This has much more memory and the memory can be expanded (with SD card and/or flash memory), much more inputs. Teensy also offers an optional Audioboard. Teensy supports 16 bit, 44,1 kHz. Besides the original converted low-res samples with teensy one is able to use high-res samples.

    Teensy uses the Arduino IDE, the same syntax and offers also C & C++ library capabilities.

    Unfortunately I am not a coder :-/ Has anyone here tried to "convert" the Jan Ostman-Version for teensy? If not: is somebody here an avid Aruidno&Teensy, C&C++-crack who wants to assist the community to teensify this project?

    I guess Teensy would be a better platform: more memory, more samples, higher resolution of the samples (you still can use the lo-fi samples if you want). In case that here is no one an Arduino & Teensy crack: shall we implement this project all together? Everybody has a little knowledge - together we have the SUPER knowledge :-) What would you all say?

    ReplyDelete
    Replies
    1. It shouldn't be too hard for you to convert it to Teensy... Read: https://sensorium.github.io/Mozzi/ and scroll down to where they specify about teensy. A good trial would be to get the examples working with it (you have to uncomment some lines in the code, but it's explained at the top of the file).

      Delete
    2. Yeah yeah yeah! Big thank you!

      Delete
  36. Hi. First, thanks for keeping the project alive. I've built the O2 -- but the switches don't have any effect. Any idea what could cause that? or how to check if they are working properly?
    Thanks

    ReplyDelete
    Replies
    1. Can you hear the machine working, but can't mute the voices? Sounds like it might be something simple. I would check the switches are connected to ground (GND on the arduino). If they are, then double check the switches are wired correctly. If you have a multimeter, set it to the speaker option (aka continuity mode)... when you put together the two leads of the multimeter, you'll hear an annoying beep. The beep means there's a connection. put the leads on the two soldered parts of the switch. There should be a beep with the switch in one direction, but no beep when it's set in the other direction. If your results differ to this, then perhaps the switches are broken, have been soldered/wired incorrectly, or perhaps the wrong type of switch has been used. Hopefully this will be enough to get the machine working. Thanks!

      Delete
    2. Thanks -- it was a bad solder joint between the switch terminal and ground (I had run a wire between the switches and then added a wire to the ground...that had broken off)

      Delete
    3. Great you managed to get it working!

      Delete
  37. Any suggestion of how to get the Oxygene 4 sound? or isn't that possible?

    ReplyDelete
  38. Yes it's possible but you'd have to figure out the pattern... In the code from about line 75 to 350 you'll find all the patterns. So for example 'hardRock16' runs from line 75 to 90, or 'Oxygen12' runs from line 334 to 349. You'll see a line of numbers like 'B00000000'. Each of the 8 zeros represents the 8 sounds the drum machine makes. I think the bass drum is the first sound. So if you just wanted to play that you'd change to code to B10000000. There are 16 lines of this code (16 steps of the drum beat). So to play the bass drum everyother step would look like;
    B10000000
    B00000000
    B10000000
    B00000000
    B10000000
    B00000000
    B10000000
    B00000000
    B10000000
    B00000000
    B10000000
    B00000000
    B10000000
    B00000000
    B10000000
    B00000000

    Hopefully you should be able to figure out how to create your own drum beats now

    ReplyDelete
  39. (So '0' means the sound isn't playing and '1' turns the sound on... all the sounds on would be B11111111)

    ReplyDelete
  40. thanks. I'll have to play with it

    ReplyDelete
  41. Hello friend, I really liked it, how can I get the code?

    ReplyDelete
    Replies
    1. Put this address into the internet archive & search with the year 2016;
      https://janostman.wordpress.com/the-o2-source-code/
      If not, there's a link to the code with added MIDI somewhere in the forums of look mum no computers's website

      Delete
  42. This comment has been removed by the author.

    ReplyDelete
  43. Hey, thank you so much for posting this blog and fielding all the comments on here. The info plus this discussion helped me a ton! I built a version of the Mini Pops where I added an OLED screen showing the pattern number and name, and I changed the patterns extensively to emulate a bunch of 80s pop songs. The OLED runs on a second Arduino Nano because even the small OLED libraries are memory hogs. It's very simple to add though. All you need is a common ground and second output off the middle signal lug of the pattern pot. I've shared a video and all the code & schematics are on github. Wanted to share in the event it's helpful to others. There are links to all of it here plus some photos of the build process if anyone is interested.
    https://noisymaker.blogspot.com/2022/04/perculator-arduino-mini-pops-drum.html
    And if you just want to see it and here the new beats you can go directly to the video.
    https://www.youtube.com/watch?v=Q6Sxdc9tYrI

    ReplyDelete
    Replies
    1. I meant hear not here. Doh!

      Delete
    2. Hey! Sweet upgrades! I also really liked the other boxes you'd built (but couldn't find anymore info about them... a sequencer and arpeggiator?). They all work together really nicely. And also thankyou for improving the drum patterns... most of the old 3/4 time stuff I struggled to find good uses for, but these new beats will be great. I added a link to your site at the top of the page. Thanks again :-)

      Delete
  44. Dear blog hoskins, is it possible to share code & schematics of your v3 o2? It has a Volume pot 🙂

    ReplyDelete
    Replies
    1. I sadly have no image of the volume pot, but it's not hard to implement... maybe breadboard it first to be sure. You just need something like a 50k audio pot, in between the + positive lug of the audio out jack and the 10uF cap. Have the capacitor side go in the left of the pot, then the other wire coming out of the center of the pot to the audio jack (leave the third leg of the pot). I think this is correct... Apologies, this is from memory, so it's possible the volume will be in reverse... if that's the case, just swap the legs until you get it working correctly

      Delete
    2. Thank you for the quick response :-)

      Delete
  45. Quick question how do you get the Arduino to make the sound? and how loud is the output?

    ReplyDelete
    Replies
    1. I didn't write the code for the drum machine, Jan Ostman did (he might have a better write up on his site), but the sounds are digitised and replaced with numbers... hundreds or maybe thousands of them. If you were to plot these out on a graph, you'd start to get an image that looks like a Wav form. You can see these numbers somewhere in the code, like BD: {0, 12, 40, 121, ... } etc. You can replace these sounds with your own but the memory is limited (1 or 2 secs total perhaps).
      I once made a sampling drum pad that uses the samples in the same way (complete with a guide of how to convert audio into the Arduino)... https://bloghoskins.blogspot.com/p/sampling-drum-pad.html
      The output is loud enough for headphones, but you could always build an extra amp on the output if you needed it louder

      Delete

Say something...