Arduino, Atmega328, Grids, Edges, whats going on here?

Okay… So Atmega328 is a microcontroller. The one used on the Arduino, and the one used on Grids and Edges. This raises a somewhat obvious question, but I can’t find a clear answer anywhere… Can these modules translate to Arduino? What about Branches, with the Atmega88?
What’s the difference here?
I see the Arduino uses a 16mhz crystal and these modules use 20mhz, I’m sure that’s relevant, at least to Edges right? (Audio)
I guess I was hoping I could plug bits of the code into Arduino and learn relevant musical coding skills.
Please enlighten me, and take it easy on me, I just wanna learn!

To start with, Edges uses an AVR XMega, which is a different family of chips.

You can run Grids’ or Branches’ code on an Arduino board with a few changes to account for the different clock frequency.

If you like the Mutable Instruments aesthetic and want to learn about musical coding skills using ATMegas, I would recommend looking at the Shruthi, Anushri and Ambika: which all use ATMega microcontrollers I learned a lot (and am still learning!) from building these synths and reading through their code.

Oh geez, Edges is a differently thing entirely then, I misread the tiny schematic text!
So in the master folder for Grids, is there any one particular folder that contains the most magic?I’m sure I’ll have to go through all of them. But for example, if I wanted to learn… How you clock everything, the tempo knob, the clock input… It’s gotta be more complex than “Blink Without Delay.” But like it would be a useful thing to know how to apply elsewhere.
I believe you started with Arduino so I also wondered if you knew of some wealth of electronic music Arduino learning resource, as it’s also safe to say I may just be in over my head digging through your work.

I will also look at the diy synths you mentioned barnaby. I feel I grasp the hardware and building fairly well, but the magic inside the digital part is above and beyond me, but very inspiring in its capabilities.

I don’t do things Arduino style, so if you want to learn how to do things with Arduino boards… Learn using Arduino resources :slight_smile:

I guess I didn’t exactly understand there was an “Arduino style.” I just have an Arduino and saw it was the same microcontroller and thought all was aligned and that was all there was to it.
I now understand Arduino uses its own language, and that is translated to c by the arduino ide. I imagine you just write in c.
I apologize for my ignorance, I realize I’m trying to learn too much too fast.

That’s not quite true.

Arduino code is generally written in C or C++, just like @pichenettes uses.

Arduino provide a number of libraries (also largely written in C/C++) to make things like accessing the hardware easier, and these libraries have to be addressed in specific ways. That’s what @pichenettes means by “Arduino style”.

The Arduino IDE compiles your code (and any libraries that it depends on) into machine code that is specific to the target micro-controller.

@pichenettes doesn’t use the Arduino IDE or any of the Arduino libraries.

In some cases, he’s written equivalent libraries himself, and used them across several products.

1 Like

Ahhhhh! Thanks for taking the time to break that down for me :pray:

I would say, learn with the Arduino resources first. They are generally quite easy to understand and there is a ton of help online. That will teach you a lot about the general principles of coding and the structures typically used. Once you feel comfortable with that, you can safely explore pichenettes code without the feeling of getting lost. Because her code is quite deep and complex to a beginner’s eye, especially with all the template magic.


Hello…it depends on your requirements. As mentioned above if you want to use for Mutable Instrument then go for ATMEGA. But if you are completely new learner and want to make it easy for you then Arduino is also a good choice to start learning.

I just got started on this route myself. I’ve been eyeing the MidiGal, and was trying to figure out what stopped me from using any of Arduino R3 as a MidiGal, as the schematics are pretty similar:



Anyways, I got an R3 setup as ArduinoISP, and with AVRDUDESS managed to burn the bootloader from the MidiGal files onto a fresh 328P through the R3, omitting a dedicated programmer. As far as I know, the bootloader loaded fine, and the Atmega is ready for firmware install over midi. Need a few parts before I can check.

So I’ve noticed different Arduino’s run with different crystals: my original R3 runs with 16MHz, a chinese clone has a 12MHz installed, while the MidiGal calls for a 20MHz, which is what I installed together with the fresh 328P I burnt the bootloader onto; I presume it would flash with either crystal, but the firmware will only run properly with a crystal that matches the code…(?).

So regarding running MI modules on Arduino; is it merely a question of changing the crystal on the Arduino to the one expected in the MI code? Or would one need to change the code to match the crystal on the Arduino?

Anyways, interested in the topic!

It might be easier to just change the crystal! It’s not like the MIDIpal code is very CPU intensive, but at least you run trusted and tested code/binaries.

1 Like

For anyone just getting into coding with microcontrollers, and having an Arduino lying around, there’s actually a port of Grids to Arduino.