Monday, December 16, 2013

Beaglebone Black and Astrophotography: Phase 2: Building astronomy software

Install astronomy software.
So, this is going to be based on the work by Anat Ruangrassamee, written up at www.cloudynights.com, and his iAstroHub project.  His project files can be obtained here: http://sourceforge.net/projects/iastrohub/

Open the README.txt and follow the "HARD WAY".  Some of the stuff we have already done.
Step 1-2: Skip.  Steps 3-4: I am not sure it is entirely necessary to give open access in sudo, but for now we will follow the instructions.  Steps 5-6: BTDT.  Step 7: Sure.  I use vi instead of nano, so I left that out.

Step 8: We need to shutdown apache in favor of nginx.
# update-rc.d -f  apache2 disable
# apachectl stop
Then continue to follow the iAstroHub instructions.
Make sure that you can still connect to your access point and webpage.  Mine is still at 192.168.4.1, and I now see that is running nginx as opposed to Apache.

Step 9:  I followed the instructions, and got a failure.  Instead (you will want unzip for later):
# apt-get install gphoto2 unzip
That being said/written, it does not look like the gphoto2-6 package works later in step 20, so I will revisit compilation later.

Step 10: It is not mentioned, but grab the latest lin_guider from linguider.sourceforge.net.  The "copy modified files" means to copy the files from the Modified codes/linguider folder in the iAstroHub package to the lin_guider_pack/lin_guider/src directory of lin_guider.

The setup of lin_guider is through a GUI.  So, you either need to have a monitor hooked up to the BBB, or you need to be exporting the graphics via ssh -X.  Woohoo!  I can see from my webcam after the device setup.

Step 11: The mentioned package is available from http://en.sourceforge.jp/projects/sfnet_cccd/releases.  I am uncertain if it does any good for webcams.

Step 12-13: Sure.  This is starting to take up a fair bit of space....  

Step 14: The pip install pyephem step should probably be sudo pip install pyephem. When setting up astrometry, the modified starutil.c goes in util, and solve-field.c goes in the blind directory.

The make on astrometry fails for me with:
collect2: error: ld returned 1 exit statusmake[1]: *** [libbackend.so] Error 1make[1]: Leaving directory `/home/ubuntu/projects/astrometry.net-0.40/blind'make: *** [subdirs] Error 2
So, according to the astrometry google group, you can get around this by doing: sudo make -k since libbackend.so apparently isn't needed for astrometry.  At this point I needed to do a sudo apt-get clean so that I had enough space on my BBB to continue.  Actually, at this point I realized that there will not be enough space on the BBB's eMMC memory for all of this, which means expanding to 8+ GB and booting off the microSD (and editing my first post).

You need to get plate solving index files from http://data.astrometry.net/4200/.  Read the http://www.astrometry.net/doc/readme.html to figure out what indexes you need.  Anat has some recommendations, post 6193995.  Since my scope is a WO GTF81 using prime focus, I will try indices 4208-4210.fits.  Just copy them to the /usr/local/astrometry/data folder.

Step 15: Already configured our Wifi.

Step 16:  I have a Sabrent SBT-USC1M USB to Serial cable using a Prolific PL2303 chip (according to Amazon), so I am more interested in the pl2303.ko module.  Fortunately, this build of Ubuntu already has the modules.  Bonus!  Thanks to Anat for pointing this out to me and suggesting I do serial via UART and save a USB port (Phase 3/4).

Step 17: This configuration might change if a do a UART to serial.  Copying for now.  Port is 3300.

Step 18: We already setup our access point (previous post).  The MK80 apparently uses eth0 for it wireless, while we use wlan0.  I am keeping my dhcp range in 192.164.4.x, but it is probably a good idea to change the lease time to 8 or 12 hours in /etc/dnsmasq.conf and restart the service.

Step 19: This section is for starting up services on boot and creating a virtual X server.

Step 20: ccd_1.2.7.tar.bz2 is obtained from http://sourceforge.net/projects/cccd/files/ccd/1.2.7/.  This is for controlling your imaging CCD or DSLR.  I don't have one (yet, since I am using a micro four thirds camera) but I will build it anyhow.  My Ubuntu distribution has gphoto2-6 and fails to compile.  It looks like there is a known bug.  I will come back to this.  Guess I will have to build gphoto, per step 9.

Step 21: Sure.  

Step 22: lazarus 1.0.10 is in the repository, so I apt-get'd it instead of building, although it added an additional 698 MB worth of packages.  Unfortunately, this doesn't work, as a Raspberry Pi user found out.  So, lets build from source.
svn checkout http://svn.freepascal.org/svn/lazarus/tags/lazarus_1_0_12
cd lazarus_1_0_12
make clean; make
chmod 777 /home/pi/lazarus_1_0_12 -R
Continue to configure lazarus as appropriate.  With lazarus and fpc installed, the skychart configure line looks like:
# ./configure fpc=/usr/lib/fpc/2.6.2 lazarus=/home/pi/lazarus_1_0_12 prefix=/usr/local
Some directories are missing in skychart which prevents it from compiling.  While in skychart-3.8-2450-src:
# mkdir skychart/component/lib/arm-linux-gtk2
# mkdir skychart/units/arm-linux-gtk2
# mkdir varobs/units/arm-linux-gtk2
Then proceed with building and installing.  During configuration of "Telescope type", there was not a direct option for my mount (Celstron Advanced VX) so I chose Celestron GPS.  Fingers crossed.

Step 23-25: Don't really apply.  No audio DSP in the BBB from what I understand.

Reboot.  Grabbed my (wife's) iPad, installed SkySafari Plus, and pointed my WiFi at the BBB.  Go to settings in SkySafari Plus (or Pro if you have that).  Choose your mount (Celestron NexStar/Advanced GT works for my VX).   Use the appropriate network settings.  Mine is still 192.168.4.1, but Anat's instructions have the network on 10.0.0.1 IIRC.  We previously (step 17) set the serial port to communicate on port 3300.  Connect to the telescope, and presto!  I can control the scope!  Of course, if I just wanted SkySafari control, all I really needed to do was get the access point setup and install/configure ser2net (Step 17).

Phase 3: GPIO-based guide port interface
for the next post...

2 comments:

  1. Hello,

    Your project is very interesting.
    Does it need an interface between the mount and the Beaglebone to drive the steper motors ?

    William

    ReplyDelete
  2. Hi William,
    I have a Celestron Advanced VX mount. The connection looks like:
    BBB -> USB hub -> USB to Serial/RS232 adapter -> RS232 to phone cable -> Hand controller
    Next month I should be able to test it out on a Orion Sirius mount.
    Jeff
    P.S. I got the GPIO working. Still trying to get all the settings figured out for a good astro guide, so the project continues.

    ReplyDelete