Arduino time lapse – camera pan device

I own one of these small action cameras (SJcam SJ4000). I bought it because it’s small, and easy to take with you wherever you go. To make nice stable videos I mount it on a mini tripod. This got me thinking that it would be fun to have a little motor between the tripod and the camera to slowly pan the camera. That way I can make nice time lapse videos.

I happened to have a couple of 28byj48 stepper motors laying around, these little steppers motors have a gearbox and are 4096 steps for one rotation. They are pretty slow, so it’s ideal for this application. These motors are sold with a driver board that is basically an ULN2003 break out board.

Arduino time lapse – camera pan device

To control the motor I decided to use 2 potentiometers, one to set the speed/time and one to set the angle I want the motor to move. 3 buttons are used to start/stop and set different panning modes. I happened to have a small I2C oled display so I used that to display the settings. For a micro controller I used an ATmega328 with Arduino bootloader.

Programming the device caused me a bit of a headache. The Arduino stepper library is totally unsuited in an application where you want to do more then just drive a stepper motor. So I looked for other smarter stepper libraries. After a lot of searching I found the stepperlab3 library. This library uses a timer interrupt which doesn’t interfere with the other code for the display and buttons. It is written to control a stepper motor with a H-bridge like the L293/L298. I first started modifying the library so I could use it with the ULN2003 chip. Which is just a darlington transistor array. Since the library contained a lot of code that I didn’t need I decided it was better to just copy the code I needed from the library to my Arduino sketch. I also found an interesting bit of code, an internal voltmeter that lets you measure the supply voltage of the ATmega. That way I can show the battery status on the oled. After a bit of programming I ended up with this:

For More Details: Arduino time lapse – camera pan device

Leave a Comment

= 3 + 5

(Spamcheck Enabled)

Read previous post:
Grill & Deck-Door Monitor
Grill & Deck-Door Monitor

Story We use our barbecue grill and our deck frequently. After once leaving the grill on all night, I wanted...

Scroll to top