Introduction: MICRO MIDI STEPPER TouchOSC TIMELAPSE DOLLY
This Instructable will be about building a timelapse dolly thats "programable" via MIDI protocol.
It will cover the following steps:
- Building the dolly hardware
- Using the 28BYJ-48 stepper
- Building the MIDI interface
- Programming the Arduino
- Using the Touch OSC Editor
For the dolly you will need:
- 2x 28BYJ-48 steppers like those: https://www.adafruit.com/products/858
- a PCB for the chassis around 10x10 cm
- 3mm and 8mm drills
- a jigsaw
- a few M3 bolts nuts and shims
- 2x M8 bolts, 2xM8 shims and 2xM8 nuts
- 4x skateboard bearings
For the arduino control unit you will need:
- Cables obviously, i used a flat cable with 14 lines to connect to the dolly.
- Four lines per stepper and two lines for power
- An Arduino obviously. I used a micro, but any Arduino will do the job.
For the MIDI interface please go to another Instructable i made:
Step 1: BUILDING THE DOLLY HARDWARE
As you can see on the photos, the dolly is made from two PCBs that form the two sides, connected by two M8 bolts that function as axles for the free spinning wheels.
One of the steppers represents the third (powered) wheel.
On the photos there is a beltwheel mounted to it, but you can also use a rubberized wheel with more traction to use it without the belt like on the servo powered microdolly i made earlier: https://www.instructables.com/id/MICRO-ARDUINO-GOP...
I used the 3mm drill for all holes except the axles.
I will add a drawing where you can count the holes in the PCB to get the dimensions.
The drivers of the two steppers are mounted with M3 bolts too, as you can see on the photo from above, you could also use longer bolts for the drivers and use the same on both.
I cut the cables that connect the stepper with the driver, shortend them and soldered them directly to the rear side of the drivers.
Both power lines of the stepper driver boards are soldered to two respective strips of the chassis PCB.
As you can see on the photos, there is a third cable soldered to to that area, i plan to use it for a camera trigger on a later point.
Step 2: USING THE 28BYJ-48 STEPPER
The 28BYJ-48 is a very small and very inexpensive (bought mine for 4€/piece on amazon) stepper motors, that come with a small (around 1"x1") driver board.
They are unipolar steppers, which are not that common nowadays, but can be converted to bipolar steppers.
You would need a different driver if you would convert them, so i didn't do it.
They use 5V and i power them directyl from the 5V pin of my Arduino micro, which makes it a very small package.
From the 5 motors i ordered, two got damaged gears which made them unusable.
Thats a payoff to the price, but still.
One important thing with these steppers is, that the power-lines to the motor are not in the correct order.
It took me an afternoon to find that out, no idea why no one mentions that.
Later on in the script you will see its easy fixable, by defining the pins in a different order.
Another thing to mention is, that the motor has 64 steps per revolution, plus has a gearbox attached that has 1/64 ratio, which makes the whole setup a 4096 steps/rev stepper.
Step 3: BUILDING THE MIDI INTERFACE
As i said earlier, for the MIDI interface, please go to another Instructable i made earlier:
Step 4: SETTING UP THE ARDUINO
The Setup Arduino-wise is pretty straight forward.
- Four pins for motor A
- Four pins for motor B
- The Rx pin as MIDI in
- 5V/GND pins as power for the motor drivers
You can either use a development board and short patch wires, or hardwire it on a shield.
I made a small doublesided stripboard PCB and soldered the micro on that board.
After that i used a dual row connector to get all the micros pins out and also can use patch wires like on the UNO.
On my setup i use the pins as following:
- Motor A :
- PIN 9
- PIN 10
- PIN 11
- PIN 12
- PIN 5
- PIN 6
- PIN 7
- PIN 8
Step 5: PROGRAMMING THE ARDUINO
For the Arduino Script, make sure you got the following libraries:
Before looking at the code, whats the point of the script?
It uses a technique called MIDI callbacks. There are documented examples that come with the library, in short words, a midi callback means that in the void loop() there is only this function to look at the Rx PIN and see if there is some kind of MIDI information coming in. Nothing more.
That makes the script as low latency as possible, because there is no other stuff in the void loop() that take processing power/time.
IF there is a midi message coming in, it calls the midi handler to identify the message.
In our script we are looking for MIDI #CC messages on MIDI channel 1 and #CC on number 20 and 21.
A MIDI#CC message can be a value between 0-127, and we use number 20 for turning and number 21 for driving the dolly.
I can't screenshot the whole script, and when pasting it in the text it doesn't show me formated code, so i will screenshot them in tiles. Just watch the numbers on the left side to fit them back together.
- Line 1 -24
In this part i define the motor outs and a counter per motor, also both libraries get included, and the Steppers defined. 4096 steps is one revolution.
Be careful on the motor PINS, instead of 1_2_3_4 it's PINOUT system is: 1_3_2_4
So the pins in our script are 9_11_10_12 and 5_7_6_8.
- LINE 24 - 80
As we are using midi callbacks, this part is where the stuff goes in that you want to do if a certain MIDI input gets detected.
In line 28 it looks if the incoming MIDI message is sent on MIDI cannel 1
In line 30 it looks if the MIDI #CC number is 20, and if its on #CC20 it turns the motor for 20 STEPS depending on if its higher or lower then the counter.
In line 52 it does the same for MIDI #CC21.
- LINE 81 - 116
The last part is the void setup() and void loop()
We set the AmotA etc pins to outputs, and set the Speed of the steppers.
As is mentioned earlier the void loop() only consists of the MIDI.read().
I added a PIN called "pin" on PIN 13 (LED pin) to see if MIDI messages are coming in, but you do not need that for it to run.
Step 6: USING THE TOUCH OSC EDITOR
First of all you have to download and install the free editor from : http://hexler.net
I added a few screenshots, three of them represent my current plan of an interface, with adding stepsize etc.
One of the screenshots is from the touchOSC editor, on the left side you can see the values for a rotary control on MIDI channel 1 and MIDI #CC 20.
I added the touch OSC file to the Instructable.
Last things last:
Why MIDI you ask ?
That's where the last screenshot gets on the stage, and its called MIDI sequencer.
The screenshot is made in Apples LogicX, but can be setup in any DAW thats capable of MIDI.
Also you can play with a speed as low as 5bpm.
So any DAW except protools :)
You can see its also in #CC20 and #CC21.
Last but not least, there is a video of the dolly in a testride : http://youtu.be/fUlXWdZDtRo