Project: Retrofitted GoTo Dob – Pt2

Pt1 | Pt2 | Pt3

So if you recall from Pt1, we left things with me awaiting some parts to arrive to allow us to connect the two salvaged motors & encoders from our dead 2000-ish Celestron Nexstar 90GT GoTo Mount to a Raspberry Pi.

Well (thanks to the as-ever wonderfully cheap n’ speedy service from www.hobbytronics.co.uk) they arrived!

 

The Hardware…

img_0796

As you can see, we have the Pololu DRV8835-RPI kit, and the Pololu S7V7F5 kit, thus some self-assembly is required. Not shown here, but also necessary, is a 12v DC PSU… 1A seems to be enough at the moment, although later down the line this will all be tailed into the BattBox.

A little tip for soldering up Pi Hats… blue-tac is your friend when it comes to getting the PCB sitting square on the multi-pin connector:

Anyways, 5 minutes later we’ve got the multi-pin attached, the 3x screw-down terminals, and our 5v step-down converter, and we can plug it on to our Raspberry Pi (a model B+ in this case).

Back in Pt1 we broke down the 8 pin wiring loom of each motor/encoder/gearbox assembly… it turns out that the PURPLE wire is the motor’s negative terminal, and the GREY wire is the positive terminal.

You can extract the wires from the multipoint connector by pushing in the little rectangular slots with a pin whilst pulling on the related wire. Only extract the ones we need (purple & grey, first 2 from the left), otherwise we end up with exposed metal dangling about near contacts – simpler to leave the rest tucked away in the connector to avoid any moments of idiocy that might let the magic smoke out.

So on the blue screw down terminals from left to right in the next picture we have:

  1. Motor 2 [-]
  2. Motor 2 [+]
  3. Motor 1 [-]
  4. Motor 1 [+]
  5. 12v DC [-]
  6. 12v DC [+]

img_0805

Motor 1 hasn’t yet had it’s gearbox re-attached from Pt1. Motor 2 is the complete assembly.

That’s the hardware done… now we need to deal with the software to get some basic control up and running.

 

The Software…

We’ll go from scratch on this one. I’m going to use the latest Rasbian Jessie Lite installer… which we can download from the Raspberry Pi site.  Follow the installation instructions to transfer the image onto a blank SD card (I’m using an 8Gb one for now).

This takes 10 minutes, so now’s the perfect time for a crafty cig and a brew, in case you need to recover from the soldering experience!

Done? Good. Pop the card into your Raspberry Pi, connect up a network cable, monitor and keyboard, and plug in the 12v PSU you attached to the DRV8835 board.

WARNING

FROM THIS POINT ON, UNDER NO CIRCUMSTANCES SHOULD YOU PLUG IN A RASPBERRY PI PSU CONNECTED TO THE STANDARD PI USB POWER SOCKET AS WELL AS THE 12V PSU. DOING SO WILL DESTROY YOUR PI!

It’ll do some partition resizing and reboot, and eventually you’ll land at the login prompt. The default credentials for Raspbian Jessie are username: pi  with the password: raspberry

Now we need to install the driver and example software for the DRV8835

First, to download and install WiringPi-Python, run:

sudo apt-get install python-dev python-pip
sudo pip install wiringpi
sudo apt-get install git-core

 

Finally, to download and install the pololu_drv8835_rpi library, run:

git clone https://github.com/pololu/drv8835-motor-driver-rpi.git
cd drv8835-motor-driver-rpi
sudo python setup.py install

Running the example program

This library comes with an example program that drives each motor in both directions. To run the example, navigate to the drv8835-motor-driver-rpi directory (you should already be there) and run:

sudo python example.py

img_0806

TADA! If all has been successful, Motor 1 should spin up forwards then backwards, followed by Motor 2.

Our work here for Pt2 is done!

You could head over to the DRV8835 Driver GitHub Repo and have a look at the code in the example script to see how commands are issued… OR…

Continue on to Pt3: Making our Pi run headlessly, and remote-connecting over the network via SSH