Table of Contents
- 1 Introduction
- 2 Solar Photography
- 3 Telescopes
- 4 Bits and Pieces
- 5 Putting it Together
- 6 Finishing & Testing the Pi Solar Camera
- 7 Conclusion
Here comes the Sun! And we will take pictures of it using a Raspberry Pi HQ Camera. Welcome to the magical world of Astronomy with the Raspberry Pi!
Introduction
On April 8, 2024, a total solar eclipse will be visible to residents of a band stretching from Mexico to Canada.Ā Iām thrilled to report that the DroneBot Workshop is (barely) inside that band, so Iām getting prepared to witness the spectacle of a lifetime.
Unless, of course, it rains (or snows).
But even if it does (and I really hope it doesnāt), solar photography is a fascinating hobby that can really help you gain an appreciation for the most important star in the universe.Ā
This project will introduce you to astronomy with the Raspberry Pi. We will connect a Raspberry Pi HQ Camera to a solar telescope, and the instructions presented here will work with any telescope. So you can expand your view of the universe.
Solar Photography
Taking pictures of the sun is an art form (if you can call it that) that stretches back to the invention of photography itself. Early photos relied upon very bright lights, and the Sun is just about the brightest light around.Ā
Solar photography differs from other astrophotography in that instead of trying to gather as much light as possible; you filter it down to a level you can work with. The amount of light from the Sun overwhelms most camera sensors and photographic plates.Ā Ā Ā
Observing the Sun directly is dangerous, and magnifying it is even worse. Exposing your eyes to just 40 seconds of direct sunlight can cause PERMANENT blindness, and this effect is cumulative. So, two 20-second exposures equals 40 seconds!Ā
Any direct observation of the sun requires taking the proper precautions.
Sun Filters
A certified Sun Filter is a required component for directly observing the Sun.Ā This filter is installed in the front of the camera or telescope and will filter over 99.9% of the light it receives.
You can buy solar filters in the same sizes as other camera and telescope filters. Ensure you are getting a certified solar filter; they are not the same as ND filters or polarized filters.
They are also not intended for direct viewing, like the ones used in certified solar viewing glasses.Ā Although the two filters perform essentially the same function, they are made of different materials and are not interchangeable.
You can also purchase a sheet of filter material to construct a filter for a telescope or camera without a premade one.
Zoom and Telephoto Lenses
If you place a solar filter in front of your standard camera or smartphone and take a picture of the Sun, you probably wonāt be impressed. Without magnification, the Sun appears as a small round dot.
A zoom lens can assist, but the results are not exactly breathtaking, even with a zoom. Here is a sample I took with a solar filter in front of the kit zoom lens provided with my Canon T5i DSLR:
Here is the same camera with an 800mm telephoto lens:
As you can see, the second photograph has a lot more detail. You can make out a large cluster of sunspots on the right and a small sunspot on the left.
Telescopes
Of course, if you really want to get a close look at our nearest star, youāll need a telescope.
For this project, we will use a specialized solar telescope, which is just a small refractor with a permanently fitted solar filter.
Telescopes come in a variety of configurations, but they are all based on two basic types:
- Refractors
- Reflectors
No matter what type, a telescope is an instrument that gathers light. We can then magnify the light for direct observation using an eyepiece or use it with a camera.
Refractors
A refractor uses a primary lens to gather light. The wider the lens is, the more light it can gather.Ā Ā
The light from the primary lens is focused upon an eyepiece. The eyepiece itself is composed of one or more lenses; its purpose is to collect and magnify the light.
Refractors were the first telescopes dating back to the 17th century. Although there is some debate, most historians credit Hans Lippershey, an optician from the Netherlands, with inventing the refractor.
The refractor was refined and made popular by Galileo Galilei, who famously used it to discover Jupiter’s four largest moons.Ā Itās still very popular, especially with inexpensive and portable scopes.Ā Large refractors are expensive and uncommon, as reflectors offer better cost-performance with larger telescopes.
Reflectors
Reflectors are also called Newtonian telescopes in honor of their inventor, Isaac Newton.Ā
Reflectors use a concave mirror instead of a lens to gather light. That light is focused onto a prism or flat metro, which directs it up a tube to an eyepiece.
Mirrors are less expensive and easier to manufacture than lenses and donāt distort the light as much. So, most large telescopes are reflectors or a variant of the reflector, such as the Dobsonian.Ā They offer more value than refractors but are more difficult for beginners to use.
Bits and Pieces
Our Raspberry Pi Solar Camera will consist of the following components:
- A Raspberry Pi board with Ethernet – Model 3B, 4B, or 5B
- A Celestron EclipSmart Solar Telescope – Any telescope with a certified solar filter can be used.
- A Raspberry Pi HQ Camera
- A C-Mount to 1-1/2inch telescope mount (check your scope for eyepiece size)
- Camera cable, case, power supply, heatsinks etc.
Raspberry Pi Board
Obviously, you will need a Raspberry Pi board, and it doesnāt have to be the latest model. But it should have an Ethernet connector, so a Zero W board wonāt make the cut.
The reason for specifying Ethernet is to get a good video stream with a reasonable bandwidth from the board. Even the Pi 3’s 100 MBps limit is better than most 2.4 GHz Wi-Fi connections. But you can use Wi-Fi if it is your only option; just be aware of its limitations.
There is also an issue with some of the software you may run, which makes a Pi4 easier to use than a new Pi 5.Ā So, Iām using a Raspberry Pi 4B for my solar camera.
Celestron EclipSmart Solar TelescopeĀ
The optics for the project are simple, as I used a Celestron EclipSmart Solar-Safe Telescope. This is admittedly the easy way out, but the low price of this unit made it a simple choice.
This is a refractor telescope with a built-in solar filter and a 90-degree prism to facilitate viewing.
The telescope also comes with a reasonable-quality eyepiece. We will replace the eyepiece with our camera but keep it to use when we align the telescope with the Sun. The scope has a convenient solar viewfinder to make this task easier.
The scope also comes with a carrying case and a completely useless tripod. Fortunately, the telescope uses a standard Ā¼-inch thread mount so that any photography tripod will work.
You can also use any telescope for this project. Youāll have to add a solar filter to the front of the scope, they are available to fit most telescope sizes.Ā You can use a refractor or reflector.
Raspberry Pi HQ Camera
We have already looked at the Raspberry Pi HQ Camera in the workshop. As its name would imply, itās a higher-quality camera based on the Sony IMX477 sensor.
The camera itself is not sold with a lens. We actually don’t require a lens for our project, but it will come in very handy when we test everything before assembly, so I recommend getting one.
The HQ Camera uses a C-Mount lens system, a standard used in the security and instrumentation industries.Ā Many C-mount lenses reflect their specialized applications; however, Raspberry Pi offers a selection of lenses for a reasonable price.
C-Mount to 1-Ā¼ inch Barrel Adapter
This simple threaded tube is the key to making our project work.
Most telescopes, including the solar scope used in this project, use a standard 1-Ā¼ inch diameter barrel. This lets you buy eyepieces with different focal lengths, knowing they will fit your scope.
The Raspberry Pi HQ Camera has a C-Mount thread for lenses. Instead of a lens, we will be using this threaded tube and inserting it in place of the eyepiece.
Other Bite & Pieces
Aside from the above, you’ll need a few more parts to complete your project:
- A fast microSD card with a large enough capacity for holding images and the operating system. I suggest a 64 GB or higher card from a reputable manufacturer.
- A heatsink for the Raspberry Pi. Youāll be streaming video, which puts quite a load on the Pi.
- A camera ribbon cable. Try to get the longest one you can find; I used the 500mm one.
- A Power supply for the Raspberry Pi. If you are fortunate enough to have AC where you will be observing the Sun, you can use a standard Pi power supply. Otherwise, a USB power bank is a good choice.
- An enclosure for everything. It will need to protect the Pi from the environment in which you are using it.
- A good network connection. Ideally, this will be Ethernet as it has superior performance and reliability over Wi-fi. If you must use Wi-Fi, consider your choice of heatsink, as some designs will degrade the radio signal.
You will also find a keyboard, mouse, and monitor to be handy for setting this up. Once the Pi has been configured, it will run in āheadlessā mode, and you wonāt need these.
Putting it Together
Now that you have gathered all of your parts together, itās time to assemble the Pi Solar Camera.
Installing the Camera
Cleanliness is essential when working with the camera and telescope. A photographer’s dust blower is a good tool to have on hand when assembling parts, as we donāt want dust to collect in the telescope prism or on the camera lens.
Installation of the camera is very simple:
- Remove any protective caps from the camera.
- Screw the Barrel Adapter into the camera, being careful not to cross-thread it.
- Remove the eyepiece or cover from the telescope barrel.
- Insert the camera-adapter assembly in place of the eyepiece.
- Tighten the mounting screw.
Itās as easy as that!
Raspberry Pi Assembly
The exact assembly instructions for the Raspberry Pi depend upon your selection of a case and heatsink.
In my build, I used a Pimoroni Heatsink Case for the Pi 4. While I could have used it on its own, I decided to place everything in a plastic utility box. I threaded some holes in the bottom plate to hold the heatsink case in the utility box.
I also added a Ā¼-inch threaded photo adapter to the case, and to this, I attached a mini photo clamp (one thing about making videos is that I tend to collect a lot of this stuff!).Ā This will allow me to clamp the Raspberry Pi assembly to the telescope tripod.
Otherwise, completing the project is as simple as attaching the camera ribbon cable to the Raspberry Pi and the HQ Camera. You should hold off on doing that until you test the camera and install the software on the Pi.
Raspberry Pi Operating System
Youāll need to install the latest version of the Raspberry Pi operating system on the microSD card. This is pretty simple using the Raspberry Pi Imager application, which is available for Linux, macOS, and Windows.
Insert the microSD into the computer on which youāll be running the Imager. Ignore any operating system messages about formatting or opening the memory card.
Now open the Imager and press the button to select a board. Select the board that matches yours; in my case, it is a Raspberry Pi 4 board.
Next, select an operating system. Base your choice upon the following:
- If you are using a Raspberry Pi 5 board, you have only one choice (as of this writing): Install the latest operating system, Bookworm OS.
- If you are running the Picamera2 Web UI program (described further) with any board, then select the latest operating system.
- If you run a Pi 4 board and want to use it as an ASCOM server (described later), you can run an older legacy OS. This will make installing the software much more manageable.
After you have made your OS selection, choose the device to burn the image to. Make sure you select the correct device!
Finally, burn the OS. Youāll get the choice of entering your Wi-Fi and locale information before burning; itās a good idea to do this. After confirming your information, the Imager will write to the microSD. The imager will also verify the integrity of the burn after writing is completed.
After verification finishes, the microSD can be removed from your computer and inserted into the Raspberry Pi board.
Testing the installation
Itās a good idea to test everything before you put the lid on the enclosure and hook up the telescope camera.
If you are using a solar telescope (as I am), you should remove the camera from the scope and attach a compatible lens to it, as it will be much easier to test. If you use a regular telescope, you can test in the scope; just remove your solar filter during testing.
You can test the camera using the Terminal. Open it up, and type the folowing:
1 |
rpicam-hello -t 0 |
You should see the camera information displayed, after which a view window will open. The window will stay open until you close it, allowing you to adjust the focus and other aspects of the picture.
Once you confirm that the camera is working, we can install some software to stream its image. Then, we can put it back on the telescope.
Image Software
We will require some software to run on the Pi and to stream video from the HQ camera.Ā There are several choices.
The correct software to use depends upon your unintended use, and it boils down to this:
- If you plan on using professional software like SharpCap, FireCapture, AllSky, etc., you are best off installing RPI Cam ASCOM Alpaca. It was written for the HQ Camera, and it will communicate directly with these programs.
- If you only want to take pictures of the Sun and stream video, I suggest using Picamera2 Web UI Lite. Itās easy to use and gives you full control of all the HQ camera parameters.Ā
Another popular choice is Astroberry. Unlike the other two choices, Astroberry runs on the Pi Desktop. The other software can run in headless mode, which is more suitable for our application.
Astroberry Server
It may seem odd to begin a list of applications with one we will NOT be using, but Astroberry deserves honorable mention.Ā If you are serious about using a Pi for astronomy, then itās something you will want to know more about.
Astroberry Server is not an application; instead, it is an entire suite of open-source astronomy applications. While it can be installed on an existing Raspberry Pi, it is much easier to grab an image file. You can burn the image to a microSD card and boot up your Raspberry Pi with it.
Unfortunately, the capture utility included with Astroberry (OA Capture) does not work correctly with the Raspberry Pi HQ Camera. It āseesā the camera but wonāt grab an image from it.
You can use Astroberry with a different camera, such as an eyepiece USB camera. You will then have access to a wealth of astronomy applications, ranging from positioning and focusing software to sky charts and image processing utilities.
RPi-ASCOM-Alpaca
If you want to use professional astronomy applications like SharpCap, then this next piece of software may be what you are looking for,
The ASCOM Protocol is a standard for exchanging information between controllers and astronomical devices such as telescope cameras, focusing mechanisms, and positioners. A number of applications can use this protocol to share data. You can build a sophisticated observatory or just control one telescope using the ASCOM protocol,
By running the RPi-ASCOM-Alpaca application on the Raspberry Pi, you can have your Pi HQ Camera appear as an ASCOM capture device. This software was written specifically for the HQ Camera.
Installing Rpicam-ASCOM-Alpaca on the Raspberry Pi
Note that these instructions require a legacy version of the operating system. You cannot use the PIP command directly in Bookworm.
Start your installation by opening the Pi browser. Go to the GitHub page for the Rpicam-ASCOM-Alpaca driver.
Download the ZIP file and extract it in your Home folder. It will create a folder called rpicam-ascom-alpaca-master.Ā
Open a Terminal and navigate to that folder (you can also open File Manager, move to that folder, and press F4 to open that folder in a Terminal).Ā
Type the following lines:
1 2 3 |
pip3 install falcon toml orjson apt-get install python3-picamera2 python3-lxml python3-astropy |
When that is finished, type the following to run the program:
1 |
python app.py |
You can now go to another workstation and test the installation. I downloaded the free version of SharpCap and ran it on Windows 11. It automatically saw the Raspberry Pi on its list of network cameras, and it displayed the image.
This is an excellent way of streaming video, especially if you already have other ASCOM devices and software. But itās a bit complex for the average person.
As I am more of an āaverage person,ā I will use something simpler.
Picamera2 Web UI Lite
I have chosen this application for the Raspberry Pi Solar Camera. It is easy to install and has all the features we need for viewing and recording images. It is called Picamera2 Web UI Lite and is essentially a web-based user interface for the Picamera2 camera utility.Ā Ā
This excellent application was written by James Mitchell in Berlin.
Donāt let the āLiteā part of the name fool you. This full-featured software allows you to adjust every parameter on the HQ Camera. It has an attractive web interface and can stream video directly to a web browser or capture utilities like VLC.
I have tested Picamera2 Web UI Lite on both a models 4 and 5, and it runs perfectly on both boards. I am running it using Bookworm.
Installing and Running Picamera2 Web UI Lite
Installation of the software is easy. I have prepared a cheat sheet you can use. Itās a text file with all the commands you need to type in the terminal. I suggest you download it and place the text file on a USB thumb drive. You can use it on your Raspberry Pi while the Terminal is open. Copy and paste your installation!
We start by getting the actual files for the application:
1 |
wget https://github.com/monkeymademe/picamera2-WebUI-Lite/archive/refs/heads/main.zip |
After they are downloaded, we unzip them:
1 |
unzip main.zip |
The unzip process will create a new file folder. We need to move to this folder.
1 |
cd picamera2-WebUI-Lite-main |
Finally, we can run the Python application:
1 |
python app.py |
You should see an information screen that ends with an IP address. This will be the Raspberry Pi IP address, followed by ā:8080,ā which means port 8080. Make note of this address.
Testing Picamera2 Web UI Lite
Go to any computer on the same network as the Raspberry Pi and open a web browser. Type in the address you noted at the end of the installation. Ignore any security warnings. The site is HTTP and not HTTPS, so you will get these, but they are of no concern.
You should see the Picamera2 Web UI Lite screen, streaming the image your Raspberry Pi HQ Camera is focused upon.
The interface is very simple yet very full-featured. Below the image, there is a button to take a picture, which will be added to the image gallery.
On the side, several buttons expose and hide a wide range of controls. You can adjust almost every camera parameter here and can even crop images.
The tabs at the top of the screen open other features. The first is an image gallery, where you can view, download, or delete the images you have saved.
The next screen gives the camera details. On the HQ Camera, it also provides a selection of modes, you can experiment with these to try and get better images.
The final tab gives you information about this excellent software.
Running Software at Boot-up
Since you wish to run the Raspberry Pi in headless mode, you will want it to automatically run your application every time it starts.Ā Ā
We can accomplish this by editing the rc.local file in the etc folder. Any entry at the end of the file will be executed every time the user logs in, which happens at the end of startup.
I used two files to do this with Picamera2 Web UI Lite; you can use a similar technique with RPi-ASCOM-Alpaca.
- startweb.sh – This is a Bash file I wrote to launch the application.Ā
- rc.local – This fill will be modified to run startweb.sh
You can create startweb.sh with the text editor (or just copy my file from the Cheat Sheet download). You can also use the nano text editor at the command line. Here is the file contents:
1 2 3 4 5 6 7 8 |
#!/bin/bash cd /home/dronebotworkshop/picamera2-WebUI-Lite-main python app.py |
Of course, you need to replace ādronebotworkshopā with the name of your home folder!
Save the file in a convenient spot; your user folder is fine.Ā
Ā Wherever you save it, you will need to make it executable, so open your Terminal and navigate to that folder (if you used the user folder, you are already in the right place). Type the following to make it executable:
1 |
sudo chmod +x startweb.sh |
Press enter; there is no feedback. The file can now be run to launch the app.
Next, edit the rc.local file in the etc folder to run this file on every start-up.Ā While still in the Terminal, type the following:
1 |
sudo nano /etc/rc.local |
The Nano editor will open. Navigate to the bottom and add the following line just before the line reading āexit 0ā:
1 |
/home/dronebotworkshop/startweb.sh & |
Once again, you need to edit that with your own user name. Save the file and exit Nano.
Now, the application should run automatically every time you launch the Pi. Test it to be sure it works before finishing the solar camera build.
Finishing & Testing the Pi Solar Camera
Now that the software is installed and running on startup, you should be ready to remove the test lens and attach the camera to the telescope again.
Assemble everything in your intended observing location. It will be handy to have a computer nearby to monitor the stream so that you can make adjustments. As with any stream, there is a short delay in the transmission, so keep this in mind when you adjust the image.
Finding the Sun
Yes, itās that bright thing up in the sky. But aiming a telescope directly at it is trickier than you might suspect.
A set of ISO-certified solar glasses is very handy, as you will inevitably look at the Sun while you are setting up.Ā Ā
Use the eyepiece to see the sun. Note that the eyepiece’s focal point is completely different from that of the HQ Camera. I found the camera focused when quite close to the scope body while the eyepiece was further away.Ā
If you use the same solar scope I used, try using the solar finder. It takes practice, but once you have the hang of it, you can zero in on the Sun pretty quickly.
With practice, you wonāt need the eyepiece to find the Sun.Ā
Take and Save some Images
And finally, let’s use the solar scope.
A good tripod or other mount is key to making this work correctly. If possible, try to keep out of the wind. If you can photograph the sun indoors with an open window, that is ideal. That is what Iām doing, and it has the added advantage of electricity and Ethernet!
And here is an image I took, literally the third one. I don’t know about the red color; I will try the camera settings, and I could also remove the IR screen from the camera (Raspberry Pi has instructions for doing this).
Here is the same image, with the color enhanced to correct the red color. As you can see, there are even a few visible sunspots!
Conclusion
Astronomy is a fascinating hobby, one that can quickly become a lifelong obsession. I know that personally; Iāve been hooked on astronomy since I was five years old.
Whether you use the Raspberry Pi to photograph the Sun or use it with a conventional telescope to take images of planets, this is a really rewarding project.
If you are on the path of an eclipse, such as the one that is heading my way on April 8th, then the Pi Solar Camera could take some memorable images.
So get your Pi in the sky, and go out and examine our nearest star – the Sun!
Parts List
Here are some components you might need to complete the experiments in this article. Please note that some of these links may be affiliate links, and the DroneBot Workshop may receive a commission on your purchases. This does not increase the cost to you and is a method of supporting this ad-free website.
Celestron EclipSmart Solar ScopeĀ ————– Amazon
SVBONY C Mount to 1.25″ AdapterĀ ———– Amazon
Resources
Cheat Sheets – All the commands you need to type in. Text files packaged in one easy-to-use ZIP file!
Article PDF – A PDF version of this article in a ZIP file.
Astroberry Image – The Astroberry download page. Note that they have a slow server; you may want to use the alternate link which is a Google Drive page.
Rpicam-ASCOM-Alpaca – GitHub page for ASCOM driver for Raspberry PI HQ Camera.
SharpCap Download – Download the free version of SharpCap for Windows.
Couldn’t the webapp be accessed using localhost? This might reduce the latency and in full screen mode, displayed via HDMI directly to a streaming device.
A total eclipse is a life changing moment for many. The most incredible experience I ever had.
Bill,
The “Article PDF” link is missing again!
Bob