Menu |
Prof /
SandcontrolUbuntuEnEtapes Si les librairies cfitsio ci-haut ne suffisent pas: (:translatelink style=horizontal :) SAND Light pollution spectrometer/photometer controlIntroductionThe aim of this project is to develop a system capable of remotely controlling a spectrometer or a five filter wheel radiometer for measuring light pollution. SAND-4 spectrometer is the result of several years of development and was prededed by various version more or less effective. The first version was developed as part of a research project of the Groupe de Recherche et d'applications en physique du CÉGEP de Sherbrooke (GARPHYCS, http://cegepsherbrooke.qc.ca/~graphycs/site/html) but it is mainly the private society Memo Environnement (http://www.memoenvironnement.com) which supported subsequent developments. In 2008, the society gave the system to a non-profit organisation named CélesTech (http://www.celestech.ca) and it was under this that SAND-3 and SAND-4 has emerged. That project is led by Martin Aubé, principal researcher at CélesTech. Among other changes from SAND-2 to SAND-3, we decided to replace our spectroscopic head with the SBIG DSS-7 spectrometer but kept the SBIG ST-7MEI CCD camera. In SAND-4, we replaced ST-7MEI by ST-402 camera. LPRad-1 is the first attempt to use a combination of filters to estimate light pollution levels. We choosed a development philosophy based on a complete control from tha Linux command line. The system can be controlled simply with a low speed remote connection provided by a SSH client installed on the user workstation. The computer connected to the system act as a server. From internet: ssh -p 2022 sand@routers_public_ip or inside a private network ssh sand@servers_local_ip From the internet, port 2022 is used instead of standard port 22 to reduce risk of attacks by hackers. A password and user name is required. The standard username is sand. The system administrator should be able to provide you the password for sand. In addition to this SSH control, a Web interface was designed to allow remote control with a more user-friendly graphical interface. This interface can be accessed by logging into your favorite web browser: http://routers_public_ip:2080/~sand Once again, a password and username will be required. The username is sand. The system administrator should be able to provide the password. Unfortunately, not all commands and options are available from the web interface. The various web browsers have not been systematically tested, so the user should carry out preliminary tests before using this interface with confidence. Installing and configuring subsystemsHardware profileThe system consists of the following but it would certainly be adapted to a different list of items with minor corrections.
Environmental constraintsThe critical element is the hard disk because it does not support very high nor very low temperatures. To overcome this problem we are studying the possibility of replacing the mechanical hard disk by a solid state (SSD). For now in the case of the installation in the observatory protected by an acrylic dome (OBSAND-2), we integrated bathroom ceiling fan (50 CPM) controlled by a thermodisc that switch on at 43 C and off at 32 ¡ã C. For cold weather, the field test show that thermal equilibrium is reached at a differential of 16 ¡ã C above the outside temperature. The plywood surface is 1.25 m2 while the acrylic dome covers about 0.55 m2 (a total of 1.8 m2). We can assume a mean R value of 1 (Rsi = 0.17) and estimate the heat power dissipation of 170W. A 82 W heating wire is installed in the observatory. The wire automatically starts at a temperature of 3 ¡ã C and switch off at 7 ¡ã C. Under these conditions, we can maintain the critical temperature of 5 ¡ã C when outside temperature if above -18 ¡ã C. With 210W heating wire, the temperature limit is -31 ¡ã C. Our test at -18 ¡ã C gives a stable temperature around 5 ¡ã C. The heating wire of 82 W is probably working intermittently in that situation. Table 1: Thermal constraints of the hard disk western digital WD800
Basic packages installation and dependancies
sudo dpkg-reconfigure tzdata
sudo apt-get update sudo apt-get install gfortran sudo ln -s `which gfortran` /usr/local/bin/g77 sudo apt-get install gcc sudo apt-get install cpp sudo apt-get install g++ sudo apt-get install make sudo apt-get install libcfitsio3-dev sudo apt-get install libcfitsio3 sudo apt-get install libastro-fits-cfitsio-perl sudo apt-get install fxload sudo apt-get install vim sudo apt-get install vim-common sudo apt-get install bc sudo add-apt-repository ppa:jon-severinsson/ffmpeg && sudo apt-get update -qq sudo apt-get install ffmpeg sudo apt-get install mplayer sudo apt-get install apache2 sudo apt-get install apache2-suexec sudo apt-get install gpsd sudo apt-get install gpsd-clients sudo apt-get install lm-sensors sudo apt-get install openssh-client sudo apt-get install openssh-server sudo apt-get install gnuplot sudo apt-get install gnuplot-x11 sudo apt-get install gphoto2 sudo apt-get install subversion sudo apt-get install apcupsd sudo apt-get install fityk sudo apt-get install imagemagick sudo apt-get install netpbm SBIG CCD camera driver
cd /home/sand/Downloads gzip -d LinuxDevKit_20120324.tar.gz tar -xvf LinuxDevKit_20120324.tar sudo echo "usbfs /proc/bus/usb/ usbfs defaults 0 0" >> /etc/fstab sudo cp -f /home/sand/Downloads/release/firmware/* /lib/firmware
sudo cp -f /home/sand/Downloads/release/lib/32/libsbigudrv.* /usr/local/lib sudo cp -f /home/sand/Downloads/release/lib/64/sbigudrv.h /usr/local/include
sudo cp -f /home/sand/Downloads/release/lib/64/libsbigudrv.* /usr/local/lib sudo cp -f /home/sand/Downloads/release/lib/64/sbigudrv.h /usr/local/include sudo cp -f /home/sand/Downloads/release/udev/50-usb-serial.rules /etc/udev/rules.d/ sudo cp -f /home/sand/Downloads/release/udev/sbig_dev_permission.py /etc/udev/rules.d/
sudo ldconfig Install cfitsioInstaller cfitsio si ce qui a plus haut ne fonctionne pas: http://pendientedemigracion.ucm.es/info/Astrof/software/howto/howto-cfitsio.html In Linux I always download the original source code of CFITSIO from its homepage, and install the package manually. Download the latest Unix .tar file from the homepage (at the time of writing these notes it was cfitsio3270.tar.gz). Decompress and extract the contents of the distribution file in a source directory. In this sense, I always place the source cfitsio under /usr/local/src. Note that for this opperation it is probably required that you have root privileges, unless you have write access to the directories. I indicate that by changing the prompt symbol from $ to #. You can either log in as root (using su in Fedora and CentOS, or using sudo su in Ubuntu), or use sudo in front of the following commands:
The last command will create /usr/local/src/cfitsio and subdirectories. Generate the make file:
Note that I have included the option --prefix=/usr in order to control where the library will be installed. Otherwise, by default CFITSIO will be installed under the source directory, which normally is a bad idea because that directory will not be included in the default search path for autotools. Compile the source files:
The different versions of the CFITSIO library (libcfitsio.*) are installed under: /usr/lib. The auxiliary files longnam.h, fitsio.h, fitsio2.h, and drvrsmem.h are placed under: /usr/include. The pkg-config file is available at /usr/lib/pkgconfig/cfitsio.pc. SSHSSH server allows any remote SSH client to connect to the server to remotely control system programs from the command line or to download (upstream / downstream) data. Most operations shall be also accessible via the web interface.
Installing SAND applicationsLatest available package release on google code subversion repository
cd mkdir hg cd hg hg clone https://aubema@bitbucket.org/aubema/sand cd sand bash makeSAND
cp -f /home/sand/hg/sand/* /usr/local/bin/ chmod a+x /usr/local/bin/*
cp -f /home/sand/hg/sand/localconfig /home/sand Fits utility programsOur spectra extraction scripts are using fits utilities developed by HEASARC at NASA. Some other scripts were added, but all rely on LIBFITSIO. These utilities are placed in /home/sand/svn/trunk/fits-utils/ . To install, do as root: cd /home/sand/svn/trunk/fits-utils ./fits-utility Access to serial port ttyS0 in order to control mount and to ports video0 or video1 for the mount webcamIt seems that the serial port is not available by default to a user in the terminal and the remote web control can not access it. A patch to remedy to this is to put the port in the sand group. But we must ensure that the group sand has the writing and reading permissions. All users of the system must be able to access the serial port, so you have to give permissions to read and write to all. As root, create the script «openserial» in /etc/init.d/ with execution permission echo '#!/bin/bash' > /etc/init.d/openserial echo "chgrp sand /dev/ttyS0" >> /etc/init.d/openserial echo "chmod g+rw /dev/ttyS0" >> /etc/init.d/openserial echo "chmod a+rwx /dev/video0" >> /etc/init.d/openserial echo "chmod a+rwx /dev/video1" >> /etc/init.d/openserial chmod u+x /etc/init.d/openserial N.B. If the computer have its builtin webcam (sometimes the case for laptops), the external mount webcam will be available on the USB device /dev/video1 instead of /dev/video0 . As root do cd /etc/rc5.d ln -s ../init.d/openserial S93openserial NightviewNightview is based on the SBIG driver for linux that allows to operate the CCD camera and the filter wheel. It was developed by Filip Hroch, Institute of Theoretical Physics and Astrophysics, Masaryk University, Brno, Czech Republic
The modification concern the install_sbig_firmware.sh program located in libsbig directory. This program will automatically download the driver (PUBLIC_SOFTWARE_2014.tar.gz) from our website.
cd /home/sand/Downloads gzip -d nightview*.tar.gz tar -xvf nightview*.tar mkdir /lib/udev/devices
echo "usbfs /proc/bus/usb/ usbfs defaults 0 0" >> /etc/fstab cd nightview*/libsbig ./install_sbig_firmware.sh
cd .. ./configure --without-xnightview --without-xmove make make install
nightview-conf /usr/local/etc/nightview.conf Active archive
Learn more about that
SkycalcSkycalc allows ephemeris calculations that provide, among other time of the astronomical twilight ans sunset. These data will be used to manage the launch of observation requests. However a number of additional information will also be archived in the execution log file as the percentage of the lunar disk illuminated.
cd /home/sand/Downloads gzip -d skycalc.c.gz cc skycalc.c -o skycalc -lm cp skycalc /usr/local/bin/ Learn moreD-LINK router configurationThe router is useful when SAND is connected to the Internet and that the appropriate ports are open to take control of the instrument remotely. If the system is not connected to the internet, a simple network switch or hub is sufficient.
Apache serverWe are using the Apache web server. This server allow the remote control from a web interface. It allow also browsing the database. To activate the web server, we must:
sudo a2enmod userdir sudo service apache2 restart
echo "UserDir public_html" >>/etc/apache2/httpd.conf echo "<Directory /home/*/public_html>" >>/etc/apache2/httpd.conf echo " AllowOverride All " >>/etc/apache2/httpd.conf echo " Options MultiViews -Indexes Includes FollowSymLinks" >>/etc/apache2/httpd.conf echo " <IfModule mod_access.c> " >>/etc/apache2/httpd.conf echo " Order allow,deny " >>/etc/apache2/httpd.conf echo " Allow from all " >>/etc/apache2/httpd.conf echo " </IfModule> " >>/etc/apache2/httpd.conf echo "</Directory> " >>/etc/apache2/httpd.conf echo "<Directory /home/sand/public_html/cgi-bin>" >>/etc/apache2/httpd.conf echo " AllowOverride All " >>/etc/apache2/httpd.conf echo " Options +Indexes FollowSymLinks ExecCGI " >>/etc/apache2/httpd.conf echo " <IfModule mod_access.c> " >>/etc/apache2/httpd.conf echo " Order allow,deny " >>/etc/apache2/httpd.conf echo " Allow from all " >>/etc/apache2/httpd.conf echo " </IfModule> " >>/etc/apache2/httpd.conf echo "</Directory>" >>/etc/apache2/httpd.conf echo "<Directory /home/sand/public_html/data> " >>/etc/apache2/httpd.conf echo " Options +Indexes " >>/etc/apache2/httpd.conf echo "</Directory>" >>/etc/apache2/httpd.conf
a2enmod userdir service apache2 restart
cd /home chmod a+x sand
mkdir /home/sand/public_html cd chmod a+rx /home/sand/public_html
mkdir /home/sand/public_html/cgi-bin mkdir /home/sand/public_html/data cd /home/sand/public_html/cgi-bin ln -s /home/sand/public_html/data data
cd /home/sand/public_html echo "AuthUserFile /home/sand/.htpasswd" > .htaccess echo "AuthGroupFile /dev/null" >> .htaccess echo "AuthName \"Acces securise au site\"" >> .htaccess echo "AuthType Basic" >> .htaccess echo "<LIMIT GET POST>" >> .htaccess echo " Require valid-user" >> .htaccess echo "</LIMIT>" >> .htaccess
cd /home/sand/public_html/data echo "AuthUserFile /home/sand/.htpasswd" > .htaccess echo " AuthGroupFile /dev/null" >> .htaccess echo " AuthName \"Acces securise au site\"" >> .htaccess echo " AuthType Basic" >> .htaccess echo " <LIMIT GET POST>" >> .htaccess echo " Require valid-user" >> .htaccess echo " </LIMIT>" >> .htaccess
cd /home/sand htpasswd -c /home/sand/.htpasswd sand
cp /home/sand/svn/trunk/cgi-bin/* /home/sand/public_html/cgi-bin/ cp /home/sand/svn/trunk/html/* /home/sand/public_html/
chmod go-w /home/sand/public_html/cgi-bin/*
chmod -R a+r /home/sand/public_html Webcam server LINKSYS WVC54GC ou D-LINK DCS-920 et webcam logitech quickcam notebookWe are using a webcam server to track cloudiness and transparency of the window during day time. The webcam server is also usefull to measure the ambiant luminosity. This is obtained by taking the mean grey level of the image. If the mean grey level is higher that a given treshold (typically 10 or 20) then the observe script will pause for 15 min before make another verification of the mean grey level. Observe can also decide to begin observation if the ambiant luminosity is under the threshold when the starting observation time is more than 12 hours later.
crontabThe crond daemon is scheduling repetitive task on lilux system. Users who have the right to use crond can schedule their own tasks to crond. We are using crond to schedule a webcam acquisition every 15 min and to create an animated gif with the last 6 hours images. Allow sand user to use crondAs root, allow sand to use cron by doing: echo sand >>/etc/cron.allow Add program webcamimg to the crond scheduleAs sand, edit crontab cd crontab -e Add the following content: */15 * * * * /usr/local/bin/webcamimg Add program checkmysystem.bash to the root crond scheduleAs root, edit crontab cd crontab -e Add the following content: 30 10 * * * /usr/local/bin/checkmysystem.bash >> /home/sand/checkmysystem.log USB GPS BU-353 from GlobalSatThe GPS is controlled by the gpsd server. The GPS startup may easily take 45 seconds (time to connect to available satallites). Sometime, the GPS do not succeed to connect to satellites. Most of the time this occur when satellites are masked by obstacles like mountains or buildings. The observe script is able to extract latitude and longitude from the GPS and use them for ephemeris calculations. To be shure that the gpsd server will startup with the system do the following steps. As root create the script gpsstart into /etc/init.d . cd /etc/init.d vi gpsstart Put this content in the file: #!/bin/bash /usr/sbin/gpsd /dev/ttyUSB0 As root do: cd /etc/init.d chmod a+x gpsstart As root do: cd /etc/rc5.d ln -s ../init.d/gpsstart S94gpsstart UPS controlThe UPS is a power battery backup. It will protect the system against power fluctuations and will allow the system to continue its ongoing tasks during short power failure.
service apcupsd start
apcaccess Monitoring des senseurs du syst¨¨meOn a regular pc, we can use thermal sensors to monitor the internal temperature of obsand.
sensors-detect
sensors
System rebootNow all the relevant software are installed, in order to activate all newly added functionalities, restart the computer. Configuring the spectrometerOpto-mechanical alignment and focussingThe spectrometer may be aligned following the procedure described in the document titled Operating instructions for the Santa Brabara Instrument Group Deep Space Spectrograph (DSS-7). In that case, it may be usefull to keep a windows partition since CCDOPS is convenient to make alignment with the focus mode. We suggest here an alternative step by step procedure to make the optical alingment and focussion in linux. The DSS-7 have a set of 4 air slits of various width. We are using the thinnest (the one giving the darkest spectrum and thinnest spectral lines). This slit possess a width of 50 microns of 1.45 mm in length. Table 3: Field of view of the spectrometer:
SAND-4 versionTo get the proper spectral image orientation on the CCd matrix (UV to the left and IR at right), the DSS-7 should be attached to the ST-402 camera according to the image below. Figure 1: Proper orientation of the ST-402 relative to DSS-7
night_exposure -b 1 -t 0.121 -pn display nightview.fits & rm -f nightview.fits Then move the small plate in a given way and take another picture. Repeat this step as long as the image of the slit is not the sharpest you can have. At the end, thighten the 2 screws.
Figure 2
Take note that at this step you should have the camera lens attached even if it is not shown on figure 3.
At the end of the alignment procedure, the image of a white surface lighted by a fluocompact lamp, should be similar to image of table 4. We can clearly see on this image the 4 slits dispersion. These slits allow to cover a large span of sensitivity/spectral resolution. We are normally using the highest resolution that keep the signal to noise ratio at a reasonable level. On the same figure, we can notice that the spectral dispersion is correctly alligned horizontally (relative to the red rectangle). But the most important is to be shure that a given spectral line is precisely vertical on the image. This vertical alignment is crutial to get a maximum signal to noise ratio and an optimal spectral resolution. Sometimes the optical assembly is not perfectly done by SBIG and this may result in non perfect orthogonality between the spectral line and the spectral dispersion. This is not a big problem. Securing moving componentsThe DSS-7 spectrometer contain some moving components (the air slit and the grating). Moreover, the grating is supported on a flexible shaft. These moving parts have the disadvantage that if we move the orientation of the spectrometer, there is some small change in grating orientation and then the spectrum moves on the CCD image. We decided to glue those moving parts. We used melted glue applied with a glue gun. That kind of glue may be remove (not without pain...) if required. Refer to figure 2 above to see where the glued spots should be applied. It should be also a good idea to glue the coupling fo the camera and the spectrometer and the spectrometer plate if you plan to travel with the instrument. This will prevent unwanted spectral calibration shifts. Parameters for spectral calibrationIn order to extract the spectral information of the desired air slit from the CCD image we should specify the line numbers of the beginning and end of the spectrum. As an example, on the image show in table 4, we had measured 136 and 218. This information have to appear in the spectral calibration file. There will be different values for different spectrometers units. More over these values may change if the instrument is violently shocked. It could be a good idea to keep an image of a uniform surface lighted by a fluocompact bulb as a reference. This image may be used later to confirm that the spectral calibration had not changed. The spectral calibration file name should allow to clearly identify the spectrometer unit and should contain the date of the calibration process. Here is an example of a spectral calibration file gain= .54442 oorigin= 400.7 quad= 0. lineup= 91 linedown= 175 The conversion pixel to wavelength is done by doing: {#Wavelength(nm)=quad \times {pixel}^2 + gain \times pixel + oorigin #} Table 4: Spectral alignment and calibration
Note that wavelength provided in table above are for the peak of the spectral line °®as observed with a real fluocompact light bulb¡£This is why it is equal to the nominal wavelength of the given chemical element To determine the spectral calibration parameters, you will need to identify the pixel position on the CCD image of spectral lines identified in table 4 above. The you can use a fitting application like fityk to fit a second order polynomial on the data assuming that x are the pixel position and y the wavelength in nm. But it is important to note that for us, the first pixel of the image is at position 1 (not 0 as it is in display program). Figure 3: Example of spectral calibration with OpenOffice Calc. For that case we set the curve to linear since OpenOffice is not able to fit 2nd order polynomials Download openoffice calc file. For the case presented in figure 3, gain= 0.54056, oorigin= 397.8097 and quad= 0. . OBSAND-2 automated observatoryThe OBSAND-2 observatory is a protecting structure that keeps the spectrometer safe from the outdoor elements and from the extreme temperature variations. OBSAND-2’s objective is to allow the system to be continually operating with its robotized mounting. OBSAND-2 follows a first version called OBSAND and developed by mechanical engineering students (Université de Sherbrooke) and electrical engineering students (Cégep de Sherbrooke) supervised by Martin Aubé (Cégep/Université de Sherbrooke) and Chloé Legris (AstroLab du Mont-Mégantic). Due to the complexity of the construction and the maintenance of the OBSAND, we decided here to design a simplified observatory called OBSAND-2. Figure 4: OBSAND-2 at Sherbrooke University, Quebec, Canada OBSAND-3A automated observatoryThe OBSAND-3 observatory was optimized for a fix installation but can be easily carried on a plane. It consists in a smaller box than OBSAND-2. It has the dimensions of a hand-luggage and can be carried in the cabin. OBSAND-3 is provided with a starphire glass that can be washed more times. This version was conceived for its installation in China. It has a power of 45 Watt, and can reach 65 Watt when its heating cable is in operation (less than 5 C). The system is controlled by an Acer Aspire One netbook. OBSAND-3 doesn’t include any mounting, and must be aligned in order to point at the zenith. OBSAND-3 includes less components than OBSAND-2. Here is a list of the non present components:
Figure 5: OBSAND-3A at AIOFM center Hefei, Anhui, China For now, OBSAND-3 isn’t adapted to the very cold climatic conditions because its provided with a heating cable of 21 Watt only. External size of the box:height=13 po Mass: OBSAND-3B automatized observatoryThis OBSAND version is intended for ponctual measurements but can be installed permanently. The main idea is to localize the computer-router tandem far from the webcam server and the spectrometer. The computer and the router are then safely set indoor, while only the spectrometer and the webcam server are exposed to the outdoor elements. In order to assure the communication between the outdoor unit and the indoor control center, we use a network cable for the webcam server and a USB->CAT5 converter for the spectrometer. The outdoor unit must also be powered by electricity. Here is a list of the non present components :
The box protecting the spectrometer is the 516-0010 HAMMOND MFG model. Its dimensions are 8.5po x 14.38po x 9.25po (height). It has its own natural ventilating slits. A mosquito net has been placed on the interior side in front of those slits in order to repeal as much insects as possible. Figure 6: OBSAND-3B at Sherbrooke University, Quebec, Canada Development documentationTodo list
User's guide |