DOCUMENT NAME
CMOS BASED SUN SENSOR FOR ICUBE-CSAT
Abdul Kabir Ahmad -)
Ayesha Alam -)
PREPARED BY
Abdullah Shabbir -)
Abdul Wasay -)
APPROVED BY
Mr. Usman Imran
Dept.
Course
Date
Project:
Page:
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
i
LIST OF MODIFICATIONS
Modified by
Section/Pages
Affected
Date
Issue
-
1.0
All
-
1.1
All
-
1.2
All
Reason for change
Dept.
Course
Date
Project:
Page:
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
ii
LIST OF TABLES
Table 1. Sun Sensor Coordinate System ...................................................................................................... 5
Table 2. Centroid Location and Error .......................................................................................................... 9
Dept.
Course
Date
Project:
Page:
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
iii
LIST OF FIGURES
Figure 5. 1. Circuit interfacing ...................................................................................................................... 3
Figure 5. 2. Mask image ............................................................................................................................... 4
Figure 5. 3.Obtained Sunlight image ............................................................................................................ 4
Figure 5. 4. Principles of Digital Sun Sensors. ............................................................................................. 5
Figure 5. 5. Image after Processing using threshold method ........................................................................ 6
Figure 7. 1: Micro-controller – Arduino UNO ............................................................................................. 8
Figure 7. 2: Camera Module – OV7670 ....................................................................................................... 8
Figure 7. 3: CMOS sensor in ov7670 ........................................................................................................... 9
Dept.
Course
Date
Project:
Page:
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
iv
Table of Contents
LIST OF MODIFICATIONS .................................................................................................................... I
LIST OF TABLES ..................................................................................................................................... II
LIST OF FIGURES ................................................................................................................................. III
TABLE OF CONTENTS .........................................................................................................................IV
1.
ABSTRACT ......................................................................................................................................... 1
2.
SCOPE ................................................................................................................................................. 1
2.1
2.2
PROBLEM STATEMENT .................................................................................................................. 1
SOLUTION ...................................................................................................................................... 1
3.
OBJECTIVE ....................................................................................................................................... 1
4.
LITERATURE REVIEW................................................................................................................... 1
5.
METHODOLOGY ............................................................................................................................. 2
5.1
5.2
INTERFACING CAMERA MODULE WITH MICROCONTROLLER......................................................... 2
CENTROIDING ALGORITHM ........................................................................................................... 5
6.
FLOW CHART ................................................................................................................................... 7
7.
HARDWARE RESOURCE ............................................................................................................... 8
8.
CONCLUSION AND RESULTS ....................................................................................................... 9
9.
RECOMMENDATION ...................................................................................................................... 9
10. REFERENCES .................................................................................................................................. 10
Dept.
Course
Date
Project:
Page:
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
1
1. ABSTRACT
A CMOS based sun sensor is used in satellites to determine the direction and position of satellite with
respect to sun. CMOS sensor was extracted from camera module ov7670 because of its low power
consumption. A pinhole aperture was designed to cover the CMOS sensor. Sensor was interfaced with
Arduino UNO in order to capture the images. An image-processing algorithm was then used to find
the angle of incident light on the sensor. To accomplish this, an exact centre of the sunlight image must
be determined. Therefore, an accurate estimation of centroid is the most important factor in sun sensor,
so for this purpose centroid algorithm is used. Because the centroid algorithm takes the sunlight image
data without noise removal, the algorithm cannot calculate the centroid with high accuracy, so the
thresholding method was applied to modify the centroid algorithm.
2. SCOPE
The scope of this project includes the interfacing of CMOS sensor with micro-controller for
capturing images, designing of pin-hole aperture, and then applying an image processing
algorithm to determine the angles of incident sun light.
2.1
Problem statement
To make the mission of satellite successful, the orientation of satellite should be according to the
desired position. So, for this purpose the attitude determination is a very important factor in satellites
to know what the orientation of satellite is, so then it can be controlled accordingly.
2.2 Solution
There are many different categories of sensors which can be used for satellite attitude determination
such as sun sensor, magnetometer, star sensor, etc. Among these sun sensors is used in this paper to
determine the satellite attitude by measuring sun vector. Sun sensors are widely used in small
satellites due to their small size, low cost, high accuracy and low power consumption.
3. OBJECTIVE
The main objective is to make a low-cost CMOS based Sun Sensor for ICUBE-CSAT to find direction
and position of satellite with respect to sun.
4. LITERATURE REVIEW
Andrea Antonello [1] presented a CMOS based sun sensor with a Field of View of about 64°x49°, and
an accuracy of ±0.02°. And a pinhole mask has also been presented. Basically, two parts are discussed,
one is CMOS which in here act as a light spot detector and the other is pinhole mask. The method is
that pin hole mask is placed on top of the CMOS image sensor at a certain height which is obtained
with the help of the CMOS sensor’s length. Then when light enters from that pin hole it will activate
pixels of CMOS image sensor. And through coordinates of that spot, angles of sun is calculated. Pin
Dept.
Course
Date
Project:
Page:
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
2
hole diameter was 20 µm. The mask with this small pin hole is manufactured by Edmund optics. Size
and circularity of the slit is also measured with the help of SEM technology. Simulations are done in
MATLAB. Error corrections are done to obtain accuracy.
In another research paper [2], it discusses 2-axis digital sun sensor made with off the shelf components.
This sun sensor with CMOS linear array based having a field of view of ±45° and an accuracy of 0.5°.
Two 1024 pixels CMOS linear image sensors are used to obtain complete information of sun’s position.
For satellites this design offers a low cost, simple and power efficient solution.
A miniaturized two axis sun sensor for attitude control of nano-satellites research paper [3] discusses
about sensor which consists of two pairs of photodiodes fabricated monolithically in the same
crystalline silicon substrate and placed orthogonally. Its field of view is about ± 60° and accuracy is
0.15°. Transparent radiation shield is used in this method which is called cover glass used for the
protection from radiation in space photovoltaic cells. Through this cover sun light partially illuminates
the photodiodes. Metallization is also done directly on cover glass which act as a extraterrestrial
radiation protector.
5. METHODOLOGY
CMOS sensor is extracted from camera module OV7670. To convert it into sun sensor a pinhole
aperture is designed and then image processing algorithm is applied to find sun light incident angles.
5.1
Interfacing camera module with microcontroller
First Interfacing of camera module OV7670 with Arduino Uno is done and its circuit is shown in
Fig. 5.1. Camera module OV7670 works on 3.3 V. Its resolution is 640x480. It can capture up to 30
frames per second. Its image sensor is controlled using SCCB (Serial camera control bus) which is
similar to I2C interface. Two pins of SCCB protocol are used in the OV7670 which are (SIOC
(SCCB clock), SIOD (SCCB Data)).
The camera module OV7670 must have a clock signal only then it operates. For this Xclk (Systems
clock) pin is connected to D11 pin of Arduino uno which is PWM pin which supply’s clock signal
to Xclk pin of OV7670. This clock signals frequency is 16 MHz which is alright as Xclk pin should
have frequency at least 10 MHz
After the clock signal is provided to Xclk pin, at this point camera starts providing data to parallel
output pins which are D0 to D7. This output data is synchronized with three pins VSYNC, HREF
and Pclk (which is sensor’s output clock). Falling edge of VSYN indicates the start of the frame or
new image and its rising edge indicates the end of the frame or image. Similarly, rising edge of the
HREF indicates the start of the line or row and its falling edge indicates the end of the line or row.
Pclk pin is used to synchronize the data.
SCCB protocol is used in it which is bidirectional two wire synchronous serial bus. Two pins of
SCCB protocol is used in the OV7670 which are (SIOC (SCCB clock), SIOD (SCCB Data)).
Through this bus communication is possible. These two pins are connected to the two analog pins
Dept.
Course
Date
Project:
Page:
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
3
A4 (SCL) and A5 (SDA) of Arduino uno respectively, which are used for I2C two wire
communication purpose.
Figure 5. 1. Circuit interfacing
After uploading code in Arduino. To store the captured images, java is used. Before capturing the
images, some calculations are required for mask with pin hole designing. Mask with pin hole is
designed. Pinhole of 0.5mm is made using drill as it is the smallest drill which is available in the IST.
To calculate field of view some calculations are done.
α = 2 arctan (d/(2*f))
(1)
Here α is the field of view, d is the diagonal of the CMOS, f is the focal distance between CMOS
and the mask. Focal length is set as half of CMOS diagonal length for maximum field of view. As
CMOS area is 2.36mm × 1.76mm so diagonal becomes 2.94mm and focal length is approximately
1.5mm.
Now field of view becomes by putting values in eq (1),
α = 2 arctan (2.94 mm/ (2* 1.5 mm))
α = 88.84 °
But this field of view will not be in practical case because the width of mask will also limit this and
in result field of view will be lower than 88, so the width of mask should be minimum. The mask
with pin hole of 0.5mm is place on top of CMOS with focal distance of 1.5 mm which is calculated
above. Mask with pinhole of 0.5 mm is as follows:
Dept.
Course
Date
Project:
Page:
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
4
Figure 5. 2. Mask image
And then through this pin hole image is captured using image sensor. Results are shown below. One
of the stored images is given below which is taken using mobile flashlight instead of sun light in Fig.
5.3.
Figure 5. 3. Obtained Sunlight image
Dept.
Course
Date
Project:
Page:
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
5
5.2 Centroiding algorithm
The basic principles of digital sun sensors and associated coordinated system are represented by Fig.
5.4 and Table 1 below.
Figure 5. 4. Principles of Digital Sun Sensors. [4]
Table 1. Sun Sensor Coordinate System
Parameter
O-X-Y
o’-x’-y’
Definition
CMOS image sensor axis
CMOS image sensor center axis
xc, yc
xp, yp
CMOS image sensor centroid
sunlight image centroid
α
β
Y-axis incident angle
X-axis incident angle
F
Distance between mask hole and
CMOS sensor (focal length)
To calculate the sunlight incident angles the centroid of the image must be found. The centroid of
the sunlight spot on the CMOS sensor can be found using the centroiding algorithm. Here in eq 3, xi,
yi denotes the location of each pixel, and I is the intensity of the light.
Dept.
Course
Date
Project:
Page:
Xp =
∑𝑁
𝑖=1 𝑥𝑖 𝐼𝑖
∑𝑁
𝑖=1 𝐼𝑖
, yp =
∑𝑁
𝑖=1 𝑦𝑖 𝐼𝑖
∑𝑁
𝑖=1 𝐼𝑖
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
6
(2)
The xp and yp is the resulting center pixel of the sunlight spot in the image. The relationship between
centroid of image and sunlight’s incident angles (α, β) is describe by (3,4).
Α = atan (
β = atan (-
𝑦𝑝−𝑦𝑐
𝐹
𝑥𝑝−𝑥𝑐
𝐹
)
(3)
)
(4)
Accuracy of the sunlight incident angles is determined by how accurately the center point of the
sunlight spot is calculated. This method takes the sunlight image data given by the image sensor
without any correction or removing noise, therefore it cannot calculate the centroid with high
accuracy. Therefore, to decrease the noise in the sunlight image data, the thresholding method was
used which modify the previous centroiding algorithm, intensity I in equation 2 will become
(Ii = Ii - µImax, Ii > 0 )
Here, µ determines the threshold value, and all the data which is below this threshold value should
be considered 0’s. So, if the sunlight image contain noise the appropriate threshold value can remove
the noise. In this report the threshold of maximum intensity was used, below this value all the pixels
was become zero. Figure 5.3 shows the actual image and figure 5.5 shows the image that has been
processed using the thresholding method.
Figure 5. 5. Image after Processing using threshold method
Dept.
Course
Date
Project:
Page:
6. FLOW CHART
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
7
Dept.
Course
Date
Project:
Page:
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
8
7. HARDWARE RESOURCE
Digital Output
Analog output
Figure 7. 1: Micro-controller – Arduino UNO (Source: Arduino.cc)
Power Supply
Ground
SCCB clock
Output
SCCB data
Output
Output / pixel clock
System clock
Digital output
Digital Output
Reset (active low)
Power down (Active High)
Figure 7. 2: Camera Module – OV7670 (Source: electrobes.com)
Dept.
Course
Date
Project:
Page:
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
9
Sensor area: 2.36 mm x 1.76 mm
Image transfer rate: 30 fps
Figure 7. 3: CMOS sensor in ov7670
8. CONCLUSION AND RESULTS
All the deliverables and milestones included in the scope of this project were achieved. CMOS sensor
was successfully converted into a sun sensor. Dimensions of pin-hole aperture varied with an error of
0.2mm – 0.3 mm. The camera captured the images perfectly as per the requirements of the project.
Image-processing algorithm in MATLAB also worked fine on the captured images and hence the
angles of the incident light were determined. Error analysis was also done with and without
thresholding method. Without thresholding method, the error was slightly greater than by using
thresholding method. The threshold value of maximum intensity was used and pixels less than that
intensity will be considered zero. The calculated image centroid using the centroid algorithm is given
in table 2. As can be seen accuracy RMS error is approximately 0.1772. In case of sun sensor used for
this research, the centroid error of one pixel translates to 0.0024-degree error in the incident angle.
Table 2. Centroid Location and Error
x – axis
y-axis
Centroid
Centroid
Error
(Pixel)
(Pixel)
Exact
60
60
Threshold
59.8802
0.1198
RMS Error
Error
59.8695
0.1305
0.1772
9. RECOMMENDATION
In this project the pin-hole diameter that was used was 0.5mm. To decrease the practical error, the
diameter of the pinhole should be reduced to 20µm approximately. Additionally, the thickness of the
mask should be as minimum as possible. Apart from the dimensions, the algorithm that was written in
MATLAB will work fine only for stationary images. But in the space, as the satellite will be in
Dept.
Course
Date
Project:
Page:
Electrical Engineering
SE --Dec-21
ICUBE-CSAT
10
continuous motion therefore the images captured by the sensor will be different as compared to the
images presented in this paper. This algorithm is not trained to deal with blur and motion pictures. So,
when using this sensor in satellite, it is recommended to update the algorithm so that it can deal with
the motion pictures as well. For removing noise methods other than thresholding method can also be
used to find centroid with high accuracy.
10. REFERENCES
[1]
L. O. A. F. Andrea Antonello, "Low-Cost, High-Resolution, Self-Powered, Miniaturized Sun
Sensor For Space Applications," 2016.
[2]
A. A. a. F. Tanveer, "Low-Cost Design and Development of 2-Axis Digital," Journal of Space
Technology, vol. 1, 2011.
[3]
P. a. L.-R. G. a. R. J. a. D. M. a. C. L. M. a. Q. J. M. a. T. C. L. a. G. J. a. R. M. a. G. A. a. A.
M. Ortega, "A Miniaturized Two Axis Sun Sensor for Attitude Control of Nano-Satellites,"
IEEE, vol. 10, no. 0, 2010.
[4]
Y.-K. a. K. S.-J. a. L. B.-H. Chang, "High-Accuracy Image Centroiding Algorithm for CMOSBased Digital Sun Sensors," in SENSORS, 2007 IEEE, IEEE, 2007, pp. 329-336.