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

Saturday, July 14, 2012

PT785-S Pan and Tilt System + Arduino

I bought one of these a little while ago and finally got around to testing it with an arduino. This system isn't accurate enough for real-time repeatable motion control photography IMO. I'm planning on using it for capuring sphereical longitude/latitude HDRI's.

You can find the product here:
servocity.com/html/pt785-s_pan___tilt_system.html

Wednesday, December 7, 2011

Arduino Push Button ON/OFF Example


Someone posted a request for this in the comments. After a quick search I couldn't find a simple example on how to do this so here's one I made based on the Debounce example sketch in the Arduino IDE.

arduino codeDebouncePushButtonOnOff

/* 
 Debounce
 
 Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
 press), the output pin is toggled from LOW to HIGH or HIGH to LOW.  There's
 a minimum delay between toggles to debounce the circuit (i.e. to ignore
 noise).  
 
 The circuit:
 * LED attached from pin 13 to ground
 * pushbutton attached from pin 2 to +5V
 * 10K resistor attached from pin 2 to ground
 
 * Note: On most Arduino boards, there is already an LED on the board
 connected to pin 13, so you don't need any extra components for this example.
 
 
 created 21 November 2006
 by David A. Mellis
 modified 3 Jul 2009
 by Limor Fried
 
This example code is in the public domain.
 
 http://www.arduino.cc/en/Tutorial/Debounce
 */

// constants won't change. They're used here to 
// set pin numbers:
const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin

// Variables will change:
int ledState = HIGH;         // the current state of the output pin
int buttonState;             // the current reading from the input pin
int lastButtonState = LOW;   // the previous reading from the input pin

// the following variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long lastDebounceTime = 0;  // the last time the output pin was toggled
long debounceDelay = 50;    // the debounce time; increase if the output flickers

void setup() {
  pinMode(buttonPin, INPUT);
  pinMode(ledPin, OUTPUT);
    Serial.begin(9600);
}

void loop() {
  // read the state of the switch into a local variable:
  int reading = digitalRead(buttonPin);

 

  // check to see if you just pressed the button 
  // (i.e. the input went from LOW to HIGH),  and you've waited 
  // long enough since the last press to ignore any noise:  

  // If the switch changed, due to noise or pressing:
  if (reading != lastButtonState) {
    // reset the debouncing timer
    lastDebounceTime = millis();
    
   // this is all that's new to the code 
   // toggles the ledState variable each time the button is pressed 
      if (buttonState == HIGH) {
      ledState = !ledState;
      Serial.println(ledState);
    } 
  } 
  
  if ((millis() - lastDebounceTime) > debounceDelay) {
    // whatever the reading is at, it's been there for longer
    // than the debounce delay, so take it as the actual current state:
    buttonState = reading;
  }
  

  
  // set the LED using the state of the button:
  digitalWrite(ledPin, ledState);

  // save the reading.  Next time through the loop,
  // it'll be the lastButtonState:
  lastButtonState = reading;
}

Thursday, August 18, 2011

My First Animation Editor (With Bezier Curves)

I've been working on this on and off for a while now. Ever since I got Maya talking with the Arduino. I thought to myself, "wouldn't it be nice if there was a free app that wasn't bloated and designed just for animating parameters?" Well, I just hit my first milestone for this goal. Eventually I would like to add multi-segment Bezier Curves. Then I would like to have multiple channels of animation. It's all written in Processing so serial communication with the Arduino should be simple. The trickiest thing to get working was the lookup of the Y value on the curve based on where the Time Slider is. Many thanks to Ben Paschke for finding the function I needed in the Blender Source Code and helping me port it to Processing.

There is another Processing Tool out there called Timeline but it's heading in a different direction than I am and I wasn't a fan of it's mixed languages and non-realtime Y lookup function. Plus, I thought this would be a good challenge to set for myself considering the industry I am working in :)

Hotkeys:
Spacebar = Play/Pause
J = Play Forward
K = Play Backward
L = Pause
Left Arrow = Step Backward 1 Frame
Right Arrow = Step Forward 1 Frame 

Click and Drag to Position the Handles or Timeslider

Wednesday, July 13, 2011

Tonight's Hack Session!

You can read about it here! 

Friday, July 1, 2011

Arduino Timelapse Shield


Greetings Arduino and Timelapse Enthusiasts! Just thought I'd give you a sneak peak at what I've been working on of late. It's a Remote Shutter Proto Shield. I'm aiming to make this shield compatible with all major brands SLRs. Of course this is a very hard claim to make if I don't have access to all camera's for testing. I'm confident that it will work with Panasonic,Canon and Pentax SLRs at the very least. But as you can imagine I really need to do my homework on what's out there before I sell a product that claim this type of compatibility 

The shield will be compatible with the open moco timelapse engine as well as being a completely customizable with it's prototyping area. It's not a complicated circuit really. The most complex components are the opto-couplers which are basically just optical switches that safely trigger the focus and shutter on your camera. So I'm getting close to the manufacturing stages, I just have a few measurements to triple check before I send of the gerber files. This is quite a leap in complexity from the last PCB I designed. But I'm hopeful that it will work just as I designed it to when product is finally manufactured.

Monday, May 30, 2011

My First PCB Design (Part 2)


Well if you read my last post, you will know that I have been waiting for my first ever PCB design to arrive in the post. Well it finally came! exactly 10 working days from the time of order. Overall, I'd say the result looks pretty good! I haven't soldered one up yet. But when I do, I will do a video. The encoder fits perfectly, the only thing I might have done differently is give more space around the mount holes for extra strength. Please leave a comment if you would like to purchase one of these. They are designed to fit this rotary encoder from Spark Fun Electronics. If there is enough interest I will look into a simple way to sell and distribute online. Next stop, Arduino Shields!

If you want to make your own, check out the prototyping service at this link.

AVAILABLE FOR PURCHASE NOW! visit my ImMojo Store

Friday, March 25, 2011

Houdini Controlling Servos!

Who needs Maya when you have Houdini!

I've been wanting to do this for ages but not knowing houdini's api has blocked me. Thanks Alvin for this awesome video! If it works with houdini apprentice, I will be very excited!

Wednesday, October 20, 2010

My First Timelapse

Lucas next to some wild Sturt Desert Pea

My family and I have just returned from a well earned vacation at Leigh Creek. Leigh Creek is coal mining town with a rich history that goes back to the 1800's It's quite a remote town located in the center of South Australia. Beautiful landscapes, especially at the moment due to the drought breaking rainfall that we have had this year. So the place was alive. I will post a slide show soon. While we were there we would go out driving in the bush in the morning and then my pregnant Wife and 2 year old Son would come home for an afternoon sleep. This gave Dad a chance to go out and play with his toys! Timelapse that is... ;)


Here's some stills of the remote trigger I built based on a circuit I found on Instructables for the Lumix GH1.

 
I used the Open Moco Timelapse Engine v0.82 and Slim v0.12. The code can be downloaded from the Open Moco website. If you are interested in getting into timelapse like me. Here are some use useful links:

openmoco.org Open source timelapse software for use with Arduino and various other hardware platforms.
timescapes.org I great online community for all things related to timelapse, motion control and slow motion photography.
arduino.cc A non-threatening programmable micro-controller aimed and hobbyists and tinkerers.. like me!

Saturday, May 22, 2010

EasyDriver 4.2 Tutorial



Finally I had some time to do a tutorial on the Easydriver v4.2 board. The following example code is just for demonstrating the board's new functionality. It is was tested on a sparkfun stepper motor. You will notice in the code that each time the step mode changes, so to does the delay time between steps and the number of steps per revolution. The is not absolutely necessary but it helps you compare the differences between stepping modes.

Make sure you have the serial monitor open in the Arduino IDE when running this code. This will give you some feedback about the various modes of the board as they switch on an off.

Note: For real world use I would recommend hard-wiring the MS1 and MS2 pins to some switches to pull them high or low. This way you can free up some more pins on your Arduino.

For a tutorial on how to use the Easydriver v3.1 check out this post

QUESTIONS ARE WELCOME (but please keep it related to the example in this post ) 

///////////////////////////////////////////////////////////
// Stepper Motor skecth for use with the EasyDriver v4.2 //
///////////////////////////////////////////////////////////

// Dan Thompson 2010
//
// Use this code at your own risk.
//
// For all the product details visit http://www.schmalzhaus.com/EasyDriver/
// For the full tutorial visit http://danthompsonsblog.blogspot.com/


////// ED_v4  Step Mode Chart //////
//                                //
//   MS1 MS2 Resolution           //
//   L   L   Full step (2 phase)  //
//   H   L   Half step            //
//   L   H   Quarter step         //
//   H   H   Eighth step          //
//                                //
////////////////////////////////////

int DIR = 3;          // PIN  3 = DIR
int STEP = 2;        // PIN  2 = STEP
int MS1 = 13;        // PIN 13 = MS
int MS2 = 9;         // PIN  9 = MS2
int SLEEP = 12;      // PIN 12 = SLP


void setup() {
  Serial.begin(9600);     // open the serial connection at 9600bps
  pinMode(DIR, OUTPUT);   // set pin 3 to output
  pinMode(STEP, OUTPUT);  // set pin 2 to output
  pinMode(MS1, OUTPUT);   // set pin 13 to output
  pinMode(MS2, OUTPUT);   // set pin 9 to output
  pinMode(SLEEP, OUTPUT); // set pin 12 to output
}



void loop()
{
  int modeType = 1;                         // This number increases by multiple of 2 each through the while loop..
                                            // ..to identify our step mode type.                                            
  while (modeType<=8){                      // loops the following block of code 4 times before repeating .
    digitalWrite(DIR, LOW);                 // Set the direction change LOW to HIGH to go in opposite direction
    digitalWrite(MS1, MS1_MODE(modeType));  // Set state of MS1 based on the returned value from the MS1_MODE() switch statement.
    digitalWrite(MS2, MS2_MODE(modeType));  // Set state of MS2 based on the returned value from the MS2_MODE() switch statement.
    digitalWrite(SLEEP, HIGH);              // Set the Sleep mode to AWAKE.
    
    int i = 0;                              // Set the counter variable.     
    while(i<(modeType*200))                 // Iterate for 200, then 400, then 800, then 1600 steps. 
                                            // Then reset to 200 and start again.
    {
      digitalWrite(STEP, LOW);              // This LOW to HIGH change is what creates the..
      digitalWrite(STEP, HIGH);             // .."Rising Edge" so the easydriver knows to when to step.
      delayMicroseconds(1600/modeType);     // This delay time determines the speed of the stepper motor. 
                                            // Delay shortens from 1600 to 800 to 400 to 200 then resets  
                                                 
      i++;                      
    }                              
    modeType = modeType * 2;                // Multiply the current modeType value by 2 and make the result the new value for modeType.
                                            // This will make the modeType variable count 1,2,4,8 each time we pass though the while loop.
   
    delay(500);
  }
  digitalWrite(SLEEP, LOW);                 // switch off the power to stepper
  Serial.print("SLEEPING..");
  delay(1000);
  Serial.print("z");
  delay(1000);
  Serial.print("z");
  delay(1000);
  Serial.print("z");
  delay(1000);
  Serial.println("");
  digitalWrite(SLEEP, HIGH);
  Serial.println("AWAKE!!!");                // Switch on the power to stepper
  delay(1000);
}



int MS1_MODE(int MS1_StepMode){              // A function that returns a High or Low state number for MS1 pin
  switch(MS1_StepMode){                      // Switch statement for changing the MS1 pin state
                                             // Different input states allowed are 1,2,4 or 8
  case 1:
    MS1_StepMode = 0;
    Serial.println("Step Mode is Full...");
    break;
  case 2:
    MS1_StepMode = 1;
    Serial.println("Step Mode is Half...");
    break;
  case 4:
    MS1_StepMode = 0;
    Serial.println("Step Mode is Quarter...");
    break;
  case 8:
    MS1_StepMode = 1;
    Serial.println("Step Mode is Eighth...");
    break;
  }
  return MS1_StepMode;
}



int MS2_MODE(int MS2_StepMode){              // A function that returns a High or Low state number for MS2 pin
  switch(MS2_StepMode){                      // Switch statement for changing the MS2 pin state
                                             // Different input states allowed are 1,2,4 or 8
  case 1:
    MS2_StepMode = 0;
    break;
  case 2:
    MS2_StepMode = 0;
    break;
  case 4:
    MS2_StepMode = 1;
    break;
  case 8:
    MS2_StepMode = 1;
    break;
  }
  return MS2_StepMode;
}



Wednesday, April 7, 2010

RGB Colour Mixer


Well I couldn't make it to my local hacker space tonight, so I decided to "hack at home!" :)

This is a prototype of an RGB LED Light I'm designing for my 2 year old son at the moment. I thought I could work on the code design in processing while I am waiting for a new Arduino to arrive in the mail.

Tuesday, December 22, 2009

Open Moco Touchscreen Interface


I have started contributing to the OpenMoco project. It's basically a well thought out motion control engine and intervalometer that people can use to build their own motion control contraptions.

The first GUI is going to be based on the Touchshield Slide by liquidware. This is a very exciting time for us DIY moco enthusiasts.

The applet you see above is purely to test functionallity. There are already several people designing the look of GUI and I gotta say I like what I've seen so far. I will slowly add flashy buttons and sliders as the are discussed and agreed upon. If you want to contribute to the project I suggest you head on over to open moco forums and make yourself known!

You can check out the next iteration of the GUI here.

Saturday, November 14, 2009

Servo Tools For Maya Tutorials

Well it took a little longer than a few weeks. But finally I have the first three video tutorials ready for viewing! There is still more to come, but this should be enough to get you started.

PLEASE NOTE: If you have any questions about installation, I've created a thread on the creative crash forums. You can get to it from the Servo Tools For Maya download page . Just click on the forum tab.

Enjoy!



Wednesday, November 4, 2009

EasyDriver V4.2 is out!


Great News!

Brian Schmalz has released a new Easy Driver Board!

It has some great new features. The most notable one for me is the ability to access the chip's logic that can switch to micro, half and full step methods. It also now has pretty lights and a more usable trim pot.

I've just ordered three of these from sparkfun cause good things come in threes! Check out Brian's Easy Driver Site for all the details.

Thanks Brian for this brilliant piece of hardware!

Update! Check out my EasyDriver v4.2 Tutorial post.

Friday, October 16, 2009

Servo Tools For Maya Release v1.0.1


I have finally taken the plunge and released Servo Tools For Maya to the world!


Servo Tools For Maya is a Python Plugin that sends rotational values over USB the the Arduino Micro Controller. These values are then converted in to Pulse Width Modulation which is used to control multiple Hobby RC Servo Motors.

Applications for the plugin are only limited to your imagination. Some popular examples could be to drive complex animatronic puppetry or kinetic sculpture art installations.

Current Features Include:
- Control up to 4 Servos simultaneously. (see tutorials on how to add support for more)
- High Level GUI for building servoWrite node network.
- Ability to calibrate you servo's range and limits directly from Maya.
- Serial Connection over USB cable to hardware

Hardware Requirements:
- USB Cable
- Arduino Micro Controller
- At least 1 RC hobby servo

Software Requirements:
- The Scripts and Plugin available from this page
- Python (separate from the one that comes with Maya 8.5+)
- PySerial Python Module for Serial Communication
- Maya 8.5 or Higher (32-bit only)
- Latest Arduino Software

PLEASE NOTE:
I'm still prepping the Documentation in Video Form. So unless you are familiar with all of the above concepts, I would wait for the videos before you dive in. They should be ready in a week or two when I get back from holiday.

Saturday, August 8, 2009

Open Moco Intervalometer Tutorial

Shutterdrone has done it again with another great tutorial. If you are into DIY timelapse photography then you can't go past this one. It's part of a fast growing body of knowledge on the open moco website. What is open moco? It's not to be confused with open moko(open source mobile phone platform). Openmoco.org is a website dedicated to DIY motion control.

This tutorial is not only an introduction to Inervalometers, but also a step by step guide on how to build your own with a few simple components.

For the full tutorial and more moco goodness visit the openmoco.org.

Sunday, June 28, 2009

I made the top 20!

A friend of mine just notified me that I'm on the HacknMod top 40 Arduino Projects on the Web! I can scarcely believe it myself! I came in at number 20. Check out the link for loads of other cool projects!

The project I'm listed for has been on the shelf for a little while. Maybe it's time to dust it off and release it to the world!

Tuesday, May 26, 2009

Visualising Smoothstep Interpolation



Justin just posted this video in response to an earlier post I made on smoothstep interpolation. He is using the python module pygame to display the formula. Pretty cool stuff! Thanks for sharing Justin.

Saturday, April 25, 2009

Maya To Moco Sneak Peak


A sneak peak at a set of Maya Tools that can control servo and stepper motors. It uses the Arduino platform as a bridge between Maya and the Motors. I will be releasing the tools on the openMoco website soon.

Friday, April 24, 2009

openMoco Icons

click to enlarge

Just a quick update on some maya to moco related stuff. I'm very close to releasing something. I've been spending a bit of time on user interfaces of late. Here are some icons I've been working on. They start as 3D models in maya. Then I render them out in vector format for Adobe Illustrator.

Something tells me that I will have to go and "macify" them to make them more pretty. I'm a sucker for slick glossy graphics. But I always go full circle and make them simple again in the end :)

Saturday, April 11, 2009

Python + Arduino + Motor Shield + Stepper Motor (Part 1)


This is my first successful attempt at sending a number (higher than 255) from Python to Arduino using Serial Communication. Currently it sends 3 bytes per execution.

The 1st byte for packet identification, and the 2nd and 3rd byte makes up the Base10 number we are sending. I've used bit-wise operators to maximize the number I can construct from 2 bytes. Currently the maximum number I can send is 65535. The code can still be optimized, and currently it does not support negative numbers but hey, I'm taking it one step at a time (pardon the pun). FYI, this exercise is part of a much larger project. You can read about it Here

Edit: After several requests I have put a revised version of the code to make this work online.

Copy and Paste the Arduino Code into a text file and save as a .pde and upload it via the Arduino IDE. Copy and Paste the Python Code into a text file and save as motor.py

To run it in python, type:
import motor [Enter]
motor.position(1,1.8,360) [Enter]
motor.position(1,1.8,0) [Enter] 
This should make a 200 steps per rev motor turn 360degrees and then return to it's original position. The only thing that you may need to change is line 20 in the python code. It depends on what COM port you will be using.