Showing posts with label Arduino. Show all posts
Showing posts with label Arduino. Show all posts

Tuesday, February 5, 2019

Gizmo Arpeggiator etc

I recently aquired a Yamaha DX7 that needed a tiny bit of maint to bring back to working order...It cost me $1 to fix.   I got really lucky with a really nice keyboard. (the backup battery powers all the ROMS...you can replace it with a holder and coin cell battery)

So I am fiddling around with voices (or patches or specifically Sysex files).   But I am not getting enough...

Randomly I see a YouTube video about Arpeggiators...and specifically DX7 Arpeggiators.

BTW, I am not a pro musician, and I do not understand the math behind this...

So I start searching for an Arpeggiator.  I stumble upon a device that tickles my hardware hacker cockles... Gizmo.

"Gizmo is the codename for an open source MIDI utility device which targets the Arduino Uno or Mega."

Gizmo was done (as far as I can tell) as a music theory thesis.   The documentation is the thesis, so it is a bit hard to wade through...but it is all there.

It is an Arduino, with some code and a MIDI hat on top.   The code utilizes the MIDI hat switches and rheostats to control the software.






The code seems correct..but it is very challenging to wade through, so I am only going to demo the Arpeggiator function.

(I am using a Mega and the MIDI hat)

The short version is the software utilizes the midi functions of the keyboard to manipulate other keys...giving a more complex sound than would normally be generated.

So in my case (DX7), the MIDI-OUT from the keyboard goes into the MIDI-IN on the MIDI shield, and likewise the MIDI-OUT from the shield, goes to the MIDI-IN of the keyboard. (it seems to be a Yamaha thing...my MIDI USB card is wired up the same way.)

I followed the instructions...but I kept having a compiling error...I fought it for days, then realized that I had two temp files that were fouling up the process.

(wire.cpp and wire.h)

Specifically, the instructions to run the code require two edits to standard  wires files.   My solution was to search for those two files on my computer and delete the ones that weren't  the primary files.  (It will make sense when you follow the instructions).

Anyway, this is the demo...not sure why the video was suddenly so dark...but at least the audio was ok...you will notice first I do the audio without the Arpeggiator running, then with it running.


Premier Pro CC jog/shuttle dial

I (for fun not profit) do video editing on Adobe Premier Pro.   It is a very powerful program...and I am terrible at keyboard shortcuts, so I mouse everything.

One important part of editing video is finding where you want to start and end a clip, then copy/cut and paste it somewhere.

The cut and paste of PP is pretty straight forward, a chop then drag and drop.

The finding the start/end is the hard part.  And it is a pain with the mouse.   I had a Griffin Powermate Jog shuttle dial that plugs in to USB and you can program it to simulate key presses.

Unfortunately they softare stopped being supported with WinXP, I could run it in Win7 but it would occasionally cause the computer to crash, and completely died by the time Win10 came out...so it was a USB powered paperweight.

BTW it was not recognized natively by any version of windows, it REQUIRED it's software to be running.

So for the last few years I have done without a jog shuttle dial, and continuously scoured the internets for a solution, there are a couple of $1000 solutions...and a $99 one, but the $99 dollar one does not have the ergonomics I wanted...it was too big...about 3 times the size of my Powermate.

Just a couple of weeks ago I was again looking for the J/S and found this article...I was sold, I order parts and soldered them up...then I realized that the parts looked like they might just fit inside my old unused dead Powermate.

So I undid my soldering and got to fitting.




The rotary encoder was a loose fit at the top, but that was fixed with a rubber o-ring.   It  was also a bit long to be centered, but I was able to trim off some of the rotary encoder board so it would fit.

The Arduino Leonardo board was just slightly to big for the spot I put it, however I was able to use a Dremel to cut a bit off the metal Powermate and it tucked right in.


 I also needed to remove the micro USB port, and I direct soldered the original PM USB cord.






In fact the install looks almost identical to the original PC board that was in it.

So with hardware done, I did the normal Arduino stuff to load the authors code into the Arduino, fired up PP and the new J/S worked right away.  

The Arduino program simulates keypresses, so you have to choose which code to install.  

I used the "PremierProDialDIY_LEFT_RIGHT_SPACE.ino" file...the space button in PP is the playback start stop...push down on the rotary encoder to activate that.

Another choice is "...LEFT_RIGHT_CTR_k..." in that case CTR_k is the hotkey to cut...I am afraid I would make accidental cuts.

The author has a new software that cycles between the Lightroom setup and the PP setup, software for the Sony Vegas hotkey...I am only using it with PP.

BTW after looking at the original Powermate pictures...I realize I removed the bottom at some point to try and fix it...I now need to find that piece...

Tuesday, November 8, 2016

Arduino for dummies (Halloween monster project)-updated...Finished!

OK, project finished...video is first...after that original article on the project.  Worked great, scared kids...but everyone loved it!






---------------Original Article------------------------------------------------------

Ok, this is not a class on how to Arduino...this is a dummy (me) using an Arduino.

For the record...I am not uneducated about computers and programming...however, I know nothing about the Arduino...

I do know a bit about circuits.  I did learn Basic, Pascal, and Fortran77 in college.   I haven't programmed anything more complex than an Excel table lookup since college.  (and if you know how long it has been since colleges taught Fortran77...)  (The computer lab we had used one of these... Burroughs B6700)

I was always curious about the Arduino and the other small computers...but you have to have a need before you can motivate yourself to learn...well me anyway.

Good links

Circuits.io
arduino.cc
diyhacking.com
adafruit.com

Here was the 'need'.  We have a couple of 6' tall animatronic monster Halloween decorations.  They have some built in sounds and movements.   They can be triggered by a noise, or a button on the base.



It takes a sharp clap sound to activate the noise trigger...but I wanted something more controllable...and more automated.  For a few years I simply had about 20' of wire from the monster tapped into the switch in the base, and the other end was bare wires...I couldn't be bothered to solder a button in (5 year proof of concept test...)

I finally decided that I wanted the monster to be motion activated, as well as having the button trigger if necessary.   The problem with the button trigger is if you trigger it while it is doing its thing, the event will stop.   Some events are only 15 sec long or so, but one is 65 seconds (It sings and dances to Monster Mash)...I don't want to accidentally cut out the event.

So here is where the Arduino comes in.  I was sure I could create some trigger inputs, a relay output, and a self timer.




Here is the display when triggered.





Here is the display when timer is done.





Here is the circuit as viewed on circuits.io   The resistors connected to the LCD and the LED are 220ohm   The one connected to the pushbutton is a 10k, the potentiometer is 10k.  I put 9v into the Arduino and use the 5v from the Arduino.  The PIR (infrared motion detector) that I bought from Adafruit has a different pinout...but the Data goes to pin 6 and the other two pins are power.





And here is the code in all its glory...if you paste this into circuits.io, and wire up the circuit as shown, it will work.  (note, the upper left power leads come from a 9V battery...on the actual Arduino I have it plugged into the power jack)   (could the code be written better...duh) (oh, and this code works, but there are some edits I have since made to make the display look better...)  (BTW the screenshot of the circuit shows an additional switch to continuously activate the trigger...If I implement this in the hardware, then at the end of the timer, it will automatically start again.)


// include the library code
#include

// initalize the library with the numbers of the interface pins
LiquidCrystal lcd(12,11,5,4,3,2);

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int relay = 8;
int button = 7; // switch is on pin2
int buttonValue = 0; //switch defaults to 0 or LOW
int inputPin = 6;   // choose the input pin (for PIR sensor)
int pirState = LOW;  // we start, assuming no motion detecte
int val = 0;         // variable for reading the pin status
  
int runTimer = 1;
int runFor = 3; // time in seconds
int data = 0;

// the setup routine runs once when you press reset:
void setup() {
  // set up the LCDs colums and rows
  lcd.begin(16,2);
  //print message to LCD
  lcd.print("It's Alive!");

  // initialize the digital pin as an output.
  pinMode(relay, OUTPUT);
  pinMode(button, INPUT);
  pinMode(inputPin, INPUT);     // declare sensor as input
  
  
}

// the loop routine runs over and over again forever:
void loop(){
  //read the value of the button
  buttonValue = digitalRead(button);
  
  // if switch is HIGH - pushed down- change the lights
  if (buttonValue==HIGH){
    
    //changeLights();
    activateMonster();
    
       
    // coundown timer 
    if(runTimer == 1){ 
          lcd.clear();
          lcd.print("TIMER=");
          //Start timer
          timer(); 
       } else {
       }
       runTimer = 0;
       lcd.noDisplay();
       delay(250);
       for(int duration = 0; duration < 100; duration ++){
       } 
       lcd.display();
       delay(250);
       lcd.clear();
       lcd.print("Ready");
       runTimer = 1;
    } // end of coundown timer
  
  // now check PIR
   val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    
    if (pirState == LOW) {
      // we have just turned on
       lcd.setCursor(0, 1);
      lcd.print("Motion detected!");
       lcd.setCursor(0, 0);
      // We only want to print on the output change, not state
      pirState = HIGH;
                         activateMonster();
      // coundown timer 
    if(runTimer == 1){ 
         // lcd.clear();
          lcd.print("TIMER=");
          //Start timer
          timer(); 
       } else {
       }
       runTimer = 0;
       lcd.noDisplay();
       delay(250);
       for(int duration = 0; duration < 100; duration ++){
       } 
       lcd.display();
       delay(250);
       lcd.clear();
       lcd.print("Ready");
       runTimer = 1;
    } // end of coundown timer
      
    
  } else {
    
    if (pirState == HIGH){
      // we have just turned of
       lcd.setCursor(0, 1);
      lcd.print("Motion ended!");
       lcd.setCursor(0, 0);
      // We only want to print on the output change, not state
      pirState = LOW;
    }
  }         
 }  // end check switch loop

    //timer funtion
    void timer() {
       for(int timer = runFor;timer > 0; --timer){
       if(timer >= 10) {
          lcd.setCursor(6,0); 
       } else {   
          lcd.setCursor(6,0);
          lcd.print("0");
          lcd.setCursor(7,0);
       }
       lcd.print(timer);
       lcd.print(" SEC");
       delay(1000);
       lcd.setCursor(0,0);
       
    }  //end of void timer 
}  // end void loop


void activateMonster(){
  // turn relay on for 0.25 sec 
  digitalWrite(relay,HIGH);
  lcd.clear();
  lcd.print("FIRE!");
  delay(250);
  digitalWrite(relay,LOW);
}  // end of void activatemonster