Main Menu

Secondary Menu

Raspberry Pi Meteor Station

The goal of this tutorial is for you to build a fully functioning meteor detection video camera which you will be able to use later on for meteor detection and observations. The materials used will be relatively cheap, and can be easily bought in your local tech store. All of the software used in this project is open source, and the project itself is open source.

You can find more info about the project on Hackaday and on Croatian Meteor Network's Github.

Step 1: Requirements and Materials

The materials used are:

Raspberry Pi 3 computer

Class 10 micro SD card, 32 GB of storage or higher

micro SD card adapter

5V power supply for the RPi with the maximum current of at least 2A

RPi case with a fan

Heatsinks

RTC (Real Time Clock) module - DS3231 RTC module

EasyCap (chipset UTV007) video digitizer (the other ones have issues on the RPi)

Sony Effio 673 CCTV camera and widefield lens (4mm or 6mm)

12V camera power supply

Security camera housing

Wiring and cables

OPTIONAL: HDMI to VGA adapter

Step 2: Setting Up the RPi - Materials

We will first start off with setting up the RPi itself. In order to do that, we will need the following materials:

Raspberry Pi 3

3 heat sinks

RPi plastic box with fan

RTC module

SD card

Step 3: Installing Raspbian

Now you will have to install Raspbian, RPi's OS on your micro SD card. You can get Raspbian Jessie (the OS image that works with this current camera setup) on this link: Downloading Raspbian

Also, you must have a micro SD card adapter to install the OS on the card.

In case your SD card isn't brand new, you will have to format the card before installing Raspbian. You can find the guide for installing Raspbian and formatting the SD card on this link: Installing Raspbian

Step 4: Heatsinks & SD Card

We begin by gluing the heat sinks to the CPU and GPU of the board, as well as the back of the GPU. First you have to peel off the blue cover under which is a sticky surface that attaches to the aforementioned units. The peeling-off part can be a little bit tricky, but you can use any sharp object to remove the cover with relative ease.

After that you have to put the SD card you installed Raspbian on in the SD card port on your RPi (for the location of the SD card port, see Step 6.)

Step 5: Assembling the Box and the Fan

After that you can move on to assembling the box your RPi will be in. The box is made of plastic, and is again covered in a foil that comes off easily. We suggest that you start assembling the box from the sides of your RPi board, as then you can easily identify which side is which and how exactly the box must be put together by recognizing the port slots on the sides. Then you will attach the bottom of the box. Make sure that the hole on the bottom side aligns with the GPU.

After that you can attach the top side of the box. The smaller 'legs' which come out on the both sides of the top side must be aligned with small holes on each side of the box. In this point you absolutely must make sure that the top part of the box is over the GPIO pins array. Moving on, you can now attach the RTC module. It can be attached to the first four GPIO pins looking towards the center of the board, as seen in picture. Now finish the job of setting up the hardware of your RPi by just attaching the fan to the top side of the board. The role of the fan, same as of the heat sinks, is to enable optimal cooling and performance of your RPi when it is under a heavy computational load. You will first screw the fan into place by using a small cross screw, with the screws and the fan logo pointing towards the inside of the box. Then the fan cable must be connected to GPIO pins 2 and 3, looking towards the outside of the box. If some of the screws seem to be interfering with the board itself and/or do not allow the box to be fully closed, you can, of course, screw some of them on so that they point towards the outside of the box. If the fan doesn't seem to work, try reconnecting the fan cable to the pins or even soldering the loose cable to the fan.

Step 6: Connecting the Peripherals

In this part of the process, you will turn your RPi board into a usable computer.

For this you will need:

OPTIONAL: HDMI to VGA cable

mouse

keyboard

Monitor

Monitor and RPi power cables

You will begin with connecting the monitor to your RPi. The video port that RPi uses is HDMI so if you don't have a HDMI cable or monitor (for instance if you have an VGA cable), you must buy a HDMI TO VGA adapter. The HDMI port is located on one of the sides of the RPi single board computer. After that you can connect your keyboard and mouse to the RPi via the USB ports. After setting up your basic input and output devices, you can plug your RPi in a power source by using the adapter and cable that came with your board. It is important to note that the power of the electricity used to run the RPi must be at least 2.5 A.

Step 7: Hardware Setup of the Camera

In this step you will make a hardware setup of your camera and connect it to RPI.

For this you will need the following:

EasyCap ADC (analog-digital converter) - chipset UTV007

Sony Effio CCTV camera

Wiring and cables

The cable setup and configuration is generally up to you. Basically, you need to connect the camera to the power supply with some sort of power cable and the camera signal output to the camera. You can see our configuration on the images above. You will need to connect the camera signal cable to the yellow female cable of the EasyCap ADC. The other cables of the EasyCap will not be needed. Now you can connect your EasyCap to your RPi. Since you probably won't have enough room around the Pi's USB slots area, we suggest that you connect the ADC with a USB extension cable.

WARNING: EasyCap ADC with chipsets STK1160, Empia or Arcmicro will not work. The only chipset supported is UTV007.

Step 8: Testing the Camera

In order to test your configuration, you will have to check the signal transmitted to your RPi.

From now on, you will install all of the software using the terminal, which is a command line user interface. Since you will be using it very often, it is important to note that it can be opened via the keyboard shortcut: Crtl+Alt+T.

First install mplayer via the terminal using this command:

sudo apt-get install mplayer

This is a program for viewing the video from the camera.

Next, you will have to run mplayer. If you have a NTSC camera (North American standard), run this in the terminal:

If you are typing the commands manually in the Terminal, make sure that the correct character in the "driver=v4l2" part of the previous command is not a one ('1'), but a lowercase L letter ('l'). However, we strongly recommend just copying and pasting the commands using Ctrl+Shift+C for copying and Ctrl+Shift+V for pasting commands inside the Terminal. This makes the setup process much easier and much quicker.

If the camera is connected properly, you will see the video feed from the camera. If not, check the previous steps again and make sure you followed them correctly.

Step 9: Installing All the Necessary Software

Next you will have to install all the necessary software. First, run this:

sudo apt-get update

And upgrade all of the packages:

sudo apt-get upgrade

You can install all of the system libraries by using the following command:

Since the code used for detecting meteors is written in Python, you also have to install some Python 'modules' which are used in the code. First, start by installing pip (Pip Installs Packages) from the terminal:

sudo pip install -U pip setuptools

You also have to install and update the Numpy package first:

sudo pip install numpy
sudo pip --upgrade numpy

You will already have pip and Python on your RPi, but you have to upgrade to the latest version. Install all of the Python libraries with the following command:

Step 10: Setting Up the Timezone and RTC Module

Since accurate time plays an important role in meteor observation and detection, you must make sure your RPi keeps the correct time. First, set your timezone to UTC (a standard timezone among astronomers) using the following command:

sudo dpkg-reconfigure tzdata

This will open a GUI which will guide you through the process.Select 'None of the above' and then 'UTC' and exit.

Next, you will have to set up your RTC module to keep the time even your computer is turned off and offline. For setting up the module you will often be asked to somehow edit a file. Do it with:

sudo nano <file_name>

where you will replace with the actual file address. After you are done, press Crtl+O and Crtl+X.

Also, when you are required to 'comment out' a line of code, do it by placing a # sign on the start of the line in question.

Add the following lines at the end of /boot/config.txt:

dtparam=i2c_arm=on
dtoverlay=i2c-rtc,ds3231

Then reboot your RPi:

sudo reboot

After that remove the fake-hwclock module since you don't need it anymore:

Next, comment out the lines with -systz in the file /lib/udev/hwclock-set.

Now you have to set the current time by writing the current system time to RTC, and get rid of the redundant NTP daemon:

sudo hwclock -w
sudo apt-get remove ntp
sudo apt-get install ntpdate

More editing! Edit the /etc/rc.local file and add the hwclock command above the line that says exit 0:

sleep 1
hwclock -s
ntpdate-debian

Prevent the automatic setting of the clock to a different value by editing the /etc/default/hwclock file and changing the HWCLOCKACCESS parameter:

HWCLOCKACCESS=no

Now you have to disable the updating of the RTC system from the system clock, since we have already done that, by commenting out the following line in the file/lib/systemd/system/hwclock-save.service file:

ConditionFileIsExecutable=!/usr/sbin/ntpd

Enable the RTC clock by running:

sudo systemctl enable hwclock-save.service

For the RTC time to be updated every 15 minutes, you run this:

crontab -e

and select your favourite text editor.

And at the end of the file add the following line:

*/15 * * * * ntpdate-debian >/dev/null 2>&1

This will update the RTC clock time every 15 minutes via the Internet.

That is it! You're set! This was easy, wasn't it? All you have to do next is to reboot the computer:

sudo reboot

Step 11: Enabling the Watchdog Service

The RPi sometimes unexplicably hangs and freezes. The watchdog service essentially restarts the RPi automatically when its timer registers that the computer hasn't done anything in an arbitrary amount of time.

In order to enable the watchdog service completely, first install the watchdog package by running this in the terminal:

sudo apt-get install watchdog

Then load the service module manually:

sudo modprobe bcm2835_wdt

Add a .config file to automatically load the module and open it with nano editor:

sudo nano /etc/modules-load.d/bcm2835_wdt.conf

Then add this line to the file:

bcm2835_wdt

and then save the file with typing Ctrl+O and then Ctrl+X.

You also have to edit another file at /lib/systemd/system/watchdog.service by running this in the terminal:

sudo nano /lib/systemd/system/watchdog.service

Now add a line to the [Install] section:

[Install]
WantedBy=multi-user.target

Also, one thing that is left to be done is to configure the watchdog service itself. First open the .conf file in the terminal:

sudo nano /etc/watchdog.conf

and then uncomment [that is, remove the hashtag sign in front of it] the line that starts with #watchdog-device. Also uncomment the line that says #max-load-1 = 24.

All that is left is to enable and start the service:

sudo systemctl enable watchdog.service

And then:

sudo systemctl start watchdog.service

Step 12: Getting the Code

The code will have to be downloaded to /home/pi. In order to download the code there, enter the following in the terminal:

cd

You can obtain the code by opening the terminal and running:

git clone "https://github.com/CroatianMeteorNetwork/RMS.git"

Now, in order to compile the downloaded code and install all Python libraries, open the terminal and navigate to the folder where the code is cloned:

cd ~/RMS

And then run:

sudo python setup.py install

Step 13: Setting Up the Configuration File

One of the most important steps is setting up the configuration file. You will have to open the config file and edit it:

sudo nano /home/pi/RMS/.config

The setting-up process basically consists of several parts:

First off, you must set up your station ID, which is found under the [System] title. It has to be a 3 digit number. If your RPi belongs to an astronomical organisation, the station ID will be given to you from that organisation. If not, you can set the ID yourself. Next, you have to set the coordinates of the place where your camera is, including the height of the place of observation. The information regarding the coordinates of any place can be easily obtained via the 'GPS Coordinates' app on Android or the 'GPS Data – Coordinates, Elevation, Speed & Compass' app on iOS.

Next, you must set up the [Capture] part of the configuration file. You only need to change the settings of resolution for your camera and the FPS number (Frames Per Second).

If you have an NTSC camera (North America), you will have a screen resolution of 720 x 480, and your FPS will be 29.97.

If you have a PAL system camera (Europe), you will have a 720 x 576 screen resolution, and your FPS will be 25. You should fill in the data in the .config file according to these parameters.

After you are done with the configuration file setup, press Ctrl+O to save changes to the file and Crtl+X to exit.

Step 14: Setting Up the Camera

For the beginning of the camera setup, you will have to once again launch the mplayer that enables communication to the camera in the terminal.

Then the mplayer window will launch and you will see exactly what your camera is capturing. Now you have to do a manual setup of the camera. First you have to press the middle 'SET' button on the back of the camera, which will open a menu. You can navigate through it with the buttons around the SET button.

Next, you have to open the RMS/Guides/icx673_settings.txt file either via terminal, or on Github, and just copy the settings given in the file to your camera by navigating through the menu and changing the settings of the camera as described in here:

Step 15: Finally! Running the Software

If everything is OK with the setup, a completely white window should appear. Somewhere in the top of the window there will be a line that says 'Maxpixel'. If the window doesn't launch, or the capturing process doesn't start at all, go to 'Step 16: Troubleshooting'.

You are now ready for the start of capturing data and detecting meteors. All you have to do now is to run the code in the terminal:

python -m RMS.StartCapture

This will start capturing after sunset, and will stop capturing at dawn.

The data will be saved in /home/pi/RMS_data/CapturedFiles, and the files with the meteor detections will be saved /home/pi/RMS_data/ArchivedFiles.

All meteor detections for one night of detection will be stored in a *.tar.gz file in /home/pi/RMS_data/ArchivedFiles.

Step 16: Troubleshooting

GTK issue

Sometimes and on some devices, there appears to be no 'Maxpixel' window that should be rendered before the capture and that there is a warning in the RMS.StartCapture log:

(StartCapture.py:14244): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

You will have to install a package using apt-get:

sudo apt-get install pyqt4-dev-tools

In order to fix the error and start capturing, run:

python

And then:

>>> import matplotlib

>>> matplotlib.matplotlib_fname()

This will print out the location of the matplotlib python library configuration file, e.g.: /usr/local/lib/python2.7/dist-packages/matplotlib-2.0.2-py2.7-linux-armv7l.egg/matplotlib/mpl-data/matplotlibrc

Edit file with by using the nano editor:

sudo nano <file_location>

And when in the file, replace the line that says:

backend : gtk3agg

with this line:

backend : Qt4Agg

You also have to uncomment the line:

#backend.qt4 : PyQt4

Save the file and you are done!

Astropy installation has failed

If the astropy python module fails installing and the error message displayed says:

ImportError: No module named _build_utils.apple_accelerate

Then you probably need a newer version of numpy. So go ahead and upgrade numpy to solve the problem:

sudo pip --upgrade numpy

After doing that, you also need to do a complete reinstallation of the python modules and other packages, as described in Step 9.

Step 17: Results

Here are a few meteor images that we got from capturing the meteors and running the previously installed software.

Warm and Fuzzy Contest

Safe and Secure Challenge

Comfort Food Challenge

9 Discussions

Do you have any advice? I can run the command: mplayer tv:// -tv driver=v4l2:device=/dev/video0:input=0:norm=PAL -vo x11without any issues, but when I try to run: python -m RMS.StartCapture -d 0.1then I don't get the white screen. Instead it complains about trying to connect to an IP camera.

Greetings from Korea. This is a great project and I finally got all the parts collected. I managed to go through most steps and got the camera running. Also Step 15 (Finally running the software) seemed to have been working successfully. Below I give some comments that I encountered:

0) In one of the picture the HDMI port of the Raspberry Pi 3 is labeled in error as VGA.

1) The Raspberry Pi 3 (Model B V1.2) seem to have an in-built WiFi. I did not know that and was surprised when booting Raspbian. Maybe that should be mentioned. A nearby hotspot was found immediately. However, before that I connected the RPi3 with an ethernet cable. That somehow prevented me to connect to the internet via WiFi. I then disconnected the ethernet cable and voila I had internet via WiFi. Sweet.

2) In the mplayer command I initially wrote v412, but its actually v4l2 (video 4 linux). So, not the number 1, but the letter l has to be used.

3) Here I would need some help/feedback: In step 10, there was no file called hwclock-save.service in the /lib/systemd/system/ folder.

4) Here I also would need some help/feedback: In step 11, there is no file called bcm2835_wdt.conf in the /etc/modules-load.d/ folder. But there is a file called /etc/modules-load.d/modules.conf. So, I added "bcm2835_wdt" to that file. Is that correct? Could you check?

Great work and great feedback via email! I will continue working with RMS with my existing cameras here in South Korea. But first some testing through the window from the office. For meteor detection details in South Korea, check out the latest paper:

0) We have included the HDMI2VGA adapter in out description, as some people may not have a HDMI screen.

1) We have left this unmentioned as we assumed a certain level of familiarity with the RPi3 - thanks for pointing it out!

2) We assumed that the commands will be copied directly into the terminal, as this instructable can be opened on the RPi as well, which makes things much easier. We will add a notice that it is the lowercase letter "L", not the number 1.

3) This is unusual - have you rebooted your RPi before looking for the file? The module was probably not loaded. What happens when you run: sudo systemctl enable hwclock-save.service ?

4) Yes, the file indded does not exits, you have to create it yourself. And it will be created when you run the "nano" command and save the file, as described in step 11.

Furthermore, the software has many new features which are not described here, such as astrometry calibration, making flat field images, uploading the data to the central server, etc. We will edit the Instructable when the time allows...

I admire the level of detailed information and the time dedicated to writing this tutorial. I will attempt to build it and will post on my progress.

Having worked with video security cameras, I would like to suggest a couple of modifications to the hardware setup:

1) Analog video security cameras are designed to use a 75Ω impedance transmission network, BNC connectors and Coax cable need to have that characteristic impedance. In order to use a different medium, as UTP cable, a BALUN needs to be used to match the cable's impedance to the one of the camera. In your particular setting, you should use a BNC to RCA impedance adapting connector and a 50Ω patch cord into your capturing device. This is a special component and needs to be identified by the impedance it's matching (BNC=75Ω to RCA=50Ω). Beware of "adapters" that are only mechanical fittings. As these components are passive, they can be used in either direction as shown on the diagram below.

By having a mismatched transmission network you will be introducing some reflection (ghosting) on the image delivered by the camera.

2) Rather than increasing the AGC level, which will introduce noise into the transmitted video, you could adjust the shutter speed or manually adjust the lens' iris. Some CCTV cameras have settings for WDR and automatic iris control recognizable by a cable between the lens and the camera. Different settings are available that may help in getting the best video and deliver it to the capturing device ( maybe an "instructable").

1) Were were using the UTP cable only as a temporary solution, our real setups are using coax cables. We kind of left the cabling part open, but I guess we should write a few words about that as well...

2) The things is, we are pushing the limits of the camera here a bit. The shutter speed is at max (1/50, as the video is interlaced). There is no iris, i.e. the lens is fully opened as we need as much light as possible. Regarding the AGC, we have found that one should not push it above 24 (for our camera), otherwise you end up adding too much noise. But below that it really helps to bring the sensitivity up. We actually tried many settings, these seem to work the best!