First demo of motor control for #RaspberryPi camera platform / @Raspberry_Pi

I decided this morning to shoot a video of my progress so far on the SpacePi, which is intended to be a motorised platform for taking astronomical photographs using the Raspberry Pi with the official camera module.

Here are the details again for those who didn’t catch them from the video.

Bill of materials:

The servos control the pan/tilt mechanism. They are powered by 4xAA batteries and controlled using 2 GPIO pins. They share a common ground connection (this is where the servo ground connection and the Pi ground connection are connected to each other). The camera module is held onto the pan/tilt by blu-tack (because I don’t have appropriate screws and nuts) and the whole thing is sat on a LEGO/Megablocks monstrosity.

The front end is a set of PHP pages. I’m using Nginx as a web server, but if you’re reproducing it, you don’t have to. The index page contains 4 controls: tilt up and down, pan left and right. These are watched using jQuery for ‘click events’. When the controls are clicked on, an Ajax request to one of two PHP pages is sent. These secondary pages use the PHP command shell_exec() to run a Python script that drives the PWM pulses going to the servos. The jQuery on the index page keeps track of the current position of the servos and resets them when the page is reloaded.

Eventually, I will be taking this rig outside to get clear pictures. Then, it will be powered by my USB battery pack.

Next steps

Make the UI a little more attractive (even if it’s just using arrow icons) and hook up the ‘take photograph’ functionality. I’ve already done the latter but I need to be sure that there is some kind of concurrency check as the camera doesn’t like it if you try and take two pictures at the same time.

4 comments for “First demo of motor control for #RaspberryPi camera platform / @Raspberry_Pi

  1. Hi Michael
    I’m thinking a couple of steppers might be worth testing out as well,as they might be more accurate than a servo. (but not as quick to get into position of course

    Simon

    • Hi Simon.
      Yeah, I was experimenting with steppers to start with – running little ones off the GPIO (no battery).
      I got them working, but I wasn’t sure how you mount things on them so looked for pan/tilt mechanisms and found that they were all servo-powered.

      Mike

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.