DIY Motorized Camera Sliding Project ON Arduino

 Hello, Dejan here from WVS In this article we will learn how to make a motorized camera slider with panand tilt head. This project is 100 % DIY, built with cheap materialslike MDF and plywood and controlled using Arduino, three stepper motors, somebuttons and a joystick attached on a custom-designed PCB. Despite this, the endresult is quite impressive with super smooth camera moves enabling us to getprofessional-looking cinematic shots. 




Using the controller we can eithermanually move the camera around or we can set start and end points and thecamera will automatically move from one to the other position. Also using thesupporting arm we can mount the slider even on a smaller tripod, at any angle wewant and still get a stable movements. To begin with, I designed the slider using a3D modeling software. You can find download and get all dimensions fromthis 3D model on the website article, the link is in the description of this video.So I started with making the slider rails for which I used 22 millimeterthick copper pipe. I decided to make the slider 1 metre long so I cut twopieces to 1 meter of length. 





Copper pipes can easily oxidized so therefore we needto polish them with a metal polish. In my case, I didn't have one so I used thetoothpaste for that purpose. This wasn't a perfect solution but still I couldnotice a difference and got the pipes a bit cleaner. Then I moved on with makingthe wooden base on which the two pipes will be attached and also it will servefor mounting the slider onto a tripod. Using a circular saw I cut two pieces of21 millimeter thick plywood and glued them together in order to get a singlethicker piece. Then using a solid wood I made a replica of my tripod mountingplate and attached it to the plywood piece using awood glue and a screw. 



Now the slider base can be easily mounted on a tripod.I will mount the slider rails to the base using 8 millimetres threaded rod so Imade two holes in the wooden base and inserted the 138 millimetres long rodswhich had previously cut them to size. Next I head to drill 8 millimetres holesin the pipes which can actually be a little tricky. For that purpose I made asimple jig where I raised the pencil to a height of 11 millimeters or that's halfof the pipe diameter. Then I secured the pipe on a flat surface and using the jigmark the pipe from both sides. This enables us to get precisely alignedholes from both sides. So first I mark the drilling points with a sharp screwtip and then drill them progressively using 2, 4, 6 and 8 millimetres drill bit.After that I inserted the rails through the threaded rods and using some washersand nuts I secure them to the slider base.


 In similar way, using a piece ofplywood and a threaded rod I've fixed the ends of the rails.Next is the a sliding platform. Again I used the circular saw for cutting the 8millimeter thick MDF boards to size according to the 3d model. I also madesome 8 millimetres holes for the threaded rods on which the bearing aregoing to be attached. For assembling the platform I use the wood glue and somescrews. Using a cordless drill first I made pilot holes, then made thecountersinks and screwed the 3 millimeter screws in place. 


Once thepanels were secured I continued with installing the bearing system. Thebearings that I'm using are 608Z with outer diameter of 22 millimetres. Twowashers in a nut between two bearings make enough distance between them thusenabling good contact with the 22 millimeter rails.In order to make the platform more secure when using the slider at an angle,in similar way, I inserted two more sets of bearings at the bottom side of theplatform. At the end the sliding platform turned out to work perfectly. Here we cannotice that now when moving the platform along the slider on my small, notheavy-duty tripod, the tripod head cannot hold the weight of the platform so I hadto make a supporting arm in order to stabilize the slider. So using two piecesof wood as some nuts and bolts I made a simple clamp which can be fastened toone of the tripod legs. The clamp has a bolt on which the supporting arm can befastened. Next I had to make a slot on the supporting arm in order to be ableto position the slider at a different angle.


I made the slot by simply drilling many six millimeters holes close to eachother and then using a rasp I made fine straight lines. This supporting systemended up working perfectly. I continued this build with adding legs tothe slider, in case I don't want to use a tripod. I made them out of 8millimeter MDF. Using a handsaw and rasp I easily got the desired shapeof the legs. Then using some glue and two nuts I secure them to the ends of theslider. The next stage is building the Pan and Tilt system which will be attachedon the top of the sliding platform. Using the circular saw I cut all needed pieceswith the measurements taken from the 3D model. I used few pieces of plywood formaking the hinge mechanism of the leveling platform for the camera whenthe slider is set at an angle, as well as some MDF boards on which I madeappropriate holes for the motor and the bearings for the pan system. I moved onwith installing the stepper motor and the timing belt for the sliding platform. Onone side of the platform I secured the stepper motor with a piece of MDF boardand some screws and bolts and on the other side of the slider I secured anidler pulley so now I can install the timing belt. Using two bolts and zip tiesI easily secure the timing belt to the sliding platform.


 With this step thesliding mechanism was completely done. I continued withmaking the upper parts of the pan and tilt system. According to the 3D model I madeall appropriate holes for the stepper motor and the bearings and glued andscrewed everything together. A friend of mine 3d printed two 80 tooth pulleys for me. Inthis way I got 5 times speed reduction relative to the 16 tooth pulley attached on thestepper motor. Now I needed to make a closed loop timing belt according to mysetup. So I measured how much length of belt I needed, cut it to size and thensimply glued it with CA glue and added a piece of tape on top of it. The CA glue does a great job with rubber, so the closed loop belt worked without aproblem. Next I started the final assembly of thepan and tilt system. 



First I secured the tilt motor using some bolts and thenadded the two bearings in place while securing them in the slots with someepoxy. Then I secured the tilt platform onto the pan platform using some 8millimetres bolts and at the same time I attached the 80 tooth pulley to it togetherwith the timing belt. Here I noticed that the belt was a bit loose but I added asmall bearing in the place where the stepper motor bolt goes to act as abelt tensioner. This worked out so now the belt had enough tension to workproperly. Next I secured the pan motor and added bearings to the top side ofthe leveling platform, as well as on the bottom side. 



Then I inserted a bolt through them, added a thrust bearing, the 80 tooth pulley and the timing belt and on top ofthem I added the previously assembled tilt head. Finally I secured it using abolt and that's it with this step the construction of the slider is completed.OK, so next comes the fun part or installing the electronics components.Here's the circuit diagram of this DIY camera slider project. So the three NEMA 17stepper motors are controlled via the three 4988 stepper drivers. For controlling theslider movement we use the potentiometerconnected to an analog input of the Arduino and for controlling the pan andtilt head we use a joystick module which actually consists of two potentiometers,so it is connected to two analog inputs. There's also another potentiometer usedfor setting the speed of the automatic movement from the IN and OUT positions.These IN and OUT positions are set with the help of a push button. 



This pushbutton has a pull-up resistor and it's connected to a digital pin of theArduino board. There's also a reset push button, a power switch and a powerjack, as well as the limit switch for the slider and two LEDs for indicating theIN and OUT status. For powering this project we can use voltages from 9 to 12V.Next according to the circuit diagram I designed a custom PCB in order to keep the electronics components organized.I did that using the EasyEDA free online circuit design software. The circuit hadquite a few connections so I used both the top and the bottom layer and managedto get functional and good-looking PCB. Once finished with this step I generatedthe Gerber file needed for manufacturing the PCB. Then I ordered the PCB from JLCPCBwhich is actually the sponsor of this video. Here we can simply upload theGerber file and once uploaded we can again review our PCB in the Gerberviewer. If everything is alright then we can goon select the properties that we want for our PCB and then we can order ourPCB at a reasonable price. Note that if it's your first order fromJLCPCB you can get up to 10 PCBs for only $2. Nevertheless, after several daysthe PCBs have arrived. The quality of the PCBs is great and I must admit that it'squite satisfying to have your own PCB design manufactured. OK, so next I movedon with assembling the electronics components. I started by soldering pinheaders to the PCB. 



This enables easier connecting and disconnecting ofcomponents when needed. I actually used pin headers for everything except forthe capacitors and resistors which I soldered directly on the PCB. Therefore Icontinued with soldering jumper wires to all electronics components. In this way Ican easily mount the components on the controller case and at the same timeconnect them to the PCB. As for the controller case I decided to make it outof 4 millimeter thick transparent acrylic because I wanted all electronicscomponents to be visible. Again, I used the circular saw to cut the panels forthe case to size. Then using a drill and Forster bitsI made the openings on the front panel for the buttons, the potentiometer, thepower switch and the joystick.



 After that using a 5 minute epoxy I assembled thecase and as for the front panel I inserted and glued two bolts throughwhich the front panel can be inserted and secured using some nuts on top of it.Finally, I started assembling the electronics by inserting the Arduinoboard and the three 4988 stepper drivers onto the PCB. Then I continued withinserting and securing the buttons and the other components on the front panel.Once I had them secured I connected the components to the appropriate pinheaders on the PCB. On the side panel of the case I added the power jack and theninserted the PCB into the case. On the same side panel there's also a holethrough which put jumper wires for connecting thedrivers to the stepper motors, as well as for connecting the limit switch which Iplaced it at the end of the slider. Using some heat shrink tubing I organized thejumper wires coming out of the controller case and finally what wasleft to do is to connect the controller to the three stepper motors and thelimit switch. As for powering the slider I used three 3.7 Li-ion batteries connected in series producing around 11 volts. And that's it, the slideris done and it works perfectly. Now what's left in this video is to take alook at the Arduino code and explain how the program works. 



The program is basedon the AccelStepper library by Mike McCauley. This is an incredible librarywhich enables easy control of multiple stepper motors at the same time. So oncewe include this library and the Multistepper library which is part ofit, we need to define all Arduino pins that going to be used, define theinstances for the steppers as well as some variables needed for the programbelow. In the setup section we need to set the initial speed values for thesteppers, define some pin modes as well as add the three steppers to the multistepper control instance called "StepperControl". Using the while loops we movethe slider to the initial position or it moves until it presses the limit switchand then it moves back 200 steps in order to release the limit switch.In the loop section we'll start by checking whether the slider has reached the limitpositions or that's the limit switch or 80 centimeters on the other side. With thenext if statement we increase the pan and tilt speeds with each push of thejoystick switch.



 Then we check whether we have pushed the Set button which is usedfor setting the IN and OUT positions. With the first push of the button westore them IN positions of all three stepper motors and also light up the IN LED.In the same way, with the second push of the button we store the OUT positionsand light up the OUT LED. Then with the next push of the button we read thevalue of the speed potentiometer which is used for setting the maximum speed ofthe motors. 



Also we put the IN positions into the "gotoposition" array which is used in the moveTo() function which calculates therequired speeds for all stepper motors separately. Then using the runSpeedToPposition()  function the slider automatically moves to the IN position.In exactly the same way, in case number 3 or with another push of the button wemove the slider to the OUT position. In case we hold the button pushed forlonger than half a second the fourth case statement will beexecuted which actually resets the IN and OUT positions so we can set new ones.Next is the joystick pan and tilt control. The analog values we are gettingfrom the joystick is from 0 to 1024 or when it rests in the middle the value isaround 500. So if we move the joystick to the left and the analog value is greaterthan 600 we will set the speed of the particular motor to positive andopposite if we move the joystick to the right we will set the speed of the motorto negative which means it will rotate the opposite way. In case the joystickstays in the middle the speed is set to zero. This method is used for both axisof the joystick as well as the slider potentiometer. Aactually in the case ofthe slider potentiometer we use its analog value to also increase the speedof the motor as we further turn the potentiometer.



Lastly, we call the run speed functions for each of the three stepper motors andthat executes the above commands or rotates the motor appropriately. So thatwould be all for this video, I hope you enjoyed it and learn something new. Don'tforget to subscribe and for more tutorials and projects visit HowToMechatroncis.com