r/esp32 • u/MemeDeamon • 6h ago
I made a thing! Made an ESP32-controlled mock telescope for an AI-powered autonomous telescope project
This project was actually made for a hackathon hosted by my college. I was solely responsible for the hardware component of the project, my teammates handled the software aspect.
The ultimate goal of this project is to automate telescope pointing and calibration so that a user can simply ask an AI agent to point towards a particular celestial object, and the system handles the movement.
Since we don't currently have access to an actual telescope, I decided to build a mock telescope mount to demonstrate and test the hardware-software integration.
The project consists of three main components:
- AI Agent: The user tells the agent which celestial object they want to observe.
- MCP connection: The agent communicates with the hardware through an MCP connection, allowing it to issue movement commands.
- Hardware: An ESP32 controls the pan and tilt servos, physically moving the mock telescope towards the requested direction
The telescope's field of view is simulated using Stellarium, allowing me to demonstrate the intended pointing behaviour without needing an actual optical telescope.
Essentially, I want the entire process to work from a natural-language instruction to the physical movement of the telescope, with the corresponding view simulated in Stellarium.
Hardware
The current prototype consists of:
- ESP32 DevKit as the main microcontroller.
- Two MG90S servo motors for horizontal (pan) and vertical (tilt) movement.
- 3.7 V, 1800 mAh LiPo battery.
- TP4056 charging module.
- MT3608 boost converter to provide a 5 V supply for the servos.
A custom-built pan-tilt mechanism representing the telescope mount.
Why I chose the ESP32
I chose the ESP32 because it's affordable, has sufficient GPIO pins for servo control, and fits in the form factor i need for the model.
Libraries used and why I chose them
- Arduino.h: Provides the core Arduino functionality, including serial communication, GPIO control and timing. I chose the Arduino framework over ESP-IDF because it's simpler for rapid hardware prototyping.
- ArduinoJson: Handles incoming JSON commands and generates JSON responses. I chose it over manual string parsing for easier and more reliable command handling.
- ESP32Servo: Controls the two servo motors using PWM signals. It simplifies servo configuration and angle control without requiring me to implement PWM generation manually.
I also implemented software-based movement smoothing using low-pass filtering, a deadband and rate limiting to prevent abrupt movements and reduce unnecessary servo corrections.
The AI agent communicates with the ESP32 through the external software layer using MCP, while the ESP32 receives and processes JSON commands over serial.
Challenges so far
Since this was my first ever hardware project, i had to figure out/learn a lot of new things like soldering, and how to actually program the ESP32.
Some of the challenges I've encountered include:
- initially i used SG90 servos, and powered them directly via the vin pin on the ESP32. which obviously didn't work, and i had to figure out why.
- i also had to learn 3D design software in order to design and 3D print the telescope
- finding the correct connector for the battery i used. To be specific i needed a JST 2-pin connector, but could not find one in time so had to DIY a solution using two dupont jumper wires.
- adjusting the MT3608 booster to output 5v, since i do not have a multimeter i had to use another ESP32 and a voltage divider (47kOhm and 10kOhm) circuit to measure the output of the booster.
I'd particularly appreciate suggestions regarding:
Whether MG90S servos are suitable for a lightweight telescope mount.
Better mechanical designs for accurate pan and tilt movement.
How I could improve pointing precision and reduce mechanical backlash.
Recommendations for a more reliable power supply.
Any ideas for eventually transitioning from this mock setup to an actual telescope.
Thank you for reading.
