Converting sketches from 328 to 32U4? Grains to littleBits

I'm doing some synth/sound stuff and have a couple littleBits Arduino bits (32U4). Hoping to try some of the sketches meant for the Grains AE module which uses a 328. Since these processors are closely related, I'm guessing the main difference between the two are the in/out pin assignments, which would need to be changed in the sketch. Any other considerations to look out for or perhaps a quick guide in adapting sketches between Arduino models?

Here's links to the devices and sketches:

The LittleBits products are fairly popular on ebay. I'd sell them and get the board for which the code is meant.

That's not an option for me. I'm integrating the Arduino bit into a larger littleBits synth rig. Having to mess with breadboards, soldering or adding a different form factor defeats the convenience of going with littleBits platform. I'm trying to see how far I can take the littleBits stuff.

Sounds like a cool project, have fun.

At a glance the littleBits processor board uses normal IDE pin naming conventions.

I haven't looked at any sketch you may have linked to, but Imma guess it would have a good just of just working as long as you have the pins assigned to ones that the littleBits board makes available.

When I have a bigger window I will look at anything you've linked. Seems all straight ahead what Imdid see.

a7

Thanks for chiming in. Yes, the littleBits Arduino bit is essentially a regular Leonardo. All the normal connectors seem to be there, just some use the littleBits snap connectors, while others are bare on the board.

I think the trick is that the Grains module seems to use a different pin names and it also looks like there are 3 analog CV inputs vs the 2 analog/1 digital on the littleBits connectors. I've never coded Arduino, so I'm not sure how to properly switch those assignments in the sketch. If I just try to upload a Grains sketch to the littleBits I get a "Compilation error: 'TCCR2A' was not declared in this scope."

That register is one of the control registers for Timer2 on the 328P. It sounds like the 32u4 doesn’t have a Timer2 so you will have to move that function to a different timer. That will probably require using different output pins (the PWM outputs are driven by hardware timers)

Ok that makes sense. I need to figure out the the 32U4's control registers and corresponding output pins that match the 328's functionality, then change those values in the sketch. Worth a try. Thanks.

1 Like

Hi Davis, did you make any progress? I own a littlebits arduino synth myself and i think its a great idea, but new to arduino also.
Have a nice day, Jort

It became a bit frustrating so I took a break. I'm planning on diving deep into it sometime this year as I now have 2 arduino bits.

I did however find a number of cool arduino sketches made for the bit that add additional synth functions:

  1. pitch quantizer/dual OSC trigger...so you can build a 2-OSC synth and also apply a scale to make more musical sequencers
  2. LFO/ADSR
  3. sample-based drum machine that uses preset patterns (doesn't send timing info to the sequencer though)
  4. USB-midi interface

I also started a littleBits synth group on facebook. Hopefully that can become a central place for this largely forgotten modular synth platform.

Hi Davis, thanks for answering. Unfortunately i am not on facebook, but yes i like littlebits synt a lot. please report here if you if you make progres. Will check your recommendations.

Hi Davis, couldnt this easily be solved by attaching bitsnaps to a diferent arduino, like an uno?
I am not that familiar with arduino.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.