quadrant (that’s the quadrant currently pointed towards
the sun or room light). Next, rotate the sun sensor and
verify that the Heading variable changes as a new
quadrant rotates towards the sun (or light).
BUILDING THE SUN SENSOR BODY
The sun sensor shown at the beginning of this article
has a two-piece shell housing. Both halves (the top and
bottom half) are made of 1/2” thick Styrofoam and are
covered in aluminum tape. Ten-millimeter thick Cellfoam
88 is another good material for making the sun sensor’s
housing. The top shell is essentially a lid while the bottom
shell contains the sides of the sun sensor. The top and
bottom shells are the same size octagons. The sides are
tall enough to create a 1-1/2” tall housing and are hot-glued to the bottom shell.
The housing’s four diffusers are cut from ping pong
balls. Use a circle template to draw perfect 1-3/8”
diameter circles on the balls. Cut the circles from the ping
pong balls using cuticle scissors and an Exacto™ knife to
make the starting hole. Make slightly smaller holes in the
quadrants of the sun sensor, centered where the
photocells can look out. Use the Exacto knife to cut out
Place the completed PCB inside the bottom shell and
measure how high it needs to be raised to center the
photocells in the center of the quadrant openings. Cut
some Styrofoam spacers to that thickness and hot-glue
them into the bottom of the shell. Hot-glue a little foam
rubber to the inside of the top shell to keep the PCB
firmly in place once the shells of the housing are closed.
(Alternatively, you can hot-glue the PCB to the bottom
Before gluing the top to the sun sensor housing, cut a
small opening in it just large enough for a programming
header to reach the PCB inside. That way, the sun sensor
firmware can be updated without having to take the
Cover the shells with a single layer of aluminum duct
tape. Cut a Styrofoam plug for the programmer opening in
the top shell and tape the cover in place (you can always
remove the tape to expose the plug and programming
header). Before sandwiching the PCB between the shell
halves, mark the quadrants on the housing as 0, 1, 2, and
3 (the top silk pattern explains which quadrant is which).
After labeling the quadrants, glue the shells together. Then,
hot-glue the ping pong ball diffusers over the quadrant
openings in the sun sensor.
READING NEARSYS SUN
A flight computer using the sun sensor uses the
following code to read solar quadrant reports. This
example was written for a BalloonSat Mini flight computer
that had the sun sensor plugged into I/O port 4.
SYMBOL Heading = B1
SERIN 4, T1200_ 4, (“H”), #Heading
The desired value of the Heading variable depends on
where the camera or sensor are pointed. Since the
quadrants are marked on the sun sensor housing, it’s easy
to tell the proper heading and to code it into the flight
computer’s program. The subroutine operating the camera
or sensor uses an IF/THEN routine to decide if a picture
should be taken or if data should be collected at that
Onwards and Upwards,
Your near space guide NV
■ The completed PCB.
■ The sun sensor bracket.
■ The completed sun sensor firmly attached
to its mounting bracket.