Smartphone controlled telescope
Tomáš Cyprian

Abstract

This project focuses on developing a system that allows users to control a telescope through their smartphone, with the aim of improving and expanding the user’s capabilities. This topic personally interests me because I am an astronomy enthusiast and I saw an opportunity to delve deeper into my area of interest.In creating this project, I used several tools and programming languages. On the software side, I worked with Android Studio for mobile app development, Arduino IDE for programming the telescope’s control unit, and Autodesk Fusion 360 for designing the mechanical parts of the project. Programming the project required the use of programming languages such as C++, Kotlin, and Python, which allowed for efficient handling of various aspects of this complex task.The goal of this project was to create a user-friendly interface for controlling a telescope through a smartphone, significantly increasing comfort, mobility, and accuracy when observing stars and planets. In this way, I wanted to contribute to improving the experience of astronomers and astronomy enthusiasts.

Goals

-Calculation of positions of the planets
-application, for GUI
-microcontroller software
-Bluetooth low energy connection
-Electronic hardware, and circuits
-Parts manufacturing

Calculation of object positions

This code defines a function planet_coordinate that takes four parameters: planet_name, lati, long, and elev.The function creates an observer object using the ephem.Observer() class, and sets the latitude, longitude, and elevation based on the input parameters. It then converts the current date and time to a datetime object using the datetime.now() function and datetime.strptime() method.Next, the observer's date and time are set using the converted datetime object. The planet_name parameter is capitalized and used to create a planet object using the getattr() function. The planet's position is computed using the planet.compute() method, and the altitude and azimuth are calculated using the formulas provided.If an exception occurs during the creation of the planet object or the computation of its position, the code falls back to treating the planet_name as a star and performs the same calculations.Finally, the function returns the calculated altitude, azimuth, and magnitude (if available) of the planet or star.

User GUI

1 - Users have the flexibility to manually input their desired object for the telescope to concentrate on and track.

2 - The three textboxes serve as a configuration tool for the telescope. Users can align the telescope with a specific object in the sky, such as a distant star, and then press the "Focused" button. The application will then calculate the telescope's current direction, allowing users to easily focus the telescope onto one of three pre-set objects. This ensures minimal deviations, as the application automatically calculates the average of all deviations.

3 - The arrows provide manual control over the telescope's configuration. The right-hand textbox displays the angle at which the telescope will move with each press of an arrow.

4 - The "Connect" button establishes a connection between the smartphone and the telescope. The text below dynamically displays the connection status of the Bluetooth Low Energy connection between the two devices.

The application will continue to function seamlessly, even when the mobile device's display is turned off. This means that the telescope will operate flawlessly, allowing you to use it even when you are not actively using the application.

Telescope's micro controller

The telescope employs the ESP32 microcontroller as its central control system for the stepper motors. This remarkable microcontroller seamlessly executes a well-crafted code that enables Bluetooth Low Energy capabilities.

The code leverages essential libraries such as BLEDevice.h, BLEServer.h, and BLEUtils.h, along with the string library for efficient data parsing.

An important function within the code is the "onWrite" function, which comes into play when the ESP32 receives data from a connected smartphone. By skillfully parsing the received string, the "onWrite" function extracts critical information like elevation and azimuth. These values serve as the foundation for precise calculations, determining the necessary number of steps the stepper motors must take to align with desired celestial objects. To maintain accuracy, any remaining calculation residue is stored and subsequently incorporated into newly received data, reducing potential deviations.

The culmination of this intricate code is the execution of the "turn" function. This vital function orchestrates the calculated number of steps and directs the precise movement of the stepper motors. Each motor receives precise instructions, ensuring the telescope maintains unwavering focus on its intended targets.

Electronic hardware and circuits

This circuit is composed of the following components:
Two L298N H-bridges
Two Nema17 stepper motors
One ESP32 WROOM
microcontroller
One 2A fuse
One 12V, 1.3Ah battery

In this setup, the ESP32 microcontroller sends signals to the L298N H-bridges, which in turn control the current flow into the coils inside the stepper motors. The entire system is powered by the 12V battery.

Conclusion

On this project, there are still a few things that need to be completed, but it is fully functional. Everything went according to plan, although some problems did arise here and there. Overall, the project exceeded my expectations and achieved all of its goals.

Resources

https://rhodesmill.org/pyephem/
https://developer.android.com/guide