How To Make a Simple Sun Sensor


Sun sensor is commonly used on spacecraft to current position of sun and light strength. Current technical sun sensor is mainly divided into analog and digital two different types while high accuracy corresponds to high production cost. Apart from space industry, sun sensor is also implemented to assist weather prediction, agriculture and even room daylight condition assessment. In UNSW Bluesat, the sun sensor project belongs to Demonstration Subsystem of  our Satellite Department. On the one hand, it supplements functions of Flatsat to assist cubesat work, on the other hand, teaches satellite member some essential skills about electronic, microcontrol, PCB design and research. This report would generally introduce an approach to making a simple sun sensor for student learning or applications which not require high accuracy.


2.Design Framework

2.1 Functions and General Layout

This sun sensor would achieve three main functions:

  • Detect current sunlight strength
  • Count sunlight time based on a sunlight strength threshold
  • Roughly detect the light angle.


The PCB would generally divided into two parts:

Graph 1: General Layout of Sun Sensor



2.2 Main Critical Components

Components selection is determined by device requirements at various aspects such as cost, accuracy, performance condition and power consumption. Here is my own components selection. Each one could be replaced by others if adjustment is applied.(Datasheet links are attached)


Serial Number











Photodiodes TEMD501



Parallel to Serial Shift Register



Universal Shift Register



Table 1: Critical Components List

 2.3 Logic Path to Achieve Functions:

Sunlight Strength Logic Path Flow Chart

Graph 2: Sunlight Strength Logic Path

Light Time Counting Flow Chart 

Graph 3: Light Time Counting Logic Path

 Incident Angle Flow Chart

Graph 4: Incident Angle Logic Path


3.Functions Achievement Approaches Guide

3.1 Light Strength Detection

The general circuit is displayed in graph 5. The 1ohm one is the current sense resistor which requires low bias. Resistance of R1 and R2 could be changed depends on expansion ratio. Vout would be connected to ADC. To reduce the noise extent and protect components, OPA power supply and Vout lines are better to be decoupled by capacitors. Meanwhile, in this circuit the OPA is supplied by , I actually select TSV623 which is supplied by 0-5V. One more issue is that different components have different performance condition, circuit should be designed based on official sample which could be found in corresponding datasheet.


Circuit Diagram of Light Strength Detection (ADC not indicated)

Graph 5: General Circuit of Light Strength Detection (ADC not indicated)


Via the circuit, when a specific light strength would lead to a specific corresponding resistance of photoresistor. The whole circuit is supplied by a 5V power source, which means when resistance of photoresistor changes, the voltage across current sense resistor would change as well. As the resistance of current sense resistor is tiny, its voltage would be tiny as well and this is the reason why OPA is essential. After expansion, output voltage would be transferred to ADC as analog voltage. ADC would transfer it into digital signal and send to Arduino via I2c interface. The digital signal would be transferred back into light strength by Arduino and indicated on serial monitor.


3.2 Light Time Counting

This function is relatively the easiest one which could be achieved by most entry-level Arduino learner. Firstly, a threshold should be set. For instance, if the standard of ‘Daylight’ is 5ftc, then based on 3.1, it would correspond to a specific digital signal. A simple Boolean or While code could be applied to determine if the period should be counted. If the loop period is 2s, the digital signal at this moment is larger than threshold, the 2s would be added up to ‘Total Daylight Time’ otherwise it would not.


One issue is that Arduino is not proper to connected to computer for long time to avoid overheating. An extra serial monitor can be installed on PCB to replace.


3.3 Incident Angle Measurement

The graph 6 and 7 individually display general model of angle measurement theorem and a simple CCD which would be used to measure light incident angle.


 Incident Angle Measurement Theorem

Graph 6: Incident Angle Measurement Theorem Model


Simple CCD Model

Graph 7: Simple CCD Model


The measurement sensor would be covered by a opaque mask with a hole drilled at the central. Hole diameter and mask height are determined on purpose. Each photodiode on CCD has their own specific coordinate including direction and distance to central. With the coordinate and height, light incident angle and direction could be calculated via trigonometric analysis.


As for the CCD, photodiodes could not be instantly connected to Arduino due to lack of pins so shift registers would solve the issue. Regard the CCD as a matrix and each photodiode would have its own coordinate. The parallel to serial register vertical shift register CD54HC597 has 8 input pins which means it could be in charge of 8 photodiodes. If the CCD contains 16 photodiodes, they would be divided into 2 parts in this way. Their condition would be formed into a binary serial by horizontal shift registers and sent to universal shift register CD74HC194. The two 8 bits serial would be combined into a single 16 bits binary serial, in which each bit presents that if the corresponding photodiode is triggered or not. For instance, as it is shown in graph 8, ‘1001’ represents condition of 4 individual photodiodes, the first one and last one are triggered. The shift register would combine them into a 4 bits binary serial then send the information. In this way, one special 16 bits serial would correspond to condition of photodiodes matrix, which correspond to a special incident angle and direction.


An example shift register

Graph 8: Shift Register Logic Example


An ideal CCD should contain infinite photodiodes of which reaction area should equal to upper surface area, distance between each photodiodes is 0. Accuracy mainly determines the price of a CCD, which could be increased by adding photodiodes amount and increasing integration level. This is just an simple entry-level CCD, a professional CCD could be of high accuracy with even millions of photodiodes but much more expensive.



This report mainly clarified theorem of how to build a simple sun sensor. This sun sensor contains light strength detection, light time counting and incident angle measurement three functions. The accuracy and manufacture process could satisfy some basic measurement and student education. Currently the first phase has been designed while the second phase design is in process.

Leave a Reply