Download PDF Parts List View on YouTube Download Code

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:

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:

When that is finished, type the following to run the program:

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:

After they are downloaded, we unzip them:

The unzip process will create a new file folder. We need to move to this folder.

Finally, we can run the Python application:

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:

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:

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:

The Nano editor will open. Navigate to the bottom and add the following line just before the line reading “exit 0”:

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.

 

Raspberry Pi Solar Camera
Summary
Build a Raspberry Pi Solar Camera
Article Name
Build a Raspberry Pi Solar Camera
Description
Let's build a solar camera and take pictures of the Sun! We will use a Raspberry Pi HQ Camera with a Celestron EclipSmart Solar Telescope to stream video and images of the Sun. And if you don't want solar pictures you can use any regular telescope and enter the wonderful universe of Raspberry Pi Astrophotography!
Author
Publisher Name
DroneBot Workshop
Publisher Logo
Subscribe
Notify of

2 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Bryn
1 month ago

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.

Bob Vines
1 month ago

Bill,

The “Article PDF” link is missing again!

Bob