Tuesday, 31 March 2015

Performace

The autoguider has lot of functions, but the main one is the guiding, which is pretty simple:

  • check for keyboard events
  • get a picture from the camera
  • find the star in the picture
  • calculate the exact position of the star
  • display the image on the screen
  • based on the star position modify the motor speed
  • draw information about the error on the screen
  • display different values on the screen
After a while it took almost one second to do everything above, which means ~1 fps, and that is very slow. So I decided to optimize a bit, to reach at least 10 fps ( which means all the things mentioned above should be done in 100 ms)





I removed some unnecessary thinks, like checking the camera parameters at each step, which stayed there after i added because of some debugging.

Also it's enough to search for the star in every 5th row and column, so the search will have 25 time less steps.

After the star is found, only search for the star around the last know location.

There is no need to copy the image of the camera, that can be used for search ( if i am not modifying the data)

No need to display the picture on the screen. ( it's just almost black everywhere with one white pixel)

After several steps I reached 22.8 fps (Step 4), but unfortunately i got more and more camera errors. I checked, and it seems that the camera can only handle 15 frame/sec. 

So, put back the memcopy of the picture data, and also a delay which waits until 67 millisecond to be sure the camera data is not read more frequent as it can be. 

So, now, i have 15 FPS, which is not that bad..



Friday, 27 March 2015

RTC

I bought an RTC module from China, which can provide the real date and time for the Raspberry Pi at each start-up. I remembered that it had a DS13..whatever chip in it, so i googled it and found that it's name was DS1307 and uses I2C protocol. So i created a connection on the panel for the RTC module on the I2C bus.


After I connected the module and it did not work, i realized that it has a DS1302 chip on it, which does not use I2C, but some special protocol. I had to hack the panel, some re-soldering, but luckily there was two more pins on the Raspberry pi, which were not yet connected.

i found a sample code on: http://www.zedt.eu/tech/hardware/using-ds1302-real-time-clock-module-raspberry-pi/. After integrating the code to my project the module worked fine:

09:44:03 : [RTC  ] -     - 265:   |  > setSystemTime ()
09:44:03 : [RTC  ] -     - 297:   |  |  . setSystemTime (time set: 2015-02-26 14:46:08)
14:46:08 : [RTC  ] -     - 314:   |  < setSystemTime ()


Tuesday, 24 March 2015

First try with a telescope


As the autoguider worked quite fine with a normal DSLR camera, I decided to try it on a telescope. I used the same 9x50 finderscope for guiding as before. I only used one motor for RA, and do not have DEC correction. The very first picture, did not look promising.. 


After a few small adjustments and became a bit better, I also had to rearrange the weights on the mount, but it was still far from perfect.


The guider showed some errors which appeared periodically (green and yellow on the picture below). As the rotation speed of the motor was like 25% faster than it should have been, the guider kept on stopping and restarting the motor, which resulted a very aggressive guiding.    



I've just placed a part of the picture above to a star map to see the what's wrong. It seems that the star trails are mostly in RA direction. So, if the guiding speed is fixed and the corrections are smoother, that will hopefully solve this problem.




Saturday, 21 March 2015

Photo processing..


Picture taken in the city. One single frame, 2 minutes exp., ISO 200. None of the stars on the picture was visible with naked eye:  



15 images stacked with DeepSkyStacker and some minimal additional corrections:


Friday, 20 March 2015

the Sun

This autoguider's main feature is the guiding but the raspberry has a 5 Megapixel camera, so it can be used for planetary imaging or it's a good option for taking photos of the sun eclipse.


it's just started

sunspot

the maximum..

the User Interface - not ready yet, but worked fine this time 

observatory in the office..

we had to change spot, as the sun moved



Tuesday, 10 March 2015

The Circuit and the components














Install Raspbian on Raspberry Pi

1. install raspbian on raspbery pi


download image from: http://www.raspberrypi.org/downloads/
format and sd card with: SD Formatter
write image to the card with: Win32 Disk Imager

modify username and password

2. modify raspi-config settings


sudo raspi-config

3. extend file system manually


create a new partition on the sd-card, 250 MB should be enough for the application and all data:

sudo fdisk /dev/mmcblk0
sudo mkfs --type ext4 /dev/mmcblk0p3

extend the linux file-system to have enough space for the updates. first modify the current partition size then run:

sudo resize2fs /dev/mmcblk0p2

modify etc/fstab:
proc            /proc     proc    defaults 0 0
/dev/mmcblk0p1  /boot     vfat    ro       0 0
/dev/mmcblk0p2  /         ext4    ro       0 0
/dev/mmcblk0p3  /home     ext4    defaults,errors=remount-ro  0  1
none            /var/run  ramfs   size=1M  0 0
none            /var/log  ramfs   size=1M  0 0

http://elinux.org/RPi_Resize_Flash_Partitions
http://raspberrypi.stackexchange.com/questions/7978/how-can-i-prevent-my-pis-sd-card-from-getting-corrupted-so-often?rq=1
https://raspberrypi.stackexchange.com/questions/499/how-can-i-resize-my-root-partition
https://mike632t.wordpress.com/2014/02/10/resizing-partitions/
having linux on a read only partition will prevent file system corruption.

In case there is something to be installed, the file system has to be changed temporary to read-write:
sudo mount -o remount,rw /dev/mmcblk0p2
and then back:
sudo mount -o remount,ro /dev/mmcblk0p2 

This will result an empty /home folder, and terminal text coloring will be off, to fix this, some files are needed:
cp -a /etc/skel/.??* ~/

4. add wifi network info 


sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1

network={
ssid="xx"
psk="xxxx"
}


5. install wsftp


sudo apt-get install vsftpd

sudo nano /etc/vsftpd.conf

Anonymous_enable=NO
Local_enable=YES
Write_enable=YES
Ascii_upload_enable=YES
Ascii_download_enable=YES
pasv_min_port=10000
pasv_max_port=10024

pasv_promiscuous=YES
pasv_address=80.98.109.73

sudo /etc/init.d/vsftpd restart


6. install vnc server


sudo apt-get install tightvncserver
tightvncserver 

vncserver :0 -geometry 1024x768 -depth 24


7. install cmake


sudo apt-get install cmake


8. install userland


http://robotblogging.blogspot.hu/2013/10/an-efficient-and-simple-c-api-for.html

wget https://github.com/raspberrypi/userland/archive/master.zip
sudo unzip master.zip -d ./tmp_ul
cd tmp_ul
sudo mv userland-master/ /opt/vc
cd /opt/vc/userland-master/
sudo mkdir build
cd build
sudo cmake -DCMAKE_BUILD_TYPE=Release ..
sudo make
sudo make install


9. install gtk+


sudo apt-get update
sudo apt-get install libgtk2.0-dev


10. gphoto2 install


sudo apt-get install gphoto2
sudo apt-get install libgphoto2-2-dev


11. image magick

sudo apt-get update
sudo apt-get install imagemagick libmagickcore-dev
sudo apt-get install imagemagick libmagick++-dev


12. wiringPI


git clone git://git.drogon.net/wiringPi
./build



13. i2c enable



sudo apt-get install i2c-tools

/etc/modprobe.d/raspi-blacklist.conf  comment blacklist i2c-bcm2708

in /etc/modules  add:

i2c-dev 
i2c-bcm2708

and reboot



14. backup


backup the sd card with Win32 Disk Imager


Monday, 9 March 2015

The project

According wikipedia, autoguider is an automatic electronic guidance tool used in astrophotography (usually in amateur astronomy) to keep a telescope pointed precisely at an object being photographed. This prevents the object from drifting across the field of view during long-exposures which would create a blurred or elongated image.

These things are available for 400$+, but i thought it would be a good fun to build one myself.

The first version was not a real autoguider, rather a remote control for the stepper motors which received input from the pc, where the real guiding happened. This version had a PIC microcontroller.

The second version, based on mbed platfrom, had a basic camera and a small LCD. This had strong limitations, but it was a real autoguider which worked. It was not efficient enough to be used on telescopes, but i made nice photos with Canon DSLR using this guider.

This blog is about the third version. The main hardware component is a rapsberry pi b+, but an arduino pro mini is also used to control the motor driver. Additional hardware components are the 320x240 touch screen LCD and the raspberry pi camera.