Go Down

Topic: Imperial March on a fast switching valve (Read 2753 times) previous topic - next topic

kerimil

I thought that there have been dozens or Imperial marches played by floppy drives or step motors so I might as well do something new...

The video >>
http://youtu.be/VSOXKtjtdbs


Here is that valve I used

It's a fast switching valve - namely Festo MHE3-MS1H-3/2G-QS-6.
Its switch on time is 2.3 ms and it switches off in 2.8ms - very very impressive piece of hardware and they are pretty pricey - luckily I got it for next to nothing.

The circuit is very simple - just a ULN2004A as a driver for the valve.

and here's the code (it's a slightly modified version of a sketch created by Carlton Shepherd)

 
Code: [Select]


    const int c = 261;
    const int d = 294;
    const int e = 329;
    const int f = 349;
    const int g = 391;
    const int gS = 415;
    const int a = 440;
    const int aS = 455;
    const int b = 466;
    const int cH = 523;
    const int cSH = 554;
    const int dH = 587;
    const int dSH = 622;
    const int eH = 659;
    const int fH = 698;
    const int fSH = 740;
    const int gH = 784;
    const int gSH = 830;
    const int aH = 880;
     
    const int buzzerPin = 12;
 
     
    int counter = 0;
     
    void setup()
    {
      //Setup pin modes
      pinMode(buzzerPin, OUTPUT);
      pinMode(ledPin1, OUTPUT);
      pinMode(ledPin2, OUTPUT);
    }
     
    void loop()
    {
     
      //Play first section
      firstSection();
     
      //Play second section
      secondSection();
     
      //Variant 1
      beep(f, 250); 
      beep(gS, 500); 
      beep(f, 350); 
      beep(a, 125);
      beep(cH, 500);
      beep(a, 375); 
      beep(cH, 125);
      beep(eH, 650);
     
      delay(500);
     
      //Repeat second section
      secondSection();
     
      //Variant 2
      beep(f, 250); 
      beep(gS, 500); 
      beep(f, 375); 
      beep(cH, 125);
      beep(a, 500); 
      beep(f, 375); 
      beep(cH, 125);
      beep(a, 650); 
     
      delay(650);
    }
     
    void beep(int note, int duration)
    {
      //Play tone on the valve
      tone(buzzerPin, note /4, duration);
     
   
     
      //Stop tone on buzzerPin
      noTone(buzzerPin);
     
      delay(50);
     
      //Increment counter
      counter++;
    }
     
    void firstSection()
    {
      beep(a, 500);
      beep(a, 500);   
      beep(a, 500);
      beep(f, 350);
      beep(cH, 150); 
      beep(a, 500);
      beep(f, 350);
      beep(cH, 150);
      beep(a, 650);
     
      delay(500);
     
      beep(eH, 500);
      beep(eH, 500);
      beep(eH, 500); 
      beep(fH, 350);
      beep(cH, 150);
      beep(gS, 500);
      beep(f, 350);
      beep(cH, 150);
      beep(a, 650);
     
      delay(500);
    }
     
    void secondSection()
    {
      beep(aH, 500);
      beep(a, 300);
      beep(a, 150);
      beep(aH, 500);
      beep(gSH, 325);
      beep(gH, 175);
      beep(fSH, 125);
      beep(fH, 125);   
      beep(fSH, 250);
     
      delay(325);
     
      beep(aS, 250);
      beep(dSH, 500);
      beep(dH, 325); 
      beep(cSH, 175); 
      beep(cH, 125); 
      beep(b, 125); 
      beep(cH, 250); 
     
      delay(350);
    }

pYro_65

Nice job, just went and had a read on those valves. I liked the ones marked as useful for 'fast sorting'.

kerimil

Yeah I've seen a video of a pneumatic sorting machine that used computer vision and air nozzles to blew off defective products from the conveyor belt - very very impressive


fungus


Its switch on time is 2.3 ms and it switches off in 2.8ms - very very impressive piece of hardware and they are pretty pricey - luckily I got it for next to nothing.


That's faster then my hard disk seek time, and I'm using a Velociraptor!  :smiley-surprise:
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Riva

Nice, how about placing valve high in the air and pumping water through it so it does a liquid pattern in tune to the music.

kerimil

actually I thought about using butane  :smiley-mr-green:


MarkT

Word of warning - physically connecting and disconnecting an inductive load like that
generates very high frequency high voltage transients in the contact arcing that can
trash the driver (even if it has protection). Power down before disconnecting
is the rule.
[ I won't respond to messages, use the forum please ]

Go Up