Software

This is a fairly basic run-through to get you up and running and also I havent spent much time on the s/w.

Firstly its useful to setup the camera to stream. There is more than one way to do this, but this should work, using v4l2rtspserver.

ssh into your pi.

First get the source code for v4l2rtspserver and build it.
Should only take a couple of minutes.


cd 
git clone https://github.com/mpromonet/v4l2rtspserver.git


sudo apt-get install liblivemedia-dev
sudo apt-get install liblog4cpp5-dev

cd v4l2rtspserver/

cmake . && make

sudo make install

Add the driver


sudo bash

cat << EOF >> /etc/modules
bcm2835-v4l2
EOF

exit

You can now either reboot or as a one off run (quicker)


sudo modprobe bcm2835-v4l2

The following command will now kick off the streaming.

v4l2rtspserver -F 10 -W 640 -H 360 -P 8555 /dev/video0 &

If you check through the logs that appear you should see a line like.

Play this stream using the URL "rtsp://192.168.1.87:8555/unicast"

Take a copy of this address.

Now on your main machine (on the same Wifi)

vlc &

If you havent got vlc then

sudo apt-get install vlc

When vlc opens go Media->Open network stream and type in the address rtsp://192.168.1.87:8555/unicast , or your version of it.

After a few seconds you should see your stream in the window.

Next some code to move the Pi.

cd
git clone https://github.com/piskyscan/StepperMotor.git

cd StepperMotor/BasicMovePython/

python basicmove.py

This runs a terminal where if you press the arrow keys the pi should move. You should see this on your stream. If it doesn’t check that you get a nice ripple of all the leds when you press an arrow key.

I originally thought of removing the leds, but they have quickly sorted problems about 3 times now. If your Pi isn’t moving, check the leds first! Normally problem is either loose connections or power wired the wrong way around.

Some C code to use from command line

To run from the command line I have written a simple C program.
This uses the pigpio library.
To build and test it enter the following.

cd 
git clone https://github.com/joan2937/pigpio/
cd pigpio/

make

sudo make install

sudo ./x_pigpio

Some of the tests are timing related and can fail occasionally.
Try running again to see if that fixes any issues.

Next we are going to make the executable.

cd
cd StepperMotor/BasicMove
gcc -Wall -pthread -o basicmove basicMove.c -lpigpio -lrt -lm

We can now test it.

sudo ./basicmove 1000 1000 100
sudo ./basicmove -1000 -1000 100

Basic move takes 2 or 3 parameters.
First two are x and y steps.
Third is steps per second. If you go too fast steppers will just stop.

I have found that up to 1000 steps per second works.
There should be (and I have only broadly tested this)
85.33 steps per degree of elevation and 45.51 steps per degree or rotation.

Some other useful commands are

raspivid -o myvid.h264 -t 180000

which records video for 180 seconds (parameter is milli-seconds).

and

raspistill -t 500 --thumb none --exposure auto --mode 1 -o mypic.jpg

Which take a picture after 0.5 seconds.