Introduction: Multitonal Step Sequencer & Sonic Art Noise Blaster. E.Z. My Own Beginner Code.

About: the a b c approach is not for me .all feedback welcome. thanks for looking. if you would like some assistance or are interested in purchasing something don't be a stranger .
My first ever arduino thing.simply understood and fairly jargon free .drawing showing the theory of the wiring, code basics explained as best i can
mode 1 is 33variable multitone noise machine ,full on mayhem.
mode 2 is code based 24step tone sequencer with bonus random functions.
mode 3 is electro mechanical 4 step multitonal noise sequencer.,(6switches2knobs per step!)speed+sustain ,

, .using arduino mega 2560 and a motor driven rotary switcher, iv added a power amp+speakers in the box.

wanted to go impressive as i got the posh mega board.but couldn't really spend money.i spent a couple of days getting the basics, like  simple code writing and ordering a relay shield ,which has not arrived yet .but i didn't need it anyway.then a couple more days making this.using with parts i had lying around the studio/workshop.a few more days adding to the recipie, then a week writing what i did for you.then more adding and trying to get these instructions into a workable order,mentioning later adjustments on the relavent step.

higher quality video, demonstrating the 3 modes

vid of it stepping.

these were done during development.

Latest update iv got it sequencing analog sounding noises,it goes all step by step one sound at a time if you use timeing devices in the code ,delay,while,clock,milliseconds, so iv added a rotary switch and motor to get it to step while making 6 noises at once using seven parameters per step  
  . iv added step lights ,
using pmw messes up the sound,using a analog input as a input made it crash,I also tried using the rotor values to trigger LEDs but the debounce was awful ,using code devices to fix this means timers or lumpy code, , iv found can use the digital inputs from the rotor switch to drive the lights big resistor and diode permitting.

, anyway I'm really happy with the result ,

it can all runs on a 12 volt adapter.has a internal amplifyer with cooling fan.
with usb power only it has a small speaker for reference. Iv also made it possible to power it with up to 16 volts to get as much sound out the amp as possible.

becides having 24 switches , 8 nobs and a slider to play with, it has a line out, mode switch,step speed nob, rotor and light power save switch.preamp volume control.amp volume control, amp fan speed.

edit after looking for hints online about sequencer code it appears that everybody is using beavises code , i want to understand what im doing so i wrote my own fresh code.

Any questions or aspects of these instructions your having difficulty with,asking doesn't hurt,I want this guide to work and I like to hear what you think, thanks for looking , I hope you enjoy , the first few steps 234&5 are basic soldering and construction advice 


Step 1: Stuff I Used Making This

ok so most  all of this stuff i had laying about the place, heres a breakdown of it with estimates of what they may cost, imagination will save you a bunch of cash.


, connector pins out the back of some broken cd drives (the bin) removed and attached to stripboard  (maplin) illistrated,or you could buy a proto shield , i think £10 to£15
arduino mega £40(maplin) .
10kohm resistors(multipak qty 1000 various values maplin),£7.99.
switches (bulk buy from ebay china£10 for 100 ),
pots ( value pack maplin),£5
rainbow wire (cpc, farnell)£15 for 100m i think
, heatshrink (cpc, farnell). x4 shrink rate 5mm down to 2mm £2 per meter
tiny 8ohm speaker (came with squair wave generator middlesex uni tech resources),£5. or just the speaker probably costs £2
2 car speakers 4 inch 4ohm 20w 40w max(out of my suzuki swift),
power socket(maplin)£2,
phono socket (ebay).£5 for 10
a computer to do the programming(win7 64, hp)£600 something
.(and an amplifier* (kemo germany) for loud sound)i think it was about£20
colour cycling leds3mm (4), ebay about£10 for 100
strip-board,£5 to £10
diodes (not sure of the value 3mm dia x 5mm)
rotary switch things(they came in a maplin value switch assortment bag)£5
a 12v motor with attached gears to slow it down(mine was salvaged from a printer) mfa como drill do some excellent motors for this job.for between £15 and£40
dowel or some other easily workable stick shaped material 6 mm diameter. i used the graphite cores out of some aa batterys.
i later added a laptop style power supply16v,this ment i also had to use a power regulator transistor 6v(ts7806cz)£1.50 maplin
i also added a 16v capacitor 1500uf over the rotor motor contacts, it came off an old pc motherboard.

material to make a case,
studding m4 ,£4 to £7 per meter depending if galvanized or stainless. B7Q do it but cpc is cheaper.
brass pipe,£8 per m from diy superstore b&q
perspex (found material reject from a factory)(been sitting under my waste paper bin for years, i feel this has been a good use for it), you can use any material you like ,(metallic needs insulating) , tupperware works well.
plywood to mount speaker...screws im using self drilling non split type £7 for 100 .25mm, 
rapid set 5mins epoxy glue.£5 a tube
zippy cable ties 4" for wire tidiness, £8/1000
*amplifier(i made this ages ago and its been sitting in a box on a shelf.)
a 40w homemade amplifyer based on a similar product illistrated.£20?
tobacco tin(golden Virginia limited edition) or some sheet material to mount it onto.ponudland is good for these sort of things.
heat sync and fan (bin computer salvage)£20 ish
, 2 pots (maplin potentiometer value bag £5),
phono socket £1.99, .choc blocks £1(Cobb electrical northumberland heath +441322334592).
iron, wire cutter stripper, solder removal pump.step drill on drill, pliers . forceps.mole grips. dremmel, angle grinder. jigsaw for making case.or a holessaw if you prefer. hot glue gun, spatula. bolt cutters, files , sandpaper.lighter for heatshrink. multimeter.drill bit same size as your leds. rule. marker pens.

Step 2: Whats a Step Drill?

step drill, you can make holes in anything any size you like, when mounting switches and nobs no need to measure ever again.
solder pump, its like having an undo button in the real world when soldering
rotary tool thingy, milling bits are good (pictured), reinforced fiber disks are better (x100 £9 from ebay china or £5 for 2 from B&Q), (if your in a hurry having a proper angle grinder handy saves your tiny disks from annihilation)you can pick up a basic 4inch angle grinder for as little as £20.

Step 3: Save Burning Your Fingers With the Fiddley Bits,

forceps are really useful.they lock and grip and stuff. like miniature (poundland sell these) mole grips.

really my soldering ability is so much better after i got a bunch of these, (the fishing type (trout?) have good grippy jaws, the tiny ones pictured are called mosquito forceps)£3 to £10 ebay.

Step 4: For Marking and Case Building

roofers slate squair. or something like that, the point is its usefull, very usefull ,and made out of metal i got it from an independent bargain store in tottenam north London.. and permanent felt pens are also handy the nibs represent the width of a saw blade.

Step 5:

get yer metal sheep on!, ditch the sponge, its cooling down your iron, sending your electricity bill through the ceiling and melting the polar caps.,
these metal soldering iron tip cleaners work well. they dont need feeding water. and to clean them just give it a shake every couple of years, most excess solder gathers in the cup.

Step 6: The Power Amp

i put this bit together ages ago.never used it , but it was a nice addition to this thing,
i thought it only fair i try and remember what i did to make it.
the exact type of amp module i used (40w) has be discontinued by maplin,here is a similar one.

the amp module bit is only a little bigger than a matchbox, it has a metal tab that's supposed to be bolted to something metal to take heat away from the amp. other than that its a black box with 5 wires coming out of it.

i went a bit over the top and added a big heat sync from a pc.

Instructions supplied with the amp specified a fuse, not sure if it also asked for the power relay.
 i followed wiring instructions for power, fuse and volume control. then i added things like the fan on the heat-sync . then a speed control for the fan. then a led to the fan feedback wire. then i squashed it into a tin. wish i had used longer wires. to make this easier to repair in the later steps..

Step 7: Get a Handel on the Programming

iv the book 'getting started with arduino by massimo banzi' which i complain about here,

int 'value name' = 0;  saves a parking space for a value u will be using in the program

void setup(){ pinMode (what pins your going to use and ,how your using them);

void loop()
 your value = how (where);
if or and etc (value == condition) 
       { action to take

       i found 'tone' command here 

         tone(pin,hertz,duration);       }


later i use.... if ( (value == condition) && (value == condition) ) {do something}          ///note the double (( ))

personally i dont like breadboard,its popular and lots of people use and swear by it. i solder most temporary stuff, and if you want to develop soldering skills its a good way to practice sticking and unsticking without destroying components.

Step 8: Why I Solder, My Example.

i thought id broken something after my iffy code was deemed ok and then nothing happend, i had to wiggle the green wire to get it going.
remember to expect these problems at the pokie wire stage.

this is what i was testing at the pokie wire stage,i based this test on this instructable
(i skipped the notes,and was just using the tone function in hz, i also tested using a potentiometer knob to adjust the tone value and checking what happens when 2 tones are triggered at once) 
int switch1 =0;   int switch2 =0;    int pot=0;
void setup()
{  pinMode(speaker,OUTPUT);    pinMode(switch1,INPUT); pinMode(switch2,INPUT); //analog in pins are automatic inputs  }
void loop() 
{  switch = digitalRead (switch);    pot= analogRead(pot);  if (switch==HIGH){tone (speaker,pot);  if (switch==HIGH){tone (speaker,pot); }

you are supposed to use the correct wire for poking in these holes. stranded stuff can break leaving bits of stray metal in there.

Step 9: CONTROL PANEL Start Thinking About Adding Switches

we are going to get all the wires attached to the switches and knobs of the front panel


connect the ends (all trimmed the same length tidy) to the connector shield,
which attaches to the arduino.

how do the switches connect to arduino?
basically wherever there's a switch to a pin (connector on the board)you need to bung in a 10k resistor, luckily i had a bunch of em.
am i going to poke wires into all those holes on the arduino?
no, use a shield (home made or bought),..indecently a thing that plugs into those connectors on your board is officially called a 'shield'not a module or add on or accessory ,or extension.or you get the it what you like.
why resistors? and whats with the name arduino?
when the guys down the king arduino pub (in northern Italy)were planning their micro controller development board, did they bump into the owner of a carbon film resistor factory. i don't know about that, or why you actually need those 10k resistors,i didn't make the rules. , and the pub has a shield emblem on the front of it.which gives a clue to the name and terminology.

im using (for starters) switches on digital pins 22 to 45, and potentiometers on analog input pins 1 to 8.

Step 10: Get a Little Idea, and Multiply It by 24!

getting one switch to bleep is pretty much the same as making lots of switches bleep, it just means repetitive code.
its a computer! copy and paste the code and adjust the details to fit.

just like your internet browser. ctrl and F works in arduino program to find a certain phrase and all the times it appears, you can bulk replace and stuff like that.#

the switches are 3 rows of 8 and and a row of 8 pots.or 8 rows of 3 switches and a pot. :-P

i thought about switch spacing in terms of how tight is the wiring and the back of the switch going to be. leave extra space round pots for the contacts. the front panel is 182 by 298mm, the small squares shown are 12 by 30mm large squares are 44 by 30mm edge clearance (for the sides of the case) is 40mm and 45mm near the pots. i drew all my lines before drilling.

you can use whatever material you like for the case, remember that metals conduct electricity,i have some plastic so im using that.advantages of living in an area with lots of plastics factorys. cool fpond materials.

if using perspex be careful its brittle, drill lightly or with a less aggressive cutting angle work better(a bit blunt)
i think my material is polycarbonate mix, im not sure , nothing went snap! on me.
i centered the holes by melting a small dent with my iron , then follow up with the step drill. drill it so the tip breaks through then alternate between sides (my material is thicker than the step depth on my stepdrill.) remember its easier to make a hole bigger if its too small. the reverse is not true.

Step 11: Tin Jumpers

no im not reenacting the wizard or oz.

if you dont know your switch configuration(which contacts on the back of the switch connect when the switch is switched), test it with a meter . if you've no meter a 9v battery scrap wire and a tongue work also.

work on one element of the circuit at a time,
i did the 5v feed first,
cutting 7 link wires a little longer that needed, tinning the 14 tips , then put a wire in solder one end put the other end in and one end of the next jumper solder that connection.

then i added the resistors,
after that the ground connection,
then consider the pin wires

with that many pin connections you need some organization, check the next step.
try and keep a sense of symmetry, it makes diagnostics easier later if something is amiss.

you dont want to rush this process.
and try not to breath too much solder fumes said the heath and safety executive .

Step 12: Relax!

pin wires to the switches added.

its starting to look complicated, bur its simple stuff repeated.
rainbow wire ribbon is handy here. iv got 10 core

i divided it into sections of 3 wires in diffreent places so each set of 3 is unique, and trackable to its switches.

brown red orange
yellow green blue
purple grey white
grey white black
green blue purpel
red orange yellow
orange yellow green
blue purple grey

24 wires all findable, based on loom combination and the vertical row.
so the 3 switches on the far right have signal wires black white and grey, so look for a set of 3 wire of those colours and there you go.
handy tip aye?

Step 13: Your Pots Are a Smokin

when these attach one goes to 5v
the middle one goes to the pin
another goes to Gnd

i havnt mentioned the values of my pots because my book made no specification of what the board likes,
my pots are different values from 5k to 100k.
there doesn't seem to be a difference as far as the arduinos out put is just assigns a computer value between 0 and 255 for the amount of the 5v its getting.

my pots are attached to analog pins 1 to 8 and referred to in code as pot1 , pot2 = analogRead(2)

Step 14: Adding Pot Makes Thing Wierder

maplin value component bags have pots in yay.
however those pots lack the nut to secure them in anything ,
(they look like they have been scavanged out of something by somebody who has minimal pay)
i epoxyed them in.
look out for a sticky out anti rotation tab that makes it sit wonky, nip it off with side cutters.

Step 15: Remember If Testing Your Soldering

 you've soldered a couple of switches to pin connectors , and the blob looks a bit blobby, you test it with a meter and ,shock horror its not an infinite resistance, remember all those resistors ? if the value is about 20k ohms its ok..if the value is closer to 0 ohms then youve got a problem.

i advise getting most of the wireing connected to the switches then test with a multimeter to check its not shorting out. then test with your board.

Step 16: Connect the Spairs While Your There

on the arduino and my home made connector shield.the digital pins are in a double row.
which ment some tight soldering especially on the odd numbers,
its a good idea to number your switches,and not loose track . i connected mine to digital pins 22 to 45, so i numberd my switches 22 to 45,in the code there referd to val22 =digitalRead(22)   this gets a responce of HIGH or LOW

so after connecting all the planned wires ,i added wires to the 4 spare connectors in the difficult area. digital pins 47 49 51 53 and labled them. if i need them later they are available and identifiable , then its possible to use hot glue to stop anything from wiggling and snapping the wires.

Step 17: I Like This Photo!

Step 18: Adding Basic Volume Control

black is ground left
white goes to speaker middle
white is the signal right

note that slide potentiometers are different configuration, in in doubt test with multimeter.

Step 19: See If It Goes Bang

all the basics are there, so time to connect the board and see it will do something.
i started making code for 1 switch and a nob, added another 2 switches. then once i was confident it was solid, i copy and paste 7 times. then correct the numbers in the code for each switch.

note i used chinagraph pencil on the case to number what board pins there connected to.
 digital 22 to 45
the nobs are analog inputs 1 to 8

the speaker is on pmw pin 2

Step 20: Make a Case

for the case , i thought id do something similar to my snes Nintendo rebuild.(pictured)

i used studding and nylok nuts , going through brass pipe to make the case.
its like a tabel with 2 tops

i cut the brass with dremmel about 10.5cm,  , strapped the pieces of brass together , then used angle grinder to make lengths equal.,at the time i picked the number out of thin air as i hadnt planned the amp or speakers at that time.i got lucky with the clearances.

i cut the studding in equal lengths (plenty longer than the brass 15cm)with bolt cutters then tidied up with angle grinder to pointed finish(rotate the metal in hand as against wheel), the cutters squash the thread making putting nuts on impossible.

getting the nylock nuts in there right place a gripped the studding with mole grips.

and the old diy amp is screwed in through the bottom (into the heat sync) and epoxyd.

the arduino is on stand off legs used from my proto cheapskate case, i removed the sticky pads and epoxyed the feet to the base of the case.

the 18mm ply was scrap, i cut it the height of the inside of the box 105mm, (the width of the came at ply is 260mm)
to mount the speakers in the ply i drew around the speakers ,after placing them at equal distances. then after finding something circular and little smaller (roll of sellotape .) i drew around that after placing it centrally inside the circles, that new circle i cut out with a jigsaw. 2 25mm screws hold the speakers in.
i epoxied the piece of ply with speakers to the base and the brass, to keep the lid removable for service and stuff. the lid id held down with normal nuts.


the little speaker can run direct from the arduino board, theres a line out (its a bit high level upto 5v just be careful ,you dont want to cook external equipment normally expecting much less voltage, start with low volume  )
there's the basic volume (for everything)
a switch to send the signal to the little speaker or the amp.
the line out is on constant, the amp has its own on off switch  fuse and volume.

there is a dc power input socket, the arduino and the amp are happy enough sharing a 12v supply.

Step 22: Those Spair Wires Will Come in Handy.

i added a mode switch to 2 of them, effectivly giving me 3 play modes, (its a 'no off on' switch).
i mounted the switch using off cuts where ever i could fit them.
  pinMode(47,INPUT);   //mode options

47HIGH      =mode 1 is 33variable multitone noise machine.
47&49LOW=mode 2 is code based 24step 8 bit tone sequencer.
49HIGH      =mode 3 is electro mechanical 4 step multitonal noise sequencer.

the spiral wire is there to help the random seed function(quite nifty), it creates randomness using electrostatic interference.its used in mode 2. add the randomSeed in the setup,then at any point you can read the pin for a random number.

i also did not have decorative knob covers, so i put heat shrink on them to make them grippy. the thinner ones i put 2 layers on to make the thicknesses closer to even.

Step 23: I Thought I Had a Duff Pin,and Wasted Best Part of a Day

check your code!

switch 34 was not responding,
so after replacing  the resistor then  the switch, the pin wire,(the tracking system worked)and attached it to a different pin 53, then testing with multimeter to see if something wrong. it still didnt work,
in a moment of madness i noticed a 5 in the code that was supposed to be a now works. must remember 34 in code is now 53.

Step 24: Adding a Slide Switch

for the simulated digital sequencer , i wanted to have a variable delay,(change the tempo) .i added a slider switch to analog input pin 9 ,and i calld the value 'sli9'

Step 25: KEY TO MODE 3

while the digital sequencer kinda works, i want to sequence the noisier sounds that are in mode one,(its more willing to play several sounds at ones )
the time functions mess with the multi sound ability. i tried different attempts, delays, calling time moments, else function, and even some code that was supposed to underclock the chip.

i decided to try these rotating switches, as the mode switch didnt affect sound, i thought id try the same code on a switch that switched all by itself.
i used 4 of these each set up to join the contacts in turn,(giving 4 sub modes) on digital pins 46 48 50 52.

the contacts are
1   2   3
4   5   6

1 and 4 connect and disconnect
2 and 5 connect and disconnect
3 and 6 connect and disconnect

i linked 123 together.
i also linked 456

the effect with 4 0f these set up with the spindel set at 90 degree intervals makes each switch north east south  or west,  or as there refered to in my code rot46 rot48 rot50 rot52.

Step 26: Rotating Switch Ingredients

the motor is out of a lazer printer. the black rod is the core of a battery, easy to file into shape, to taper it i put it in a drill, wrapped sandpaper around the end and pulled the trigger until the paper gets hot, test the size and repeat as necessary.

(i think considering my use of found or specific materials i should suggest an alternative),

4 micro switches mounted to a board with a cam in the center would make for a similar switching device.
micro switches are cheap and easy to get from, maplin  and ebay cpc .

Step 27: Strip Board Keeps Every Thing in Place

also these switches are very easy to overheat and melt when soldering onto them , the strip board minimizes the risk.

Step 28:

a 5v live is needed on each switch , to reduce the number of wires going to the arduino i linked 4 so together they share one live 5v wire.

the colored wires will be going to the pins, 46 yellow  48 green 50 blue and 52 purple

Step 29: Pull Down Earth Thingy

same as the 5v live , they all link to a point after there resistors to provide one gnd connection.

i ran out of 10k resistors , so for one of the switches i had to use two 5k(apx) resistors one after the other.

Step 30: Attach Switcher to Motor

i tied it on with wire, then used hot glue (wrapping around bits to hold as well as its stickyness, i had the motor running as it dried to make the setting position as lined up as possible, (the thing wiggles as it runs, as the glue stiffens an average position is kept)

Step 31: After a Quick Test to See If Its Still Working , I Add a Speed Control.

note .the motor power does not come from the arduino board, instead its attached to the dc input socket.

Step 32: Find a Gap

then stick it in,
its well epoxyed , and luckily i had a whole 5mm of clearance between the speaker and the pots and 10mm to the aerduino.

NOTE  bug fix 4, i changed the speed pot for a slider. slider used in bug fix six.

Step 33: Preparing Status Leds

after trying to drive them with the software ,dodgy signals. i decided to use the power going into pins rot46 rot48 rot50 rot52. as i was connecting this, i saw that the leds would light without the ground being attached, magic no , power was running through my off leds backward then reaching ground via the pull to gnd resistors, im sure thats not good so i found some random diodes(i picked the ones with bigger writing on because they look more decorative) connected them between the arduino pins and the leds, which now require the gnd to work.

i  used 4700ohm resistors for the leds , i want only a little light from them, and dont want to cook my board, they should be using 1milliamp

Step 34: My Dodgy Diodes

i also added a switch between the leds and gnd, to save power, on the otherside of the switch i added the motor negative and the main power input gnd

double pole double termimal/throw switch , whatever , its like having 2 separate switches next to one another with the levers sellotaped together.

Step 35: Sure It Need a Heat Sync

the power tranny gets hot, especially if your dong something wrong , of using 12v of have leds , of anythin really. (usual operating temp of the thing is calculated at 60 to 70 deg centigrade.

i used quick dry epoxy to glue a (parts box )heat sync, to it . being careful not to short anything metal . its wedged against the dc input so glue is holding in multiple directions.

Step 36: Last Minit Repair! Fix 6

the fan speed nob on the amp was not fully working , it needed wiggling to get full speed,then stoped working altogether and smoked a bit, i replaced it with a handy slide switch.

the slider wires  i later swapped with the wires to the rotor speed pot (bug fix 4) as the fan speed adjustment is less often that rotor (mode 3 tempo) adjustment,

Step 37: Later I Modded the Power

the amp module is made to work best at 16v, and can draw upto 4 amps, i found a power supply from an ancient Fujitsu tablet computer that supplys 16v at 2.7amps. which is better that my desk power supply ac converter 12v at 1.2amps.(it also means the desk power supply stays on the desk)

the arduino however has a recommended input of 9? to 12v , (personally i believe it struggles dissapating the excess of 12v) its maximum tolerance is 20v so they say, hmm.

i have still got a 6v power transistor (from a unfinished project) it turns a higher voltage into 6v.

the fan on the amp is probably rated at 12v , i will see if it heats up or breaks.
it did get warm so i added a couple of resistors to the middle wire of the fan speed control 36 ohm,1 got warm and fan was too slow ,2 seem stable and the fan speed looks similar to 12v.

i added the voltage regulator to arduinos supply,(see drawing)
i used lots of heat shrink to make sure its insulated, a screw wedged into the amps heatsink fins keeps it in contact with a big cool bit of metal.a little bit of thermal grease on the back .

as i was doing this i took the opportunity to do the wire tidy up (step 42),and big fix four(swapping rotor pot wires to fan speed slider)

Step 38: Cool Air Toward the Heat Sync Please.

the fan provides nice cool air as it exits the amp . i thought i would use that air to keep the arduino and its tint power thingy cool. this bit of metal pushes the air toward the arduino and power thingy. its held on with hot glue.

you might notice i initially put the deflector on before the voltage regulator.

Step 39: Wireing Diagram

Step 40: The Boring Code Bit

int val47 = 0;  // mode switch
int val49 = 0;

int rds0 = 1000;  // random value

int val22 = 0;int val23 = 0;int val24 = 0;int val25 = 0;int val26 = 0;int val27 = 0;int val28 = 0;int val29 = 0;
int val30 = 0;int val31 = 0;int val32 = 0;int val33 = 0;int val34 = 0;int val35 = 0;int val36 = 0;int val37 = 0;
int val38 = 0;int val39 = 0;int val40 = 0;int val41 = 0;int val42 = 0;int val43 = 0;int val44 = 0;int val45 = 0;

int nob1 = 100;int nob2 = 100;int nob3 = 100;int nob4 = 100;
int nob5 = 100;int nob6 = 100;int nob7 = 100;int nob8 = 100;

int twiz = 100;int sli9 = 100;

int rot46 = 0; int rot48 = 0 ; int rot50 = 0 ; int rot52 = 0;

unsigned long time;

void setup()
  pinMode(2,OUTPUT);  // speaker

  pinMode(47,INPUT);   //mode options

  pinMode(46,INPUT); pinMode(48,INPUT); pinMode(50,INPUT); pinMode(52,INPUT); // rotary switch

  randomSeed(analogRead(0));  // random aeriel thing

  pinMode(53,INPUT);  //pin 34 stopped working(53) no it didnt but the wires changed nowpinMode(35,INPUT);



  void loop()////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    val47 = digitalRead(47);    if (val47 == HIGH)       //mode one
  nob1 = analogRead(1);
    val22 = digitalRead(22);   if (val22 == HIGH)  {      tone(2,nob1+100,2000);     tone(2,nob1+10,nob1+2000);   }
    val23 = digitalRead(23);   if (val23 == HIGH)  {      tone(2,nob1+10,1000);      tone(2,10,1000);             }
    val24 = digitalRead(24);   if (val24 == HIGH)  {      tone(2,nob1+0,1000);       tone(2,nob1+100,1000);       }
  nob2 = analogRead(2);
    val25 = digitalRead(25);   if (val25 == HIGH)  {      tone(2,nob2+200,2000);      tone(2,nob2+10,nob2+2000);  }
    val26 = digitalRead(26);   if (val26 == HIGH)  {      tone(2,nob2+20,1000);       tone(2,20,1000);            }
    val27 = digitalRead(27);   if (val27 == HIGH)  {      tone(2,nob2+0,2000);        tone(2,nob2+100,1000);      }
   nob3 = analogRead(3);
    val28 = digitalRead(28);   if (val28 == HIGH)  {      tone(2,nob3+300,2000);      tone(2,nob3+10,nob3+2000);  }
    val29 = digitalRead(29);   if (val29 == HIGH)  {      tone(2,nob3+30,1000);       tone(2,30,1000);            }
    val30 = digitalRead(30);   if (val30 == HIGH)  {      tone(2,nob3+0,1000);        tone(2,nob3+100,1000);      }
  nob4 = analogRead(4);
    val31 = digitalRead(31);   if (val31 == HIGH)  {      tone(2,nob4+400,2000);      tone(2,nob4+10,nob4+2000);  }
    val32 = digitalRead(32);   if (val32 == HIGH)  {      tone(2,nob4+40,1000);       tone(2,40,1000);            }
    val33 = digitalRead(33);   if (val33 == HIGH)  {      tone(2,nob4+0,1000);        tone(2,nob4+100,1000);      }
  nob5 = analogRead(5);
    val34 = digitalRead(53);   if (val34 == HIGH)  {      tone(2,500,2000);                                       }
    val35 = digitalRead(35);   if (val35 == HIGH)  {      tone(2,nob5+50,1000);       tone(2,50,1000);            }
    val36 = digitalRead(36);   if (val36 == HIGH)  {      tone(2,nob5+0,1000);        tone(2,nob5+100,1000);      }
  nob6 = analogRead(6);
    val37 = digitalRead(37);   if (val37 == HIGH)  {      tone(2,nob6+600,2000);      tone(2,nob6+10,nob6+2000);  }
    val38 = digitalRead(38);   if (val38 == HIGH)  {      tone(2,nob6+60,1000);       tone(2,60,1000);            }
    val39 = digitalRead(39);   if (val39 == HIGH)  {      tone(2,nob6+0,1000);        tone(2,nob6+100,1000);      }
  nob7 = analogRead(7);
    val40 = digitalRead(40);   if (val40 == HIGH)  {      tone(2,nob7+700,2000);      tone(2,nob7+10,nob7+2000);  }
    val41 = digitalRead(41);   if (val41 == HIGH)  {      tone(2,nob7+70,1000);       tone(2,70,1000);            }
    val42 = digitalRead(42);   if (val42 == HIGH)  {      tone(2,nob7+0,1000);        tone(2,nob7+100,1000);      }
  nob8 = analogRead(8);
    val43 = digitalRead(43);   if (val43 == HIGH)  {      tone(2,nob8+800,2000);      tone(2,nob8+10,nob8+2000);  }
    val44 = digitalRead(44);   if (val44 == HIGH)  {      tone(2,nob8+80,1000);       tone(2,80,1000);            }
    val45 = digitalRead(45);   if (val45 == HIGH)  {      tone(2,nob8+0,1000);        tone(2,nob8+100,1000);      }
    ////MODE TWO
    nob1 = analogRead(1); nob2 = analogRead(2);nob3 = analogRead(3);nob4 = analogRead(4);nob5 = analogRead(5);
    nob6 = analogRead(6);nob7 = analogRead(7);nob8 = analogRead(8);
    sli9 = analogRead(9);  rds0 = random(nob7,nob8);
    val47 = digitalRead(47);val49 = digitalRead(49);
    if (val47 == LOW)
    if (val49 == LOW)
    nob1 = analogRead (1); nob2 = analogRead(2);  sli9 = analogRead(9);  rds0 = random(nob1,nob2);
    val22 = digitalRead(22);     if (val22 == HIGH){tone(2,nob1+42,sli9); }
    sli9 = analogRead(9); delay (sli9/8); noTone (2);

     nob2 = analogRead(2); nob1 = analogRead(1); sli9 = analogRead(9);  rds0 = random(nob1,nob2);
    val25 = digitalRead(25);     if (val25 == HIGH){tone(2,nob2 +200,sli9);  tone(2,nob1 +50,sli9);   }  
    sli9 = analogRead(9);        if (val25 == HIGH){delay (sli9/8); noTone (2);}

    nob3 = analogRead (3); nob4 = analogRead(4);  sli9 = analogRead(9);  rds0 = random(nob3,nob4);
    val28 = digitalRead(28);     if (val28 == HIGH){  tone(2,(rds0/2),sli9); tone(2,nob3 +50,sli9);   }
    sli9 = analogRead(9);        if (val28 == HIGH){delay (sli9/8);   noTone (2);}

    nob3 = analogRead (3); nob4 = analogRead(4); sli9 = analogRead(9);  rds0 = random(nob3,nob4);
    val31 = digitalRead(31);     if (val31 == HIGH) { tone(2,(rds0/2),sli9);tone(2,nob4 +250,sli9);   }
    sli9 = analogRead(9);        if (val31 == HIGH) {delay (sli9/8);   noTone (2);}

    nob5 = analogRead (5); nob6 = analogRead(6);  sli9 = analogRead(9);  rds0 = random(nob5,nob6);
    val34 = digitalRead(53);     if (val34 == HIGH){tone(2,(rds0/4),sli9);tone(2,nob5+42,sli9);       }
    sli9 = analogRead(9);        if (val34 == HIGH){delay (sli9/8);   noTone (2);}

     nob5 = analogRead (5); nob6 = analogRead(6); sli9 = analogRead(9);  rds0 = random(nob5,nob6);
    val37 = digitalRead(37);     if (val37 == HIGH){tone(2,(rds0/2),sli9);tone(2,nob6 +270,50);       }
    sli9 = analogRead(9);        if (val37 == HIGH){delay (sli9/8);   noTone (2);}

     nob7 = analogRead(7); nob8 = analogRead(8); sli9 = analogRead(9);  rds0 = random(nob7,nob8);
    val40 = digitalRead(40);     if (val40 == HIGH){ tone(2,(rds0/2),sli9); tone(2,nob7+125,sli9);    }
    sli9 = analogRead(9);        if (val40 == HIGH){  delay (sli9/8);   noTone (2);   }  

     nob7 = analogRead(7); nob8 = analogRead(8); sli9 = analogRead(9);  rds0 = random(nob7,nob8);
     val43 = digitalRead(43);    if (val43 == HIGH){ tone(2,(rds0/2),sli9); tone(2,nob8+97,sli9);     }
    sli9 = analogRead(9);        if (val43 == HIGH) {delay (sli9/8);   noTone (2); }    

    nob1 = analogRead (1); nob2 = analogRead(2); sli9 = analogRead(9);  rds0 = random(nob1,nob2);
    val23 = digitalRead(23);    if (val23 == HIGH){tone(2,(rds0/2),sli9); tone(2,nob1+40,sli9);       }
    sli9 = analogRead(9);       if (val23 == HIGH){ delay (sli9/8);   noTone (2);}

    nob1 = analogRead (1); nob2 = analogRead(2); sli9 = analogRead(9);  rds0 = random(nob1,nob2);
    val26 = digitalRead(26);    if (val26 == HIGH){tone(2,(rds0/2),sli9); tone(2,nob2/10,sli9);       }
    sli9 = analogRead(9);       if (val26 == HIGH){ delay (sli9/8);   noTone (2);}

    nob3 = analogRead (3); nob4 = analogRead(4); sli9 = analogRead(9);  rds0 = random(nob3,nob4);
    val29 = digitalRead(29);    if (val29 == HIGH){ tone(2,(rds0/4),sli9); tone(2,nob3+10,sli9);      }    
    sli9 = analogRead(9);       if (val29 == HIGH){ delay (sli9/8);   noTone (2);}

    nob3 = analogRead (3); nob4 = analogRead(4); sli9 = analogRead(9);  rds0 = random(nob3,nob4);
    val32 = digitalRead(32);    if (val32 == HIGH){ tone(2,(rds0/2),sli9);tone(2,nob4+330,sli9);      }
    sli9 = analogRead(9);       if (val32 == HIGH){ delay (sli9/8);   noTone (2);}

    nob5 = analogRead (5); nob6 = analogRead(6); sli9 = analogRead(9);  rds0 = random(nob5,nob6);
    val35 = digitalRead(35);    if (val35 == HIGH){tone(2,(rds0/4),sli9); tone(2,nob5+40,sli9);       }
    sli9 = analogRead(9);       if (val35 == HIGH){  delay (sli9/8);   noTone (2);}

    nob5 = analogRead (5); nob6 = analogRead(6); sli9 = analogRead(9);  rds0 = random(nob5,nob6);
    val38 = digitalRead(38);    if (val38 == HIGH){tone(2,nob6+35,sli9);  tone(2,(rds0/2),sli9);      }
    sli9 = analogRead(9);       if (val38 == HIGH){  delay (sli9/8);   noTone (2);}

     nob7 = analogRead(7); nob8 = analogRead(8); sli9 = analogRead(9);  rds0 = random(nob7,nob8);
    val41 = digitalRead(41);    if (val41 == HIGH){tone(2,nob7+60,sli9);  tone(2,(rds0/2),sli9);      }
    sli9 = analogRead(9);       if (val41 == HIGH){  delay (sli9/8);   noTone (2);}

    nob7 = analogRead(7); nob8 = analogRead(8); sli9 = analogRead(9);  rds0 = random(nob7,nob8);
    val44 = digitalRead(44);    if (val44 == HIGH){tone(2,nob8+70,sli9);  tone(2,(rds0/2),sli9);      }
    sli9 = analogRead(9);       if (val44 == HIGH){delay (sli9/8);   noTone (2);}

    nob1 = analogRead (1); nob2 = analogRead(2); sli9 = analogRead(9);  rds0 = random(nob1,nob2);
    val24 = digitalRead(24);    if (val24 == HIGH){tone(2,nob1+38,sli9);  tone(2,(rds0/2),sli9);      }
    sli9 = analogRead(9);       if (val24 == HIGH){ delay (sli9/8);   noTone (2);}

    nob1 = analogRead (1); nob2 = analogRead(2); sli9 = analogRead(9);  rds0 = random(nob1,nob2);
    val27 = digitalRead(27);    if (val27 == HIGH) {tone(2,nob2-30,sli9);  tone(2,(rds0/2),sli9);     }
    sli9 = analogRead(9);       if (val27 == HIGH) { delay (sli9/8);   noTone (2);}

    nob3 = analogRead (3); nob4 = analogRead(4); sli9 = analogRead(9);  rds0 = random(nob3,nob4);
    val30 = digitalRead(30);    if (val30 == HIGH){tone(2,400-nob3,sli9);   tone(2,(rds0/2),sli9);    }
    sli9 = analogRead(9);       if (val30 == HIGH){ delay (sli9/8);   noTone (2);}

    nob3 = analogRead (3); nob4 = analogRead(4); sli9 = analogRead(9);  rds0 = random(nob3,nob4);
    val33 = digitalRead(33);    if (val33 == HIGH){ tone(2,nob4+10,sli9);   tone(2,(rds0/2),sli9);    }
    sli9 = analogRead(9);       if (val33 == HIGH){ delay (sli9/8);   noTone (2);}

    nob5 = analogRead (5); nob6 = analogRead(6); sli9 = analogRead(9);  rds0 = random(nob5,nob6);
    val36 = digitalRead(36);    if (val36 == HIGH) {tone(2,nob5+38,sli9);  tone(2,(rds0/4),sli9);     }
    sli9 = analogRead(9);       if (val36 == HIGH) { delay (sli9/8);   noTone (2);}

   nob5 = analogRead (5); nob6 = analogRead(6); sli9 = analogRead(9);  rds0 = random(nob5,nob6);
    val39 = digitalRead(39);    if (val39 == HIGH){tone(2,nob6+30,sli9);   tone(2,(rds0/2),sli9);     }
    sli9 = analogRead(9);       if (val39 == HIGH){ delay (sli9/8);   noTone (2);}

     nob7 = analogRead(7); nob8 = analogRead(8); sli9 = analogRead(9);  rds0 = random(nob7,nob8);
    val42 = digitalRead(42);    if (val42 == HIGH) {tone(2,nob7-40,sli9);  tone(2,(rds0/2),sli9);     }
    sli9 = analogRead(9);       if (val42 == HIGH) { delay (sli9/8);   noTone (2);}

     nob7 = analogRead(7); nob8 = analogRead(8); sli9 = analogRead(9);  rds0 = random(nob7,nob8);
    val45 = digitalRead(45);    if (val45 == HIGH) {tone(2,nob8-50,sli9);  tone(2,(rds0/2),sli9);     }
    sli9 = analogRead(9);       if (val45 == HIGH) { delay (sli9/8);  noTone (2);}
    val49 = digitalRead(49);        if (val49 == HIGH)
    rot46 = digitalRead(46);    
     val22 = digitalRead(22);    if ((val22 == HIGH) && (rot46 == HIGH))   {    tone(2,nob1+85,(sli9/4));    }
     val23 = digitalRead(23);    if ((val23 == HIGH) && (rot46 == HIGH))   {    tone(2,nob1+60,(sli9/4));    }
     val24 = digitalRead(24);    if ((val24 == HIGH) && (rot46 == HIGH))   {    tone(2,nob1+35,(sli9/4));    }
     val25 = digitalRead(25);    if ((val25 == HIGH) && (rot46 == HIGH))   {    tone(2,nob2+100,(sli9/4));   }
     val26 = digitalRead(26);    if ((val26 == HIGH) && (rot46 == HIGH))   {    tone(2,nob2+70,(sli9/4));    }
     val27 = digitalRead(27);    if ((val27 == HIGH) && (rot46 == HIGH))   {    tone(2,nob2+50,(sli9/4));    }  
    rot48 = digitalRead(48);    
     val28 = digitalRead(28);    if ((val28 == HIGH) && (rot48 == HIGH))   {    tone(2,nob3+85,(sli9/4));    }
     val29 = digitalRead(29);    if ((val29 == HIGH) && (rot48 == HIGH))   {    tone(2,nob3+60,(sli9/4));    }
     val30 = digitalRead(30);    if ((val30 == HIGH) && (rot48 == HIGH))   {    tone(2,nob3+35,(sli9/4));    }
     val31 = digitalRead(31);    if ((val31 == HIGH) && (rot48 == HIGH))   {    tone(2,nob4+100,(sli9/4));   }
     val32 = digitalRead(32);    if ((val32 == HIGH) && (rot48 == HIGH))   {    tone(2,nob4+70,(sli9/4));    }
     val33 = digitalRead(33);    if ((val33 == HIGH) && (rot48 == HIGH))   {    tone(2,nob4+50,(sli9/4));    }
    rot50 = digitalRead(50);      
     val34 = digitalRead(53);    if ((val34 == HIGH) && (rot50 == HIGH))   {    tone(2,nob5+85,(sli9/4));    }
     val35 = digitalRead(35);    if ((val35 == HIGH) && (rot50 == HIGH))   {    tone(2,nob5+60,(sli9/4));    }
     val36 = digitalRead(36);    if ((val36 == HIGH) && (rot50 == HIGH))   {    tone(2,nob5+35,(sli9/4));    }
     val37 = digitalRead(37);    if ((val37 == HIGH) && (rot50 == HIGH))   {    tone(2,nob6+100,(sli9/4));   }
     val38 = digitalRead(38);    if ((val38 == HIGH) && (rot50 == HIGH))   {    tone(2,nob6+70,(sli9/4));    }
     val39 = digitalRead(39);    if ((val39 == HIGH) && (rot50 == HIGH))   {    tone(2,nob6+50,(sli9/4));    }    
    rot52 = digitalRead(52);  
     val40 = digitalRead(40);    if ((val40 == HIGH) && (rot52 == HIGH))   {    tone(2,nob7+85,(sli9/4));    }
     val41 = digitalRead(41);    if ((val41 == HIGH) && (rot52 == HIGH))   {    tone(2,nob7+60,(sli9/4));    }
     val42 = digitalRead(42);    if ((val42 == HIGH) && (rot52 == HIGH))   {    tone(2,nob7+35,(sli9/4));    }
     val43 = digitalRead(43);    if ((val43 == HIGH) && (rot52 == HIGH))   {    tone(2,nob8+100,(sli9/4));   }
     val44 = digitalRead(44);    if ((val44 == HIGH) && (rot52 == HIGH))   {    tone(2,nob8+70,(sli9/4));    }
     val45 = digitalRead(45);    if ((val45 == HIGH) && (rot52 == HIGH))   {    tone(2,nob8+50,(sli9/4));    }  

Step 41: Big Wire Bundle Tidy Up.

more an art than a process, zipping wires in bundles when there on their way to similar destinations.

it was as i was doing this i swapped the rotor speed control and the fan speed control .added the power regulator.

a few wires needed unsoldering and resoldering to improve the routes . a few wires were shortened.

I lengthened some of the knobs with pencil and heatshrink , to make it less fiddly to use.

Step 42: Bug Innit

ONEsometimes pin 34 and 35 dont do anything unless another switch is active, dunno why.
edit, 35 seems ok , no joy with 34 have moved it to pin 53, replaced the resistor ,switch, and signal wire, must be code based???? any ideas== found it had a 5 pretending to be a 2. have documented the switch replacement.

TWOwith more code (when i get a better idea of timing) i i could make this into a step sequencer.
Edit making some progress with the sequencer code but switch 34 causes problems.done and fixed.

THREE i could add leds but i prefer the element of mystery.
(if i did i would apply the directly to the double pole switches to save power drain on the chip) i done it anyway.

FOUR switched the wires from the fan speed slider to the rotor speed knob, so all timing is done by one easy access slider or another.

FIVE added a slide fader , to use for tone of tempo depending on mode, (analog in 9)

SIX replace fanspeed pot, then refer to bug fix four

post circuit diagram, i wanted the rotor motor to operate better at its lower speeds, so i added a 16v capacitor over the motor contacts.
i added a parallel resistor to the status leds ,to make them a little brighter, i hope i dont hurt the processor.

Microcontroller Contest

Finalist in the
Microcontroller Contest