Random Sequencer PCB updated to version 2.1
I just uploaded a new version of the PCB gerber files to the Random Sequencer Documentation page. Version 2.1 fixes the error in the polarity of C6.
Which instructions should I use?
If your board says “Random Sequencer Rev 2″, then it has the polarity fault. Build according to the addendum.
If your board says “Random Sequencer Rev 2.1 (cap fix)” then it does not have the polarity fault. Build according to the silkscreen and the build documentation.
Full Parts Kits
More exciting news is that Steven at http://www.thonk.co.uk/ will shortly be selling full parts kits for the random sequencer.
New demo videos
Going acoustic: random midi player piano
This is the offspring of the random sequencer and the Piano Matic 3000. The hardware is six pots and three LEDs connected to an Arduino Mega 2560, with a simple Midi out.
I’m using a Mega partly for the extra memory. I was inspired by Jeff Atwood’s ‘Markov Chains and You‘ to try to build a 4-dimensional markov chain and quickly filled up the 2kb of memory on a standard arduino. It’s also handy for Midi, because the Mega has several serial outputs – you can use one for debugging and one to drive the midi output.
Here’s a recording of the first code – Random_Player_1 (here’s the code in github). It’s just random notes picked from scales, with a rhythm based on probablities, but I quite like how it sounds.
Next up: really get the markov chain system working, add some chords, work more on the rhythms.
I’m trying to read Iannis Xenakis’ Formalized Music, which seems to be the mothership for algorithmic music generation, but it’s rather hard work…
Random Sequencer Addendum
User Ultrashock in the forum noticed a big silly error – C6, one of the power supply smoothing capacitors is the wrong way round in the schematic and the PCB silkscreen. Surprisingly (and happily) it doesn’t seem to have much impact (i.e. it doesn’t blow up or get hot). Still, it’s an easy fix, and very easy to correct when building.
When building, insert C6 the opposite way to the silkscreen markings. i.e. place the LONG lead in the hole with the circular pad, below the – sign.
With the power header in the background, both capacitors should have their negative stripes on the RIGHT.
Update: September 2012. I have now corrected the files if you’re downloading gerbers to build boards.
Rev 2 = Faulty
Rev 2.1 = Fixed
Midi piano practise encourager using Arduino and Sugru
The Piano Matic 3000 was a present for my daughter’s 7th birthday, to encourage her to practise the piano more often. It’s powered by a 9v battery and connected to our Yamaha p70 electronic piano.
It does two things. Under the half ping pong ball (attached with epoxy and sugru) is an RGB led. Different notes make different colours: C is red, D is green, E is blue. Black keys are random colours.
As you play, it counts the notes and lights LEDs at each threshold.
When I received this tweet from Tom Standage, I realised I’d made a mistake in the code, counting both note starts and note ends. I’ve corrected this in the code below, but not tested it yet.
The schematic is in the code below – I used 2-300 ohm resistors on all the LEDs. There’s also a rather superfluous light in the power switch. If no notes are played for 20 seconds, the power switch light starts to flash, to warn you that the battery is still being used. You’ll also need to install the Midi Library.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
/*
PIANO-MATIC 3000
Midi colour generator and note counter
Circuit:
Midi isolation/inversion circuit from:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1187962258/
Going into Serial RX pin.
NB: Add a jumper or switch to disconnect from Serial RX to allow sketches to be uploaded!
RGB LED:
D9 = Red
D10 = Green
D11 = Blue
Note count LEDs:
D4 = first
D5 = second
D6 = third
Switch LED = D3
*/
// THRESHOLDS FOR THE NOTE LEDs
int notebonus1=200;
int notebonus2=500;
int notebonus3=2000;
#include <MIDI.h> // Add Midi Library
// Assign pins to LEDs
#define redLED 9
#define greenLED 10
#define blueLED 11
#define bonusLED1 4
#define bonusLED2 5
#define bonusLED3 6
#define switchLED 3
// Set up variables
int r; // RGB = colour variables for output
int g;
int b;
int targetr; // target rgb that colours are fading towards
int targetb;
int targetg;
int refresh; // sets speed of refresh, influences speed of fades etc
int refreshcount; // counter for refreshes
int notecount; // overall note counter
float fade = 254; // brightness of switch LED
unsigned long timeout = 0; // timeout counter
unsigned long timeouttime = 20000; // timeout for switch LED - how many millis after last note before it starts to flash
unsigned long time; // holder for milliseconds since boot
boolean boot = true; // indicates first run - to allow for LED switch fade
void MyHandleNoteOn(byte channel, byte pitch, byte velocity) { // Triggered by Note On
if (velocity>0){
notecount++;
}; // don't add to the note count for note off messages
timeout = time;
boot = false;
refresh=(127-velocity)*4; // connects velocity to fade speed
// COLOUR SETTINGS
if (pitch % 12 == 0){ // C
targetr=254;
targetg=0;
targetb=0;
}
else if (pitch % 12 == 2){ // D
targetr=0;
targetg=254;
targetb=0;
}
else if (pitch % 12 == 4){ // E
targetr=0;
targetg=0;
targetb=254;
}
else if (pitch % 12 == 5){ // F
targetr=254;
targetg=254;
targetb=0;
}
else if (pitch % 12 == 7){ // G
targetr=0;
targetg=254;
targetb=254;
}
else if (pitch % 12 == 9){ // A
targetr=254;
targetg=0;
targetb=254;
}
else if (pitch % 12 == 11){ // B
targetr=200;
targetg=200;
targetb=200;
}
else
{
targetr=random(254);
targetg=random(254);
targetb=random(254);
}; //black notes are random
if (velocity == 0) {//A NOTE ON message with a velocity = Zero is actualy a NOTE OFF
targetr=0;
targetg=0;
targetb=0;
;
}
}
void MyHandleNoteOff(byte channel, byte pitch, byte velocity) { // Some MIDI keyboards use this for note off
targetr=0;
targetg=0;
targetb=0;
}
void setup() {
pinMode (bonusLED1, OUTPUT);
pinMode (bonusLED2, OUTPUT);
pinMode(bonusLED3, OUTPUT);
pinMode(switchLED, OUTPUT);
MIDI.begin(MIDI_CHANNEL_OMNI); // Initialize the Midi Library.
// OMNI sets it to listen to all channels.. MIDI.begin(2) would set it
// to respond to channel 2 notes only.
MIDI.setHandleNoteOn(MyHandleNoteOn); // This is important!! This command
// tells the Midi Library which function I want called when a Note ON command
// is received. in this case it's "MyHandleNoteOn".
MIDI.setHandleNoteOff(MyHandleNoteOff); // This is important!! This command
// tells the Midi Library which function I want called when a Note ON command
// is received. in this case it's "MyHandleNoteOn".
}
void loop() { // Main loop
MIDI.read(); // Continually check what Midi Commands have been received.
time=millis();
if (refreshcount>refresh){ // DON'T UPDATE EVERY CYCLE
//FADE ROUTINE
//while((targetr != r) || (targetg != g) || (targetb != b)){
if (targetr<r){
r=r-1;
};
if (targetg<g){
g=g-1;
};
if (targetb<b){
b=b-1;
};
if (targetr>r){
r=r+2;
};
if (targetg>g){
g=g+2;
};
if (targetb>b){
b=b+2;
};
// UPDATE LEDS
// RGB led
analogWrite(redLED,r);
analogWrite(greenLED, g);
analogWrite(blueLED,b);
// note count LEDs
if (notecount>notebonus1){
digitalWrite(bonusLED1,HIGH);
}
if (notecount>notebonus2){
digitalWrite(bonusLED2,HIGH);
}
if (notecount>notebonus3){
digitalWrite(bonusLED3,HIGH);
}
// switch LED
if (time-timeout>timeouttime) // If box has been left switched on, flash battery light
{
if (time % 1000 < 500){
analogWrite(switchLED,254);
}
else {
analogWrite(switchLED,0);
}
}
if (boot == true){ // on first run, nicely fade the switch light until the first note is played
analogWrite(switchLED,fade);
fade=fade-0.005;
if (fade<.02){
boot=false;
};
}
refreshcount = 0;
}
refreshcount++;
} |
Music Thing Modular Projects
Thought it would be useful to collect some of my older projects into one place:
Simple voltage controlled FM Module
Blinkenlights Euclidean Rhythm Sequencer
Arduino-powered MIDI clock divider
And this background piece on Create Digital Music.
Finding panels and parts for the Random Sequencer: Group Buys
Getting the parts to build a Music Thing random sequencer
I’m not selling PCBs or parts for the Random Sequencer project, but this page should explain how to get hold of them in a cost-effective way.
This information was correct in May 2012.
PCBs: £17 for ten boards, inc global shipping
1. Go to iTead studio’s PCB Prototyping service.
2. Buy “Green 2 layer 5cm * 10cm Max 10pcs” for $22. This is the cheapest option. You can also choose coloured boards for a few dollars more. There’s also a dropdown to chose the finish. HASL is standard. ROHS (lead free) is an extra $5. Gold plating (ENGL) is an extra $15. They’re recently added new dropdowns: Choose Thickness 1.6mm. E-Test seems to be free, I choose 100%.
3. Once you get a confirmation email, send the Random Sequencer v2 Gerbers file to pcb@iteadstudio.com with the order number in title. I’ve done this with these files and it works fine. If they ask about ‘outlines’ reply ‘they’re in every layer’. That’s the only question they’ve ever asked me.
4. My last order arrived in London in less than 3 weeks and cost a total of £17 – that’s £1.70 per board. Sell or give away any spare PCB you end up with.
Parts from £15 per module
1. Apart from pots and sockets, most of the parts are generic. I built most of mine from bitsbox.co.uk
2. The PCB is designed for sockets from erthenvar.com (approx $40 for 100, inc nuts and shipping). You may be able to use other 3.5mm sockets with a bit of cludging.
3. Apart from sockets, here is a complete Random Sequencer project at Mouser. I ordered this, it was 90% correct, and I’ve since updated the project, so I’m confident it should work well. Right now, it costs £14.27. It includes many basic components may have in your parts box (resistors, basic op-amps, ceramic caps), so check before you order. Unfortunately, UK shipping is £12 for orders under £50.
Panels from £tbc
1. Many places will now laser cut Acrylic panels, which are easy to design using vector graphics software like Illustrator. Grab the Random Sequencer panel design files – pdf + illustrator.
2. I use 4dLaser because it’s close to my office. They charge under £20 for a sheet of 3mm Acrylic (maybe 30-40 panels). However, cutting and engraving that entire sheet might cost £80. Ask your laser guy for advice about how to keep the price low. My designs worked for me, but check with your laser operator (i.e. the spirographic design uses a clipping mask, which might not work on some laser cutters)
3. For smaller orders, Pokono could be another way to go, or Pro Modular may be able to help. Update: here is Glitched’s Random Looping Sequencer Project Page on Pokono.
Let me know how you get on!
Building an AD633 Ring Modulator module
Here’s a quick project I really enjoyed: A slightly simplified version of Roman Sowa’s classic AD633 Ring Mod schematic for Euro.
It’s a couple of chips and a few resistors and it sounds fantastic – very clean but also warm. I wanted to get the sound of Fairfield Circuitry’s Randy’s Revenge pedal (video demo) which is based on an AD633, and this gets there.
Slightly unhelpful demo, ringmodding the two outputs from a E350 oscillator against each other, one via a spring reverb. Starts clean:
Straighter demo where you can hear the warmth: Pianet piano against sine from Dixie oscillator, starts clean. Hum is from the Pianet
Here’s the schematic I used with a TL074 op amp in place of the op482. I tried the fully trimmed version on breadboard, but it didn’t seem to need it – v. good rejection carrier rejection without that part of the circuit. The ac/dc switching circuitry (C1, C2, R13, R14) can build built point-to-point on the switch itself and placed before the pots (p3, p4) rather than afterwards. I used 470nf polybox caps in C1, C2. A polarised electrolytic doesn’t work there.
The only hard thing is finding an AD633 chip – I bought mine on eBay from a seller called ‘Partcompany’ for £5.99.
The panel was made from lasercut acrylic, cut by 4D Laser - here’s the design as an Illustrator file: ringmod4hp.ai
Getting started with DIY electronics: The Beavis Board
Dano’s Beavis Board – great idea, not financially viable. He’s now open sourced the whole thing – with schematics, instructions, projects and the parts list. This is a great way to get started. The Beavis Board is dead, long live the Beavis Board.




