1. Indian Academy of Sciences, Banglore
Indian Academy of Sciences, New Delhi
Indian Adacemy of Sciences, Allahabad
SUMMER RESEARCH FELLOWSHIP PROGRAMME - 2013
CONTROL SYSTEM
FOR
POLARIMETER
ASTRONOMY & ASTROPHYSICS DIVISION
PHYSICAL RESEARCH LABORATORY
AHMEDABAD.
Author:
RISHABH SHUKLA
PHYS - 1569
Supervisor:
DR. SHASHIKIRAN GANESH
JULY 26, 2013
2.
3. A B S T R A C T
The detection of polarized light from celestial objects is not new to astron-
omy. Polarization studies have greaty influenced our knowlege about the
vast cosmos. It has been felt that human knowledge about celestial bodies is
largly depended on the technical/instrumental prowess. But within the last
few decades application of very sensitiver electronic detectiong devices has
revolutionized and revitalized the study of polarization in celestial objects.
Keeping this in mind present project aims to device a more advance and effi-
cient control system for Polarimeter based on Physical Research Laboratory’s
Mt. Abu Observatory.
3
4. To pioneer of Indian Space program Dr. Vikram Sarabai
5. A C K N O W L E D G E M E N T S
With great pleasure I wish to express my deep sense of gratitude to Dr. Shashiki-
ran Ganesh who introduced me to this project and very kindly gave me the
opportunity to work with him. It is really a wonderful experience to rejoice in
discussions with him and to listen his dissecting remarks. His sagacious guid-
ance and scholarly advices were always so inspiring and encouraging that
at no stage during the course of project I felt helpless.It was pleasure and
honour to be part of his entourage at Mt. Abu Observatory for taking observa-
tions. This project is result of motivation from his earlier work on automation
of PRL´s Polarimeter.
I am deeply indebted to Rishitosh Sinha, Vijayan & Ranjith Sir for valuable
discussions which I had with them from time to time. Positive inputs from
Sunil Chandra for improvement in doucumentational work of project is grate-
fully acknowledged.
I am thankful to my friends and colleagues Ashish Mishra, Shivam Patel, Ab-
hishek Kumar & Tushar Patel who encouraged and helped me in many ways
during my stay at PRL Thaltej Campus .
Lastly, I would like to thank my parents Sh. Narayan Das Shukla & Smt. Usha
Shukla for their blessing and wholehearted support towards my higher edu-
cation.
Rishabh Shukla
5
6.
7. D E C L A R AT I O N
This technical report on is a presentation of my original work on CON-
TROL SYSTEM FOR POLARIMETER, under the Summer Research Fellowship
Program - 2013, organised by Indian Academy of Sciences. Wherever
contributions of others are involved, every effort is made to indicate this
clearly, with due reference to the literature, and acknowledgement of col-
laborative research and discussions. The work was done under the guid-
ance of Dr. Shashikiran Ganesh at Physical Reserach Laboratory, Ahmed-
abad.
Rishabh Shukla
Dept. of Electronics & Communication
RJIT, BSF Academy, Gwalior
In my capacity as supervisor of the candidate´s project, I certify that
the above statements are true to the best of my knowledge.
Dr. Shashikiran Ganesh
Astronomy & Astrophysics Division,
Physical Reserach Laboratory, Ahmedabad
Date: July 26, 2013
Place: Ahmedabad
8.
9. C O N T E N T S
I E X I S T I N G C O N T R O L S Y S T E M F O R P O L A R I M E T E R 15
1 E A R L I E R U S E D H A R D WA R E 17
1.1 Introduction 17
1.2 Embedded Control System 17
1.2.1 PC/104 Board 17
1.2.2 Stepper Motor Driver Board 19
1.2.3 ONYX Couner Boards 19
1.3 Software 19
1.3.1 Software for Prometheus Boards 21
1.4 Drawbacks in earlier system 21
II R E V I S E D C O N T R O L S Y S T E M F O R P O L A R I M E T E R 23
2 H A R D WA R E A N D S O F T WA R E M O D I F I C AT I O N 25
2.1 Intoduction 25
2.2 Hardware Alterations 25
2.2.1 PCM 3362 Board 25
2.2.2 MESA 4i22 Board 27
2.3 Software Upgradation 28
2.3.1 Device Driver Programming 28
III R E S U LT S 31
3 R E S U LT S 33
3.1 Pulse essential for motor rotation 33
3.2 Interrupt handling 33
9
10.
11. L I S T O F F I G U R E S
Figure 1 At Mt. Abu Observatory 18
Figure 2 Distributed Control sytem of PRL’s Polarimeter 20
Figure 3 Stepper motor with new control system 26
Figure 4 Waveforms obtained from CRO 34
Figure 5 Interrupt Generation & handling 34
11
12.
13. A C R O N Y M S
MB Mega Byte
MHz Megaheatz
DDR Dual Data Rate
GNU GNU´Not Unix
OS Operating System
GTK GNU´s Tool Kit
IC Integrated Circuit
NFS Network File System
VGA Video Graphics Array
USB Universal Serial Bus
CCD Charge Cpupled Device
PMT Photo Multiplier Tube
PCB Printed Circuit Board
BJT Bipolar Junction Transistor
PRL Physical Research Laboratory
RTAI Real Time Application Interface
SATA Serial Advance Technical Atacchment
CMOS Complementary Metal Oxide Semiconductor
SDRAM Synchronous Dynamic Random Access Memory
13
14.
15. Part I
E X I S T I N G C O N T R O L S Y S T E M F O R
P O L A R I M E T E R
16.
17. 1
E A R L I E R U S E D H A R D WA R E
1.1 I N T R O D U C T I O N
Astronomy & Astrophysics Division of Physicsal Research Laboratory (PRL),
Ahmedabad operates two telescope with mirrors measuring 1.2m and 0.5m
in diameter, specializing in Optical/Infrared region observation, installed ad-
jacent to Gurushikhar which is highest peak of Aravali Range at an altitude
of 1680m. Out of these two telescopes larger one has been equipped with
Optical Polarimeter as backend instrument and is being relied upon for po-
larimetric observational purposes since 1987.
1.2 E M B E D D E D C O N T R O L S Y S T E M
Aforementioned polarimeter is controlled by distributed embedded system
consisting of two PC/104 CPU Boards. This system includes power supply,
support electronics, computer boards rendering it completely self-sufficient.
For changing aperture and optical filters, electromechanical system driven
by stepper motors is used and thus it reduces human intervention. Another
stepper motor is used for pulling mirror in and out which directs light either
to CCD or PMTs.
1.2.1 PC/104 Board
PC/104 (or PC104) is an embedded computer standard as described by PC/104
Consortium. In this case Prometheus PC/104 CPU Board is employed, which
is designed for specialized applications where emphasis is laid on reliable data
acquisition despite of extreme environment. It has 10 MHz crystal oscillator
17
18. E A R L I E R U S E D H A R D WA R E
Figure 1: At
Mt. Abu
Observatory
18
19. 1.3 S O F T WA R E
with 32 MB RAM, also a solid state IDE flash disk is provided which is suf-
ficient for storing entire OS and auxillary softwares. CPU board is equipped
with both male and female bus connectors for interfacing other peripheral
cards either on its top/bottom. This board serves as control unit for various
PC/104 cards meant for-VGA display, usually used only during debugging, a
5 port 100 Mbps ethernet switch , two ONYX digital I/O and counter/timer
board and an in house developed 8 phase stepper motor driver board.
1.2.2 Stepper Motor Driver Board
As earlier mentioned, system employes three stepper motors for rotating half
wave plate, changing aperture and optical filter. For rotating half wave plate
an assembly has been designed which which rotates the half wave plate with
gears. This motor is operated by PC/104 board developed in house. This
card uses 82C54 counter/timer IC. The same IC is also being used as source
of hardware interrupts which are generated in every 2 msec. These interrupts
are used for the enabling and disabling the counters which counts the pulse
coming from PMTs.
1.2.3 ONYX Couner Boards
In present system two ONYX counter are being used. These provide the 16
bit counter timer functionality with the use of an 82C54 timer chip. For each
of the two PMTs, two counters of the 8254 on one counter board were used.
The hardware interrupt mentioned in earlier section was used for enabling
and disabling of the PMTs at 2msec interval. In other words when one counter
was being read and reset, the photon counts were being recorded by the other
counter.
1.3 S O F T WA R E
For controlling the instrument Linux OS was used. This is a unix like op-
erating system avaliable for a large variety of microprocessors. It is easily
scalable from 32 bit AVR microprocessor to high end clusters. Resasons for
using Linux operating system are that. its softwares are open source so they
19
20. E A R L I E R U S E D H A R D WA R E
Figure 2: Distributed
Control
sytem
of PRL’s
Polarimeter
20
21. 1.4 D R AW B A C K S I N E A R L I E R S Y S T E M
are freely avaliable and can be custom edited according to ones specifications,
also this OS is fully multitasking and network interfacing is built in at the very
basic level.
The instrument was being controlled by a dedicated control PC over LAN. It
was a Pentium III running CPU at 800MHz with 512 MB RAM equipped with
Redhat 7.3 Linux distribution along with all auxillary/devlopmental software.
This PC is connected via ethernet cabel to one of the ports of the 5 port
Ethernet switch of the embedded system.
1.3.1 Software for Prometheus Boards
The Prometheus board runs GNU/Linux with real time extensions RTAI added
to a standard Linux kernel from www.kernel.org. The file system on the 32 MB
flash disk is based on white dwarf Linux, the base operating system requires
only 16 MB. Additional space is taken up by the GTK graphical interface li-
braries and the application software. The data recored by the system is saved
on the NFS partition mounted as /home on the enbedded Prometheus CPU
board.
1.4 D R AW B A C K S I N E A R L I E R S Y S T E M
The control system for polarimeter was deployed in 1987. Keeping in mind
the needs of research and development all the best in class boards avaliable
at that time were used. But within the span of 25 years a lot of advancemtens
have taken place in electronics industry. Earlier used BJT dissipated more
heat as compared to todays CMOS transistor, so packing density was less.
During 1990, growth of electronic industry was governed by Moore´s law, but
in coming few years it will surpass the limit of Moore’s law.
Basically, in our project we have used three 8254 IC for counting/timing
purposes, two CPU for contolling CCD and networking respectively. But as per
the avaliability of advanced hardware in market this can be repalced by one
board conssisting three 82C54, and one standalone single chip CPU powerful
enough to control CCD and facilitate networking.
21
22.
23. Part II
R E V I S E D C O N T R O L S Y S T E M F O R P O L A R I M E T E R
24.
25. 2
H A R D WA R E A N D S O F T WA R E M O D I F I CAT I O N
2.1 I N T O D U C T I O N
As it is evident from earlier chapter that earlier used boards can be replaced by
much advance PCB boards, which are capable of handling the functionality
of all the boards taken together. In upcomoing sections we will study the
revisions which have been carried out in the system in terms of hardware and
software.
2.2 H A R D WA R E A LT E R AT I O N S
The stack of board being used earlier was replaced by MESA 4i22 board
(counter/timer) mounted on ADVANTECH PCM 3362 Board (standalone CPU).
Following sections aims to provide a breif description of these embedded cir-
cuits and also discuss the way in which we have utilised them in our project.
2.2.1 PCM 3362 Board
2.2.1.1 General
The PCM-3362 is a fanless, low power, small size (96X90mm), performance
PC/104-plus SBC (Single Board Computer) geared to satisfy the needs for
various industrial computing equipment. PCM-3362 is ideal for communi-
cation, environment monitoring, factory automation, military, and medical
applications that require flat panel support using digital displays with LVDS
interfaces and single Ethernet ports.
25
26. H A R D WA R E A N D S O F T WA R E M O D I F I C AT I O N
Figure 3: Stepper motor with new control system
26
27. 2.2 H A R D WA R E A LT E R AT I O N S
2.2.1.2 Specification
Its features Intel Atom 1.66 GHz Processor and DDR2 667 MHz SDRAM ex-
tendable upto 2 GB. It follows PC-104 standard as described by PC -104 con-
sortium and hence facilitates easy mounting on peripheral boards. Mounting
is faciliated by the avaliability of both male and female connectors. Onboard
2 GB flash memory has been provided for storing OS and auxillary software.
This can be further extended using SATA port. For monitoring essential pa-
rameter during operation SUSIAcess has been provided. It keeps track of
parameter like temperature, fan speed and alerts user in case of extreme con-
ditions. It also provides liberality in choosing between OS, as both Windows
and Linux is supported by this board. In our case we have zeroed down to
Linux OS as it matches our operating needs.
2.2.2 MESA 4i22 Board
2.2.2.1 General
ADVANTECH PCM 3362 board serves as CPU, but for interfacing a stepper
motor with that, MESA 4i22 board is used. It is a 10 MHz, nine channel
universal counter-timer card. An on card 10 MHZ crystal oscillator is pro-
vided as a time base. The 82C54 counters on the 4I22 may be used for event
counting, frequency counting, frequency generation, pulse width modulators,
digital one shots, interrupt timers and many other timing and counting ap-
plications. Eight of the nine counters on the 4I22 have external clock, gate,
and output connections. The ninth counter is used as a optional 10 MHz time
base prescaler for the other eight counters. Gate and output polarity can be
jumper selected as active high or low.
2.2.2.2 Jumpers in 4i22 for configuration
4i22 consists of a family of jumpers, various important parameters like selec-
tion of port address, base address, gate and output polarity can be selected
manully by these jumpers. Datasheet and users manual of 4i22, which is
avaliable online were referred in this regard. We had selected 0200 as base
address and internal clocking for our project.
27
28. H A R D WA R E A N D S O F T WA R E M O D I F I C AT I O N
2.3 S O F T WA R E U P G R A D AT I O N
After accomplishing hardware advancement, task of developing software for
tailored running of motor remains the main concern. In our case, since we
were using Linux OS, so it was required to write hardware level code in Linux
kernel to make the devices run according to the tailored need of project. At
this stage it is essential to mention that kernel programming is done for Linux
kernel 3.2.x. Following sections describe the same process of developing a
driver.
2.3.1 Device Driver Programming
It is highly appercialbe that OS, once a dark and mysterious area whose codes
were restricted to a small number of programmers, can now be readily exam-
ined, unerstood, and modified by anybody wiht the requisite skills. Linux has
helped to democratize operating system.
Drivers in Linux make a particular piece of hardware resopnd to well defined
internal programming interface. So in our case both user space and kernel
space program was written and same was executed in Ubuntu 12.04LS OS.
From understanding kernel architecture to write a compatible code and to
make the devices operate is a complex process comprising of various steps. In
following sections we will describe various steps involved in kernel program-
ming:
2.3.1.1 Building Modules
Developing expertise in building modules is an essential for kernel program-
ming. Modules should not be misunderstood with applications. Applications
perform a single task from begenning to end, whereas module registers itself
in kernel so as to serve future request. Also modules run in kernel space
and application run in user space. Every module invariably consists of initial-
ization (init) and exit function, these functions are called when function is
registered and unregistered in module respectively.
There are some prerequisits that we must keep in mind before builing kernel
modules. First is to ensure that latest/current version of compiler, module
utilites and other necessary tools is being used. It should be also ensured that
28
29. 2.3 S O F T WA R E U P G R A D AT I O N
user has superuser priviliges to perform functions in kernel. In linux environ-
ment functionalities of superuser can be accessed by:
observer@nth106c: sudo bash
Modules were made by using Makefile. It comprises of set of commands which
transform the C codes into kernel readable object/modules using Makefile. In
our case, file 8phase.c was buit into 8phase.ko. Following command was used.
root@nth106c: make -C /usr/src/kernel SUBDIRS=‘pwd‘ modules
2.3.1.2 Loading & Unloading modules
After module is built, next step is loading it into the kernel, insmod command
loads the module code and data into the kernel. Apart from loading modules
in the kernel insmod accepts a number of command line options like assigning
a value to parameter listed in module before linking it to the current kernel.
Kernel support for insmod is defined in kernel/module.c
The modprobe utility is worth mentioning here modprobe, like insmod, loads
a moudule into the kernel and also look at the module for symbols that are
not currently defined in the kernel. Syntax for inserting module is as follws:
root@nth106c: insmod 8phase.ko
After loading the modules in the system /sys/modules can be used for know-
ing the currently loaded moudles in the system. It generally returns module
name, amount of memory each module uses, and the usage count. For un-
loading a previously loaded module rmmod command is used.
root@nth106c: rmmod 8phase.ko
Linux has its own way of classifying devices, it divides devices on the basis
of its functionallity in three class character devices, block devices and network
devices. Since we are operating motor as a filesystem by open, close, read and
write system calls so it is cassified as charcter device.
Character devices are acessed by nodes of the filesystem tree. List of active
devices can be reterived by issuing following command:
root@nth106c: ls -l /dev
All the device name starting with c is character device and b is block device.
Also, two numbers can be seen associated with each device listed before the
date of modification of file. These numbers are major and minor number.
Major number identifies the driver associated with the device, whereas mi-
29
30. H A R D WA R E A N D S O F T WA R E M O D I F I C AT I O N
nor number is used by he kernel to determine exactly which device is being
referred to.
2.3.1.3 Adding device to the kernel
After loading the modules, we have to manually make directory and nodes
for our device by mkdir & mknod commands, while issuing these commands
utter importance to mention the major & minor number. This is carried out
as follows:
root@nth106c: mkdir /dev/4i22
root@nth106c: mknod/dev/4i22/ctr0_clk c 60 0
root@nth106c: mknod /dev/4i22/ctr1_step c 60 1
root@nth106c: mknod/dev/4i22/ctr2 c 60 2
Above set of commands, add three devices, ctr0_clk, ctr_step & ctr2 with
major number 60 and minor number 0,1 & 2 resepectively. In our code, we
have registered these devices and square wave is expected to be obtained
from this.
2.3.1.4 Interrupt Handling
Apart from rotating stepper motor Mesa 4i22 Board is responible for counting
the pulses from two PMT. These two tubes are enabled and disabled alterna-
tively at 2 msec interval. While one tune is exposed to source and other is
acquisiting the data in form of pulse. We have integrated the enabling and
disabling of these PMT via 4i22 Board using Interrupt. Interrupt is requested,
registered & handled via software, functions such as enable_irq, disable_irq,
request_irq & free_irq defined in linux<interrupt.h> header file are used.
30
33. 3
R E S U LT S
In this section we will disucuss the results obtained after executing the code
in Linux Kernel 3.6.x machine. We have divided the result into two sections.
One deals with the squarewaves essential for the rotation of motor, without
taking into considereation the interrupts, while the other takes into account
the Interrupt generation and its handling.
3.1 P U L S E E S S E N T I A L F O R M O T O R R O TAT I O N
Figure 4 relates to the waves essential for motor rotation. We have employed
8 phase stepper motor. First wave in figure 4(orange) obtained from the Pin
No-43 of 4i22 board, which related to out of counter A denotes the system
clock. It is characterized by 500.1 Hz frequency. Waveform 3 with frequency
62.5 Hz is applied to one of the 8 phase of the motor. And consequently other
7 phase are also applied to the same wave with a shift of 1st wave, this keeps
motor continusouly rotating.
3.2 I N T E R R U P T H A N D L I N G
In this section, we will discuss the generation and handling of interrupt by
our program. As evident form figure 5, waveform 2 represents interrupt being
generated at every 2 msec interval, and waveform 3 reperents the interrupt
handler being invoked.
33
34. R E S U LT S
Figure 4: Waveforms obtained from CRO
Figure 5: Interrupt Generation & handling
34
35. B I B L I O G R A P H Y
[1] Jaap Tinbergen ‘Astronomical Polarimetery‘ Cambridge: Cambridge Uni-
versity Press (2005)
[2] Jonathan Corbet, Alessandro Rubini & Greg Kroah-Hartman ‘Linux De-
vice Driver, Third Edition‘ 1005 Gravenstein Highway North, Sebastopol,
CA 95472:O´Reilly Media Inc. (2005)
[3] D. J. King ‘Polarized Light in Astronomy‘St. Andews Scotland: The Uni-
versity Observatory(1983)
[4] Shashikiran Ganesh, U. C. Joshi, K. S. Baliyan, S. N. Mathur, P. S. Patwal
& R. R. Shah ‘Automation of PRL´s optical Polarimeter with a GNU/Linux
based distributed control system‘Physical Research Laboratory, Ahmed-
abad , IN:Astronomy & Astrophysics Division (2008)
[5] http://www.linuxforu.com/author/anil-kumar-pugalia/
35