This project is meant to record angles from strongest light around and display them on the LCD. The application of the project is for celestial navigation, for nautical students or just for fun if you like to monitor the Sun or Moon movements on the sky.
I've designed this project to monitor the movement of the Sun (during day time) and Moon (during night time) on the celestial sphere, recording the bearing and altitude which can be used for calculation of the position of the observer, or for correction of the gyro compass for nautical officers onboard vessel.
The project is using a photo resistor, which senses the highest light intensity and records the positions of two servo motors. The servo motors sweep the photo resistor across the sky and when the maximum light intensity is sensed the position of the servo motors is recorded on the LCD.
The project is designed to be fun, easy, cheap and "help navigators find their way" :P.
Step 1: Parts Required
- Arduino Uno (I've used Arduino Uno but you can use any microcontroller)
- Photo resistor
- 2 x 1k resistors
- 1 x 10k potentiometer
- 2 x servo motors
- Jumper wires (M-M), (M-F)
- Push button
- LCD (16,2)
- 2 x 9V batteries (one for powering the microcontroller and one for the servo's)
- carton sheet or any other material for the base of the equipment
- Soldering Iron
- Soldering paste
- Double side scotch tape (or other way of sticking together the servo's)
Step 2: How It Works?
Let's see what we are looking for:
Azimuth - the horizontal direction or bearing of a celestial point from a terrestrial point expressed as the angular distance from a reference direction. It is usually measured for 000 degrees at the reference direction clockwise through 360 degrees. An azimuth is often designated as true, magnetic, compass, or relative as the reference direction is true, magnetic, compass or heading respectively.
Altitude - angular distance above the horizon; an arc of a vertical circle between the horizon and a point on the celestial sphere, measured upward from the horizon. Altitude indicated by a sextant is called sextant altitude. After correcting the instrument errors and applying the inaccuracies in the reference level (principally DIP) is it called apparent altitude. After all the corrections are applied it is called corrected altitude, or observed altitude.
Ok that's the definitions of what we are looking to measure. For a better understanding you can check in the images attached.
The two servo motors will be connected in such way that they will make a 90 degree angle between them. One will move the photo resistor on the horizon from 0 to 180 degrees and the other will move it on the vertical from 0 to 90 degrees both of them combined will sweep the photo resistor on the entire sky hemisphere to find the Sun or the Moon is at certain moment.
The problem is that my servo motors are quite cheap ones and they are not accurate under 20 degrees and over 170 degrees this is why I limited the movement between 20 and 170 degrees as you can see in the Arduino programme. When the servo takes values outside of this angles he will start shaking, so for having better, or more stable reading I limited the movement to 20-170 degrees. If you like to make it more précised you can buy some better and more expensive servos with which to make this project.
When the photo resistor is moved from down to up on the horizon he will read changes of resistance due to intensity of the light. The Sun being the strongest light in the sky during day time and the Moon during night time, Arduino will record the position (the angles) of the two servos on the display giving you the bearing (angle of the horizontal servo motor) and the altitude (angle of the vertical servo motor) when the photo resistor is pointed towards the Sun or Moon. With a little bit of trial and calibration of initial position of the servos you can get a 1-2 degree accuracy in bearing and altitude. As I tested the device it is much accurate for bearing than for altitude.
Step 3: Preparing the Light Receiving Sensor
First we need to prepare the light receiving sensor. For accurate readings we need the light to be focused on the photo resistor so that no other ambient light can affect our readings. For that I cut a piece of carton and I squeezed the photo resistor between the layers of paper, you can put it in a small tub or something similar, but make sure there is no light passing throw and the photo resistor is deep inside the tube so only when it gets directly pointed towards any light he will record changes in resistance.
Solder the two connection wires of the photo resistor with longer jumper wires so that the movement will not be impended when the servos start moving.
Make shore you will align the tub in which the photo resistor is located on the direction of the vertical servo and perpendicular on the direction of the horizontal servo.
Step 4: Preparing the Servo Motors
First we need a way to know the position of the servos. For that I've made a program which can be loaded on the Arduino Uno and the servos can be positioned to what ever angle you like. You can find the program in this instructable. You should use the serial monitor to point the servo motors to the desired positions.
I've positioned my servos both on 90 so that I know now how to place them in order to move the photo resistor over the sky.
I've prepared a carton board and I've drawn one strait line (which will be the base line) and one perpendicular line on the base initial line. The purpose is to be able to align the base line to the North-South, or East-West line or to the heading of a ship for example and then by measuring the relating bearing of the Sun you can compute the truth azimuth depending which line was more convenient for you.
First servo will be design as horizontal servo it will be connected to Arduino digital pin 10. This pin is capable of PWM signal exactly what we need for our servo. By positioning the servo on 90 degrees you can align it with the base line and the perpendicular line so that his 90 will be pointing exactly as it was drawn on the carton board.
Second servo will be designated as vertical servo and will be connected to Arduino digital pin 11, also capable of PWM signal. Make sure that when you stick together the two servos they are making a 90 degrees between them. The vertical servo will start his movement from 90 up to 170, and we want that 90 of the servo to be the reading of the horizon (horizontal position). (Later for better calibration you can measure on a sunny day the altitude of the sun with a sextant and compare it with your altitude of the sun from the display. The difference can be adjusted for the program or just by shifting the vertical servo with the difference of the two).
Now we have to attach the photo resistor to the vertical servo. Make sure it is perfectly aligned to the vertical servo 90 degrees position and also to the horizontal position. If not perfectly aligned you can calibrate it later with some measurements and shifting of the sensor, or applying changes to your program.
Step 5: Let's Connect Them All
1. First we will connect the 5V pin of the Arduino Uno to the red rail of the breadboard. There will be two power rails. One coming from Arduino with 5V which will supply the LCD and one with 9V which will supply the motors.
2. Second the GRD pin of the Arduino Uno is connected to the black rail of the breadboard.
3. As we said before horizontal servo will be connected to digital pin 10, so the yellow wire goes to pin 10. Red wire goes to the 9V (red) rail on the breadboard, and the brown wire goes to the GND (black) rail of the board.
4. The vertical servo will be connected to digital pin 11, so same like before yellow wire goes to pin 11, red wire goes to the 9v rail (red) of the breadboard, and brown wire goes to GND (black) rail of the breadboard.
5. I've connected the two servos to a 9V battery to not draw power from the Arduino. With the servo motors which I've used should not be any problems but if you are using a different, more bigger servo's make sure you connect them to a different battery, not from Arduino's 5V pin as this can burn your controller.
6. Connect the push button to digital pin 12. The push button will be pulled down by one 1K resistor.
7. Connect the LCD as follows:
8. VSS to GND rail on the breadboard
9. VDD to 5V rail on the breadboard
10. V0 to middle pin of the 10k (5K) potentiometer
11. RS to digital pin 2 on the Arduino
12. RW to GND rail on the breadboard
13. E to digital pin 3 on the Arduino
14. D4 to D7 to digital pins 4-7 on the Arduino
15. A to 5v rail on the breadboard.
16. K to GRN rail on the breadboard.
17. Connect the potentiometer. First pin goes to 5V rail, second pin goes to the LCD V0 pin and third pin to GND rail on the breadboard.
18. That's about it. You can compare you connection with the attached schematic.
Step 6: Arduino Program
You can find attached the programs for Arduino Uno:
- the program for setting the servos at desired positions (angles)
- the program to load for measuring the bearing and altitude of the Sun/Moon
Step 7: Testing
The program will start with a initial message (you can put what kind of message you like there).
Next the display shows "Calibrate" and "Press to measure" and the servo motors will move to 90 degrees both of them. At this stage you have to point the horizontal servo perpendicular on the ship's heading (to obtain a relative bearing to the Sun or Moon) or perpendicular to the North direction to measure bearing from 0 - 180 degrees or South direction to measure bearing from 180 to 360 degrees.
Once the servos are aligned you can press the button and the servos start moving sweeping the photo resistor up and down on the entire sky hemisphere which you point it to.
The time for a complete movement takes around 3 minutes to move the horizontal servo from 20 to 170 degrees, and you can get accuracy of 2 degrees. After few trials and adjustments, because the servo's jump two by two degrees in order to not take to long for measurement. For more precise measurement you have to change in the program variables values of i=1 and j=1, but this will make the measurement take longer time until a full scanning of the sky.
That's it. I hope you like my project and find it useful.