Intro: Arduino Star-Finder for Telescopes
Space is big. Really big. Owning a small telescope can give a lot of pleasure, but it's often a struggle trying to locate specific objects in the night sky. In this project I made and integrated an Arduino-powered star-finder with a small reflecting telescope, to allow me to easily find the galaxies, nebulae and clusters that I wanted to observe.
What: This device calculates the current position in the night sky of a list of galaxies, nebulae and star clusters. It then measures the current heading and elevation of the telescope, and displays to the user how to orientate their telescope so that the chosen target object will be visible. The electronics are all contained within a convenient handset, attached to the telescope mount on a 0.5m cable.
Why: Traditional methods of finding objects in the night sky (using charts, maps, following constellations) are slow and require experience, and motorised 'Go-To' telescopes are very expensive. This project finds a happy medium between the two. Clear night skies are not common, so using this Arduino star-finder allows you to make the most of your precious viewing time.
How: The Arduino receives position and time data from a small GPS module. Using this, and known coordinates for a list of objects (my initial code includes 45 astronomical objects, and it's easy to expand this list if you choose), their current position in the night sky (relative to the observer) is calculated. The name, position and type of the current chosen object are displayed on a small LCD screen on the handset. By using a rocker switch, the observer can choose which of the database's objects to observe. The heading and elevation of the telescope are measured using potentiometers. The Arduino then compares the position of the target object to the orientation of the telescope, and using LEDs on the handset indicates to the user whether the telescope must be moved up, down, left or right. When the target object is within the field of view, all four LEDs will illuminate. At this point the observer may view the target object through the telescope. The program constantly updates the position information, to assist the observer in tracking the target object as it moves across the night sky. I used a 3D printer to create fittings to house the potentiometers, and to make the handset and battery box holder.
Please note: this project assumes some prior experience with Arduino, basic amateur electronics, 3D printing and CAD (possibly). I've tried to cover all of the background information relating to the astronomy, and justifications about why I designed it how I did. To avoid creating an overly wordy Instructable I've therefore left out some minutiae of the project that would be tedious, for instance wiring of LEDs and switches etc. If there's anything that confuses you, please ask a question and I'll try and answer. Also don't forget that the wonderful thing about Arduino is the huge level of online support, so if you've got a question, however basic, hopefully you'll quickly find an answer online too. This is also my first Instructable, so please go easy on me!
**Caution**: when building and testing your telescope star-finder, please take immense care to not view the Sun through the telescope at any time. Doing so will cause permanent eye damage.
Step 1: The Theory
(I'm sure you're interested about the astronomy principles which this Instructables project uses, but if you're not, then please skip ahead a step or two).
The methodology for calculating the azimuth and altitude values for the desired object is well detailed in a book called 'Practical Astronomy with your Calculator or Spreadsheet' by Peter Duffett-Smith. I'd thoroughly recommend this book for any amateur astronomer, as it shows you how to calculate many different things. Recent editions even show you how to implement the calculations in spreadsheets.
The inputs to the calculation are as follows: the ‘right ascension and declination’ coordinates for the target object, geographical latitude and longitude of the observer, and the current time and date.
Date and time are received by the GPS module, and time is given as Universal Time (UT). Significantly, Universal Time as measured by a GPS system has never been adjusted for leap seconds since the system was initialised in 1980, hence GPS time is currently 18 seconds ahead of true Universal Time. The Arduino GPS library program compensates for this by automatically subtracting 18 seconds from the recorded time to find Universal Time as necessary for the calculations.
The initial part of the mathematics is concerned with converting UTC to Local Sidereal Time (LST), which is done via Greenwich Sidereal Time (GST). Sidereal Time is defined as the hour-angle of vernal equinox. GST is the Sidereal Time as observed on the Greenwich meridian (0° longitude). The conversion to LST takes into account the longitude of the observer, as the sidereal time gets earlier or later depending on position relative to the Greenwich meridian.
All relative positions of all astronomical objects are located according to the angles of right ascension and declination (Ra/Dec). These two angles locate the object on the celestial sphere, according to the equatorial coordinate system. As the coordinate system gradually moves (as the shape and orientation of the Earth’s orbit changes gradually), the Ra/Dec coordinates are adjusted. This adjustment is performed in relation to the current astronomical epoch. Presently, the J2000 epoch is current, and the Ra/Dec figures for all astronomical items will be quoted for the J2000 period. The Ra/Dec data is combined with the LST figure to calculate hour-angle (Equation 1). Equations 2 and 3 are then used to determine the current altitude and azimuth of the target object. Azimuth and Altitude are the coordinates of the horizon coordinate system. This is a coordinate system unique to that position on the Earth’s surface, where 0° of altitude is the observer’s horizon. When considering the alignment of a telescope to these coordinates, altitude is analogous to the inclination of the telescope, and azimuth is analogous to the heading.
Coordinate system transformation:
(1) H=LST- α
Where H = hour-angle, LST = local sidereal time and α = right ascension.
Where a = altitude, ϕ = observer’s latitude, δ = declination and H = hour-angle.
(3) cosA= (sinδ-sinϕ∙sina)/(cosϕ∙cosa)
Where A = azimuth, δ = declination, ϕ = observer’s latitude and a = altitude.
You will see these formulae being used in the Arduino program shown in a later step.
Step 2: The Implementation
How to do this with affordable amateur equipment?
Small GPS modules are easy to use with Arduino, and provide time and location data. Using this, the Arduino can calculate the position of a given galaxy/nebula/cluster at any time. To provide feedback to the user about where to point the telescope, the system will need to measure the current position of the telescope, compare this to the correct positioning, and then tell the user how to adjust the telescope so that it will be pointing at the astronomical object. To measure the position of the telescope, we will use potentiometers. Potentiometers are rotary devices whose electrical resistance changes over their range of rotation. By calibration, these can be used to determine where a telescope is currently pointing, using one potentiometer to measure the telescope's rotation, and one to measure the elevation. The telescope purchased for this project has a Dobsonian mount, and this is vital! A Dobsonian mount (developed by the legendary amateur astronomer John Dobson - have a look for his videos on YouTube, you will want to try grinding your own mirrors and other amazing things) allows the telescope tube to rotate horizontally and tilt vertically, compared to the complex movements of other telescope mounts. This will make it very straightforward for us to program and measure.
Achieving AccuracyThis was the challenging bit, and required weeks of experimentation. Luckily I've done this so that you don't have to! There are four main quanitifiable sources of error in this system, and they must be managed to ensure that the telescope will manage to find what we want. Firstly, let's calculate the Field of View (FOV) of our telescope.
- Focal length of telescope: 650mm
- Focal length of eyepiece lens: 25mm
- Apparent Field of View: 50 degrees
Magnification = (Focal length of telescope)/(Focal length of eyepiece) = 26x
True FOV = (Apparent Field of View)/(Magnification) = 1.923 degrees
So what this means is that when using the 'Super 25' eyepiece lens, you will see an area of the sky 1.923 degrees across. Therefore we need to make sure that the device is accurate enough to always locate an object within this angle. So to make sure that the device would work, I tried to quantify each source of error, and do some statistics to predict the performance of the system. You don't need to do this step unless you're also interested.
1. GPS Accuracy
This was my first time working with GPS and Arduino together. To assess the accuracy of the unit, it was necessary to compare the GPS module’s output latitude and longitude figures to the latitude and longitude of a known location.
The location of trig points, or triangulation stations, are precisely listed by the Ordnance Survey, the UK’s mapping agency. I took the GPS unit to six of these locations, and test results were taken, so that the device’s figures could be compared to the known OS coordinates. Repeating this test a few times gave me enough results to provide a mean figure of GPS accuracy, which was 11.6m. Using a formula called the Haversine Formula, again from Practical Astronomy with your Calculator, I could find that this should affect the overall telescope alignment by an almost non-existent 0.000581 degrees. Clearly this was not going to be the issue!
In this project, we're using potentiometers to measure the angle and heading of the telescope. This is potentially a large source of error, firstly from the potentiometers themselves (including quality of the pots, plus the quality of their installation into the telescope mount), plus how we read this data with the Arduino. An affordable magnetometer and gyroscope unit (the 1120 3-Axis Accelerometer and Magnetometer from Adafruit) was tested, but was found to have an accuracy of greater than 1°, insufficient for this purpose. Optical encoders do not have a sufficiently high resolution if used in a 1:1 ratio with the movement of the telescope, and would therefore require a gear system to raise the number of counts per degree of movement, hence why potentiometers with a linear resistance output were chosen.
So what will be their resolution? To work this out we need to look at how the Arduino measures the analogue signal from the potentiometers. The ATmega2560chip of the Arduino has a 10-bit analogue to digital converter (ADC), which means that the voltage reading from the potentiometer is mapped onto a set of discrete values from 0 to 1023. The number of integer values within this range is what determines the maximum resolution of the potentiometer reading.
The potentiometer selected for measuring the rotation of the telescope, a 6187R 1 KΩ Single Turn Precision Potentiometer from TT Electronics has an electrical travel over 340°. To find the angular resolution we divide 340° by the 1024 intervals, using equation 6, and see that the angular resolution is 0.332°. This is equivalent to 17.2% of the width of the field of view using the 25 mm eyepiece lens. To improve the resolution of the potentiometer readings, an external 12-bit ADC, the ADS1015 4-channel ADC from Adafruit was selected. This small module performs the analogue to digital conversion, and supplies the Arduino with the digital readout. The new range of output discrete values is between 0 and 1660. This seemed to be the best compromise between the Arduino's 10-bit ADC and the Adafruit 14-bit ADC that is also available. The elevation of the telescope will have a greater resolution, as the telescope is being rotated over a smaller arc than it is in being rotated in heading. This results in an error of 0.10 degrees in heading, and 0.077 degrees in pitch, so not a big deal either.
3. Accuracy of Ra/Dec Data
For each of the 45 objects in the database (16 clusters, 20 nebulae and 9 galaxies), the figures for the J2000 right ascension and declination coordinates were taken from the HyperLeda database. This source quotes the accuracy of the coordinates is 10 arcseconds (0.00277°). The reason for this inaccuracy is likely because of the difficulty of determining the centre of these astronomical objects in order to define their position, as many of them are rather amorphous in shape. Object 19 in the database for instance, the Crescent Nebula, has an apparent width of 0.33° and an apparent height of 0.17°. As it has an irregular shape, it is not possible to accurately determine the true centre of the object, hence a partial explanation for the inaccuracy in the Ra/Dec data.
4. Program Error
By far the greatest source of error was generated by the Arduino and its program. I'm sure a better programmer could reduce this significantly, but I'm a relative amateur, and found managing the large numbers, decimals and all the associated arithmetic quite challenging. To assess the magnitude of this, the Arduino results were compared to position results calculated in Microsoft Excel, and it was found that the mean error was 0.72 degrees.
SUMMARY: Overall Error
In Excel, each of the four identified sources of error was independently randomised, then combined to produce this graph (heading image of this step). That image shows 5000 randomised results and their distribution within the FOV of the telescope. Results within that black circle would be visible to the observer. The analysis was performed so that the errors may partially cancel each other out, as would be the case in reality. 81.94% of these theoretical points fall within the field of view. Whilst not perfect, this seemed good enough in my mind to continue with the practical details of the project.
Step 3: Ingredients
Here's the list of components I used for this project (note that the above image only pictures a few of them, that's just a shot of my GPS test setup). With the exception of the major components, I haven't specified a particular product or supplier. This is because that might not be helpful to people who like in a different country to me, and also because for many of these components (switches etc.) it doesn't hugely matter what you use.
- Skywatcher Heritage 130p Flextube Dobsonian Telescope
- Adafruit ADS1015 12-bit ADC (analogue to digital converter)
- 16x2 LCD Display (I used Winstar WH1602B-RTI-JT Red Characters)
- Arduino Mega 2560 Microcontroller Board
- GPS Module (I used GY-GPS6MV2)
- Battery holder for AA batteries (6 cells in series to produce 9V)
- Small breadboard to fit inside the control box
- SPST Rocker Switch with red LED
- SPST Momentary Pushbutton Switch with red LED
- Four red LEDs
- SPDT Rocker Switch, Centre Off
- Rubber tube to use as hose to connect the handset to the telescope mount.
- Arduino Uno (not part of the finished device, but useful to have a second Arduino for testing purposes)
- Suitable resistors to use with each of the LEDs.
- One continuous rotation potentiometer for measuring the Azimuth (Heading) of the telescope.
- One potentiometer for measuring the Altitude (Inclination) of the telescope.
You'll also need jumper leads of different lengths and types, multicore wire, solder, insulation tape, filament for your 3D printer, and a computer with the Arduino IDE software installed to allow you to program the Arduino.
Step 4: Additions to the Telescope Mount
For this project, we need to add a variety of pieces to the telescope mount. I've included .step files of these parts in the next step of this Instructable. I've added them as .step rather than .stl as .step files are more easily modifiable if you want to import them into your own CAD software, and if you want to convert to .stl files for 3D printing, then there are several free online converters that allow you to do this easily. Note that these files are designed to fit the Dobsonian telescope that I owned, but if you would like to implement this system for a different Dobsonian telescope you will need to adapt at least the potentiometer holders, although the design principle will be the same.
Control Box (1st Image, consists of 3 pieces)
This consists of two shell halves, plus a small piece which is used inside to clamp the tube that tethers the control box to the telescope mount. That clamp piece is bolted across the tube, compressing it and holding it in place.
Telescope Altitude Axis Potentiometer Holder (2nd Image, consists of 3 pieces)
The Skywatcher telescope I bought came with a tensioning knob. You loosen this to adjust the inclination of the telescope tube, then tighten it off to stop it sagging freely. I replaced this with a 3D printed one, which accepts the shaft of a potentiometer on the other end. The body of the potentiometer is then held by a cup shape attached to a stem which sits on the shoulder of the telescope mount. The purpose of this is to rotate the shaft of the potentiometer relative to the body of the potentiometer as the telescope tilts (allowing us to measure its angle).
Telescope Azimuth Axis Potentiometer Holder (3rd Image, consists of 4 pieces)
Similarly, this assembly is used to mate a potentiometer to the rotation of the telescope, relative to the telescope mount's base. The Skywatcher telescope I modified has a central bolt. I added the small printed part underneath to stop it rotating relative to the telescope baseplate. The pieces above mate the shaft of the potentiometer to that bolt, and the body of the potentiometer to the upper surface of the telescope lower plate, thus meaning that when the mount is rotated, the shaft of the potentiometer will be rotated relative to it's body (allowing us to measure the heading of the telescope).
Battery Box Holder (4th Image, consists of 1 piece)
Simple part, used to mount the injection moulded battery box to the telescope mount. Has two small mounting holes so can be screwed directly onto the laminated plywood telescope mount.
Step 5: Just Keep Printing, Just Keep Printing
The .STP Files
I've attached the parts I designed for this project as STEP (or STP) files, as those are easily importable into the CAD software of your choice, and then modifiable (or directly exportable to STL files for 3D printing - which can also be done using a free online converter). If you're competent with CAD software, then feel free to incorporate any changes you'd like to make to the control box, or modify the other pieces to fit your telescope in case you're using a different one to me. I originally designed the parts using Autodesk Inventor (for which you can get a free license if you're a student).
I am lucky enough to own a printer, it's an ANET A6, similar to the popular A8, but with some extra features. If you're not into 3D printing yet, I'd highly recommend looking at acquiring a printer for yourself, there are many affordable models available. The A6 isn't the world's best printer, but if calibrated correctly and modified appropriately it can produce some perfectly fine results. High accuracy isn't that important for these parts, so I used a layer height of 0.2mm, and printed at 65mm/s. I chose white PLA filament because I'm familiar with PLA, and the white filament visually blended in with the white laminate of the telescope mount.
Step 6: The Control Box
The control box contains all the electronic components of this project, with the exception of the two potentiometers attached to the telescope mount, and the battery box, which is also attached directly to the telescope mount. The control box is attached to the telescope on a 0.5m long length of rubber tubing. Through the tube run the signal wires from the potentiometers, and power lines from the battery box. I found it tricky to encourage the wires along the narrow tube, so used a little bit of soapy water to lubricate the tube so that the wires could be slid through. I then washed it out and let it dry out thoroughly before continuing.
Fitting out the Control Box
You can see from the pictures above how I did this, although there's probably a neater way. To allow me to quickly modify things, I used a small solderless breadboard inside the control panel, although you could save a lot of space by soldering wires and components to a small piece of perforated copper stripboard or similar. The four LEDs are a push-fit into the plastic case front, and the other items are held in with a small amount of superglue.
Joining the two halves of the Control Box
You'll see from the .stp files for the control box that there's a recess to fit a hex nut in each of the four corners. By push-fitting the nuts into these holes and supergluing them there, it allows you to then pass a screw in through the other half of the control box, and tightly join the two halves, but also so that you can open it to alter wiring etc. Be sure to not over-tighten the screws, as you might dmage their plastic housings.
Step 7: Neat Cable Management
It's worth doing a better job than me at this! There's a lot of wiring inside the control box, and can get difficult to work with unless you're neat. The above diagram should answer any questions you have about the internal layout of the control box, as well as the previously shown block diagram of the system. I have not included specifics of the wiring for any of the units as there is nothing unusual, and for all of the components I have used such as the ADC and the LCD screen, there are a multitude of good wiring instructions online, many of them on Instructables.
Step 8: The Arduino Program
Here's the Arduino program needed for the telescope. Upload this to the Arduino MEGA, making sure that your connections match the pin attachments made in the program. If you want to increase the number of astronomical objects in the object database, increase the number of objects 'n' and add your entries below, obeying the same format. The program is lightly annotated for clarity. Don't forget, you need to install the five libraries called for at the start of the program in order for this to work!
Step 9: Testing, Testing
Test everything individually!
A bad jumper lead, a poor solder joint, an incorrect polarity here and you might run into difficulty. That's why it's very important (like any amateur electronics project) to test things as you go along. That way it's easy to work out where the errors are emerging (if they do), so that you can more easily solve them. Imagine trying to debug the whole system at once, that would be very frustrating. The good thing is that everything can be checked by itself before the system is combined. Here are some useful things to check as you go through the build, which might be able to save you a lot of hassle later on:
- After soldering header pins onto the LCD screen and connecting it to the Arduino MEGA, check that the display works by running an example LCD program. I managed to damage my first LCD by incorrect wiring which burnt it out, so check you haven't done the same.
- The GPS module works and receives data. Use one of the sample programs from the TinyGPS library, and connect the GPS to the MEGA or any spare Arduino you have handy. Note that you are unlikely to acquire a signal whilst indoors, so it would be worth taking this outside when checking that it works (after all that's where you'll be using your telescope)!
- Potentiometers. Again, there is scope to damage them with excessive heat during soldering, and also to make mistakes with the wiring. Make sure you're seeing a good linear output from them by hooking them up to an Arduino.
- The program - as this program works for me, you shouldn't have to do this (unless of course you are modifying the project), but don't forget you can use the characters /* before and */ after to block out a segment of code, in order to run only specific portion. Also normal Arduino debugging of printing variables to the Serial Monitor, and running your program with the Arduino attached to your PC via a USB cable so that you can see how variables are behaving at different points in the code.
- Switches - always worth taking a multimeter to these to check that the operation of them is as expected.
Verifying the function of the alignment system
Stellarium is an excellent freeware program which can show you the night sky from any position on Earth at any time of day. You can use this to get the Azimuth and Elevation of a particular astronomical object to compare it to the Arduino-calculated value. Take your laptop outside to help you learn about the position of objects in the night sky, although the screen is bad for night vision, there's a 'night mode' button which makes the entire display red. There are also a large number of apps for tablets and smartphones, but none are quite as good as Stellarium. Be aware that the method Stellarium uses to calculate the Az and Alt of objects is slighlty different to the one we use in this project, so expect the results to be ever so slightly different.
Step 10: The Sky at Night
If everything has gone to plan, the Arduino star-finder should now be ready to use!
How to operate the device:
- Turn device on using the illuminated rocker switch on the control box, and this should light up.
- After a quick welcome message on the LCD screen (pictured), there will now be a brief waiting period as the GPS module acquires a signal (you will get a message saying *NO GPS SIGNAL*) , but this should be no more than a couple of minutes (assuming you are outside!).
- Following this you will be prompted to "ALIGN ON POLARIS AND PRESS BUTTON". This is how the star-finder is calibrated. Polaris was chosen as it's one of the easiest stars to find in the night sky (northern hemisphere). Make sure that Polaris is visible in the centre of the telescope view-finder, the press the central momentary pushbutton, and the LCD screen will flash "COMPLETE". Now the Arduino knows to associate those potentiometer readings with that Azimuth (heading) and Altitude (inclination).
- After this stage you will now see the details of the first item in the astronomical object database. The LCD displays the name, type, and azimuth and altitude of the selected object. Using the rocker switch, flick through the object list until you find one you wish to observe. Objects with a negative altitude will have a message against their name of "IS BELOW HORIZON".
- For any particular object, the four LEDs on the control panel (beneath the LCD screen, arranged in a cross-shape) will illuminate to show whether the telescope needs to be panned down, up, left or to the right in order to be aligned with the target object. Move the telescope now, following these LEDs until all four are iluminated, which shows that the telescope is on target.
- Now you're ready to do some stargazing! Look through the telescope eyepiece lens and you should see your chosen sight.
Step 11: P.S.
There are some things I'd like to do differently if I had the chance to do this project again. Maybe you'll adopt some of these ideas when you do your version of this project?
- Adapting for use in the Southern Hemisphere. Polaris (used by the star-finder for calibration after being turned-on) isn't visible in the Southern Hemisphere, so you'll need to change this to one that is.
- Weatherproofing. Although you wouldn't use a telescope in the rain, at night you get a lot of condensation and moisture building up, so next time I would design the cases to fit a waterproof seal, to help protect the electronics.
- Build a larger database of astronomical objects, to expand on the 45 that I've used.
- Update the way that the object data is presented. It might be better to only list the objects that are currently visible, instead of needing to scroll through the whole library to find the ones that are.
- Adjustable feet and a bubble level inbuilt into the base of the mount. This would help you ensure that the base of the telescope is always level, helping with the accuracy of the alignment system.
The above picture of the moon was taken using my phone camera through this 130mm Dobsonian telescope, whereas the picture of Whirlpool Galaxy M51a was taken by me using the 6" Bradford Robotic Telescope.
Grand Prize in the