Saturday, October 25, 2008

NanoGroover: Triplets and Quintuplets in Nanoloop

I made a device that generates Nanoloop sync data for two Game Boys. The thing is that the user can set the ratio of sync clock of one of the Game Boys to the other, in the following ratios:

• Two in the time of four (double speed)
• Three in the time of four (three against four cross rhythms)
• Four in the time of four (1:1; the sync is equal)
• Five in the time of four (quintuplets)
• Six in the time of four (triplets)

There are also controls for controlling the speed of sync (via a potentiometer; aka a "knob") and interrupting / stopping the sync signals for either Game Boy, so that it stops.

Of course I know that this would be easy to make in Arduino or Picaxe or using an Atmel or a PIC - but all of this would require the user to program a chip in some way. The nice thing is that this design only requires three logic chips (which I bought locally for around AU$2.50 in total), a capacitor, a resistor and a pot. No programming or "special parts" are required. A Game Boy link cable needs to be hacked up.

Quick Video Demo
You can watch a video of length 53 seconds here:

Power Source
If the Game Boy link cable doesn't have 5V / 3.5V wire or pin, then a suitable power source will be required. 5V would be required for Original Game Boy / Pocket / Color. 3.5V would be required for Game Boy Advance / SP / Micro.

For the one that I made, I have been using three rechargeable 1.2V NiMH batteries - the output is around 4V, and it works fine for me.

The overall range of the tempo control (pot R1) can be set by changing the values of R1, R2 and C1.

Battery cells G1, G2 and G3 are 3 x AA NiMH batteries and are required if the GB / GBA link cable is lacking pin 1 (the voltage pin). 2 x non-rechargeable batteries may also work, although this has not been tested.

Other ratios than 2:4, 3:4, 4:4, 5:4 and 6:4 (see above) can be achieved by changing pins Q2, Q3, Q4, Q5 and Q6 to other Qn pins. See the "how it works" section for more information.

The eight switches in the DIL-8 switch (SW1) operate as follows:
• 1 - 5 sets the ratio from 2:4 to 6:4. Only one of the switches should be up at a given point in time.
• 6 and 7 interrupts the sync signal to each Game Boy independently if set to the off position.
• 8 turns the device on and off.

Below you can see a photo of the GBA link cable with the appropriate pins that you need to use. As you can see, my link cable here is missing the voltage pin (pin 1: VDD).


How it Works
Nanoloop sync is quite simple in that it is clock signal that is constantly moving at a rate of 12 pulse per quarter note, as shown below:

Clock: |--__--__--__--__--__--__--__--__--__--__--__--__| = 1 quarter note
This type of signal is very easy to generate with, say, a simple square wave control oscillator. Another important thing to note about this sync signal is that the Game Boy doesn't care what the pulse width of this signal is - all it needs is a high state followed by a low state, repeated twelve times per quarter note.

So we can generate suitable oscillations using, say, an RC type oscillator. We can also use such an oscillator as a control clock signal for generating slightly more complex clock structures using other ICs like the 4017.

The 4017 is a decade counter, which means that it has 10 outputs labeled Q0 to Q9, each of which outputs a 'tick' one after the other if a clock signal is applied to the input in a repeating setup like this:

CK: --__--__--__--__--__--__--__--__--__--__
Q0: --______________________________________
Q1: ____--__________________________________
Q2: ________--______________________________
Q3: ____________--__________________________
Q4: ________________--______________________
Q5: ____________________--__________________
Q6: ________________________--______________
Q7: ____________________________--__________
Q8: ________________________________--______
Q9: ____________________________________--__

The nice thing is that the 4017 also has a reset pin, which sets the counter back to zero, so that the next clock tick will be output on Q0. So by connecting one of the Qn outputs back to the reset, we can generate a counter signal at any ratio from 1:1 to 10:1 in relation to the original clock signal.

Then its simply a matter of connecting Q0 to the Nanoloop clock input, and generating a different clock phase using a 4017 counter per Game Boy.

So for example, imagine that we have two 4017 counters, both of which are driven by the same clock signal from a square wave oscillator. Q0 of both 4017's are connected to the Nanoloop clock input of two Game Boys.

Now, imagine that the Q3 pin of one of the 4017s is connected back to the reset, whilst the Q3 pin of the other 4017 is connected back to its respective reset pin. We get the following result:

4017 1: --__________--__________--__________--__________
4017 2: --______________--______________--______________

See? It takes three pulses of the second 4017 to equal the same amount of time as four pulses of the first 4017 - in other words, we are generating a clock signals that are at a speed of three is to four in relation to one another. Thus, we can generate a number of ratios by using the various Qn outputs.


10k said...

This is the best idea! 1,000,000 internets for you, Seb.

Sebastian Tomczak said...

Why thank you tom

Keaton_Blue said...

Hmmm looks very cool! I've been thinking of doing some single Nanoloop 2.3 stuff, could this same idea be applied to a single gameboy?