motorized camera controller: controling the timelaps percision of a slit-scan camera

Step 1: motor control
- DC motor
- H-bridge
- Control direction, but not speed
- Easy binary switch to control direction
- Allegro motor controller
- Control speed and direction, but unable to control precise position
- Requires PWM, or HPWM to control direction and speed
- Stepper motor
- H-bridge
- 4-wire stepper motor
- Precise position control
- Required motor-specific combination of binary switches to control direction and position
- Motor can move only as fast as PIC can run thru stepping positions
- 5ms pause is the shortest time allowed between steps, this creates continuous motion
- <5ms pause between steps is too fast, motor hums, but remains stationary
- >5ms pause between steps allows for slower rotation of stepper motor, but motion is choppy.
- Darling transistor array
- 6-wire stepper motor
- Thankfully the transistor array works just like the h-bridge, in some ways easier.
- Conclusion
- DC motor with an Allegro motor control was able to give me the control of speed direction, but not precise positioning
- Stepper motor with a Darling transistor array gave me precise positioning and direction control, but I am not sure I can get the speed I want
Step 2: serial control of motors
- Sending a serial message from Processing to the PIC

- Attempt to control position and speed of stepper motor and DC motor from Processing by sending serial bytes to PIC
- Receiving serial message from Processing on the PIC
- SERIN
- Using SERIN I was able to receive serial data from Processing and control the direction and speed of DC motor or position of stepper motor
- I found I needed to use interrupts when using SERIN so that the PIC would not wait for an incoming serial byte each main loop, but instead grab the incoming serial byte only when a new one is available, and continue running if no new serial data was available
- HSERIN
- I found that unexpected results when PWMing a DC motor and using SERIN, the motor sometimes jumped or performed unexpectedly.
- Using HSERIN and HPWM in the same way as SERIN and PWM took advantage of the PIC’s hardware serial and pwm capabilities and the motor movement was much more reliable.
- Sending serial message from PIC to Processing
- I found I was unable to send serial data out of my Macintosh PowerBook and thus could not effectively control the motor controllers from the laptop.
- The quick workaround solution was instead of having the laptop control the PIC, have the PIC control the speed and direction of the motor and send serial data to the laptop to indicate position and speed.
- Conclusion
- Having the PIC as the master motor controller rather than the laptop seemed to be a workaround, however, it seems like a much more logical solution
- The motor controller can run autonomously without a larger computer required to make the motor move.
- The PIC can now easily control the speed of the motor with a potentiometer and send out it’s state to the remote laptop
Step 3: gears

- Speed vs. rotation angle
- I originally felt the stepper motor would be too slow to achieve the camera movement that I wanted.
- I could definitely get the speed from the DC motor I felt I needed, but without further investigation into 360 encoders, I would not be able to achieve the precise positioning I required.
- I re-evaluated by goal of controlling a camera precisely over a long period of time and realized was not speed I was after at all, but the ability to accurately position the camera.
- 1:1
- The stepper motor had a 1.8 degree step angle. That meant it would take 200 steps to rotate 360 degrees.
- If I connected the camera directly to the drive shaft each step would be far too large, I would need to shorten the size of each step
- 25:1
- I found some robotics gears at RadioShack with the following teeth counts: 12, 48, 60, 84
- Using a 12-tooth gear on the drive shaft connected to a 60-tooth gear I created a 5:1 gear ratio, meaning it would take 1000 steps of the stepper motor to rotate the 60 tooth gear 360 degrees.
- Adding an additional 12-tooth gear to the 60-tooth gear shaft and using another 60 tooth gear I was able to combine the two 5:1 gear ratios to achieve a 25:1 gear ratio. This made it so that it would take 5000 steps of the stepper motor to rotate the second 60-tooth gear 360 degrees.
- I hoped that this would give me a fine enough stepping angle to achieve very precise positioning of the camera.
- Conclusion
- I hope the 25:1 gear ratio is fine enough, if it is too fine I will just have to double up on the steps
- The stepper motor configuration seems like it shoul work out just fine
Step 4: gearbox




- Plexi, couplers, and threaded rod
- I would need to create a box that could be mounted on a tripod, hold the motor and gears in place, and allow for a camera to rotate uninhibited.
- I designed a plexi-glass three-level system that would hold the motor on the bottom, the gears and gear shafts in the middle, and the camera on top.
- Threaded rod would be used to hold the system together, separating the different parts using nuts and washers. Threaded rod would also be used for the gear shafts allowing easy repositioning of the gears if needed.
- Conclusion
- The simple threaded-rod solution seemed to add a layer of complexity because as the gears turned they would reposition themselves on the rods throwing themselves out of alignment. Also the vibrations of the motor would loosen the nuts holding the system together and throwing everything else out of alignment.
- Problems seemed to be reduced with the introduction of locking nuts that would not be loosened easily by torque and vibration
Step 5: test



- Initial results
- The 25:1 gear ratio produced the exact stepping angle I was looking for, 5000 steps in a circle, no more, no less!
- Pause between the steps controlled by a potentiometer (5ms to 1028ms).
- I would like to more accurately program the pause between steps
- 12 volts required to power motor and PIC, and short battery life of laptop kept us tethered to a power cable.
- Must find a portable power solution.
Step 6: power
- Battery pack
- I found 12volt battery packs used by photographers with simple cigarette outlets
- I accidentally shorted the first battery pack and learned a hard lesson
- Lead acid batteries must be stored with a full charge
- If the battery falls below a certain voltage they can never be recharged
- Shorting a battery will completely discharge it instantaneously never to be recharged again. (ouch!)
- Conclusion
- Treating my second battery pack much more carefully I found that my 12volt 10 amp battery pack powered the camera, motor controller, and laptop for hours with no problem.
Step 6: Timing control
- I hoped to use a dipswitch to accurately set the pause between steps in seconds. (0-255secs)
- Problems reading the binary input form the dipswitch lead to at simple work around that just added seconds to the step pause with each switch thrown.
- ex. switch 1 on == step pause + 1000ms, switch 2 on == step pause + 2000ms, switch 8 == step pause + 8000ms.
- Greatest step pause = 8+7+6+5+4+3+2+1seconds or 36seconds
- Conclusion
- If your first solution does not, there is always another solution that will.
Step 7: Refinement / To do
- More accurate measurements and laser cutting of gearbox parts should create a much more aligned gearbox
- Adding tilt to the camera mount
- A simple tilt arm should allow us to move on more than just the horizontal axis
- Possibly integrate a second motor to control tilt as well as pan
CODE
SCHEMATIC