Jump to content

Banneranimations2023.jpg.0dc25cf5b6d739d0a35f3617c19f1c90.jpg

Tutorial :- Setting up a Raspberry Pi for Astro Imaging and Hardware Control


Gina

Recommended Posts

INTRODUCTION

This is a tutorial explaining how to install an operating system and software into a micro SD card to use in a Raspberry Pi for astro imaging and control of the relevant hardware. 

The operating system I'm using is Raspbian Lite, a version of Linux recommended for the Raspberry Pi.  The software to capture images, control camera cooling and other things such as the mount etc. is called INDI and provides a set of drivers to control all the hardware.

The Raspberry Pi is run in what is called "headless" mode - meaning that no human interfaces are directly connected to the RPi - instead the RPi is connected to the local area network (LAN) using either Ethernet (preferred for speed and reliability) or WiFi.  Everything is then controlled from indoors on a computer also connected to the LAN.  This computer is called a "client" and the Raspberry Pi a "server".

This tutorial will detail all the steps involved in installing the operating system and software - there are rather a lot of them, hence the need for a tutorial.  I believe that anyone with some knowledge of computers should be capable of following these steps and setting up a working Linux based astro imaging system.  The Raspberry Pi can be put on the pier (or tripod) or even directly on the telescope mounting and would replace a laptop for instance, reducing the use of long cables etc.

Edited by Gina
  • Like 19
  • Thanks 2
Link to comment
Share on other sites

I have a slight quandary - I used a mixture of Windows and Linux to install and set up the RPi.  I guess I should start off using one OS or the other exclusively and the maybe go on to describe how to use the other.  The operating systems were Windows 7 and Linux Mint.  Now I feel that pretty much anyone using Windows should have no problem using Linux Mint as in many ways it's very similar.

One thing that springs to mind is that anyone needing this tutorial will most likely have a Windows laptop that they are using for astro imaging already so I think I shall proceed to describe exactly what I did to get my RPi working for imaging and later see if I can adapt the procedure for other systems.

  • Like 1
Link to comment
Share on other sites

1 hour ago, Gina said:

One thing that springs to mind is that anyone needing this tutorial will most likely have a Windows laptop that they are using for astro imaging already so I think I shall proceed to describe exactly what I did to get my RPi working for imaging and later see if I can adapt the procedure for other systems.

Works for me.

I was assuming that this was a tutorial of how you did things which would be a starter for others to do something similar with other OS/HW setups

 

  • Like 2
Link to comment
Share on other sites

I have a couple of old RPi's that I have not used for some time.

It would be very interesting to use them to control my NEQ6 and cameras. :)

All the folks I know who use only Linux would probably know how to install the OS onto the Pi without any issues anyway.

I would be happy to just follow how you did it Gina. 

  • Like 2
Link to comment
Share on other sites

Great!  I'll go through the steps as I did them before and I shall test the instructions on a new micro SD card and RPi as I go along to make sure the results exactly match the information I post in the tutorial.  I hope to start tomorrow.

Edited by Gina
  • Like 2
Link to comment
Share on other sites

This will be a great thread Gina, I think you have pulled the rabbit out of the hat on this one, hope to see that rabbit run and run.  Look forward to trying to keep up with this thread, usually find I am two pages behind with your stuff and I think I am on here way too much.

  • Like 1
Link to comment
Share on other sites

In view of my experiences in the past of losing posts as I'm writing them I shall post each part (or section) in smallish bits using Edit to add to each one until it's complete.  I've found it most annoying to find that after adding several lines of text plus links and photos, quotes, etc. the text disappears from the editor before it gets saved in SGL.  Please bear with me in this - my plan is to provide plenty of details at each stage for beginners in Linux.  Those more familiar with Linux (again) please bear with me.

The process involved in this tutorial will mostly involve copying lines of text from the tutorial and pasting into the command line in the RPi.  If instructions are followed carefully it should "just work".  That is my hope.  Good luck everyone.

  • Like 1
Link to comment
Share on other sites

Tutorial - continued...

PART 1 - Installing the Operating System.

This part was done using Windows 7.  It should be obvious but you need an SD card reader/writer on (or connected to) the computer.

Insert a new micro SD card (any size above 4GB should do) into the SD card reader, either directly or using the micro SD to standard SD card adapter provided.  You should get something like this :-

AutoPlay 01.png

Make a note of the drive letter - in this case I: (yours will probably be different) then close window (X in top RH corner).

Download, install and run Win32 Disk Imager - you should get something like this :-

Win32DiskImager 01.png

Check that the Device (top right) shows the same drive as you saw after inserting the micro SD card.

Go to the Raspbian Jessie Lite download page and download RASPBIAN JESSIE LITE  ZIP file.

Download Page 01.png

Go to your downloads, right click and Open Containing Folder.  Right click on the file just downloaded and choose Extract All.  Note that the (1) that has appeared on my file will not be on yours - it's on mine because I downloaded the same filename earlier.

Extract 01.png

Click Extract and get something like the screenshot below.  The date part indicates when the last version was published.  This .img file is the file to navigate to in the Win32 Disk Imager later.

Screenshot from 2017-02-04 16-45-22.png

Run Win32 Disk Imager.

Win32DiskImager 01.png

In the LH box labelled Image File, click on the blue folder icon to navigate to the downloaded Raspbian Jessie Lite .img file in the Downloads folder as shown above.  Note the folder name (derived from the downloaded file name) will not have the (1) part if you haven't downloaded Raspian Jessie Lite before.

Screenshot from 2017-02-04 17-58-58.png

With the right destination Device and the Image File selected we are ready to Write the image to the SD card.  Click Write and you get this warning :-

Screenshot from 2017-02-04 18-07-39.png

Click Yes to write the image to the SD card (assuming the right target device, of course).

Screenshot from 2017-02-04 18-20-26.png

Wait while the image is written to the card.  When finished you should get :-

Screenshot from 2017-02-04 18-24-17.png

Click OK.  You can now Exit Win32 Disk Imager.  The micro SD card now has the Raspbian Lite image on it and we are ready for the next stage.

END OF PART 1

Edited by Gina
  • Like 3
Link to comment
Share on other sites

Phew! :D  I think you'll find the actual doing is easier and quicker than the writing up :D

If anyone finds an error in my tutorial or has any problem implementing the steps, please let me know.  A post in this thread will be fine.

Edited by Gina
Link to comment
Share on other sites

Tutorial - continued...

PART 2 - Enabling further setting up and use of the Raspberry Pi in "headless" mode.

This is a relatively short part of the whole job and has become necessary because the folks developing Raspian decided a few months ago to disable SSH - the method of accessing the OS over LAN rather than using human interface devices.

The principle is quite simple really - a file called "SSH" without an extension is placed in the /boot folder of the micro SD card.  Creating extension-less files needs a special technique that is not general knowledge (at least not to me).

While the micro SD card is still in the card reader in the Windows PC, go to Computer and find the card. It should have the same drive letter as previously and probably called boot.

Screenshot from 2017-02-04 19-23-45.png

Now open Notepad, don't type anything into it but Save As (from File Menu) and call it "SSH" including the quote marks.  This causes the file to be saved without an extension.  Save it into boot.

Screenshot from 2017-02-04 19-34-52.png

This list of files in the micro SD card boot folder shows that the SSH file is of type File rather then Text and has no extension.

Screenshot from 2017-02-04 19-39-34.png

I have Ejected the micro SD card from the Win7 PC, taken it out of the card reader and put it in a new Raspberry Pi 3.  Then connected the RPi to a Raspberry PSU unit, plugged it into a mains socket and switched on.  The procedure above has worked :)

END OF PART 2

Edited by Gina
Link to comment
Share on other sites

56 minutes ago, Gina said:

Phew! :D  I think you'll find the actual doing is easier and quicker than the writing up :D

If anyone finds an error in my tutorial or has any problem implementing the steps, please let me know.  A post in this thread will be fine.

I was wondering is the forum software supports sub topics, so that any commentary is separated for the tutorial itself? And , if the author (@Gina) would be interested.

Reason I ask is that despite the high standard of the documantation, and intensive work, by the author, the thread can drift way off topic and people can lose interest as they spend a long time separating chaff from grain. 

  • Like 2
Link to comment
Share on other sites

I'm pretty sure it doesn't but there is one way round this - I could start another thread and ask for replies to be placed in that.  But whether people would post there and not in the main thread is another matter.  I agree that this can be a problem.

  • Like 2
Link to comment
Share on other sites

23 minutes ago, Sp4rkR4t said:

I'd say use this thread to build your tutorial as you have done and then when it's finished copy the completed tut to a new thread.

Or we can do it ourselves ! I have just saved Part 1 (alone without all the other posts) to my Astro folder on a stick  :)  thanks Gina :)

PS my tutorial on how to save just the contents of one post out of a topic could be an 'on request' a.n.other :D

Edited by SilverAstro
  • Like 1
Link to comment
Share on other sites

Tutorial - continued...

PART 3 - setting up the RPi ready to install the INDI library.

I now go over to my Linux Mint desktop and open a terminal window.  My user name is gina and the computer name is gina-mint-PI (named that because this is where I run PixInsight).  Your prompt will reflect your user name and computer name. 

I believe this process can also be handled from Windows by using a utility called PuTTY.  I may look at this and produce some instructions later, if there is a call for it.

Screenshot from 2017-02-04 20-50-14.png

Then type in ssh pi@raspberrypi.  pi is the user name and raspberrypi the computer name.

You may or may not get this message.  I do because I have used Raspberry Pi boards before.

gina@gina-mint-PI ~ $ ssh pi@raspberrypi
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The ECDSA host key for raspberrypi has changed,
and the key for the corresponding IP address 192.168.1.85
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:eH1WdV9WJUJktIH5gEjaVgk1JqWtjKOrzP86pes0Tp4.
Please contact your system administrator.
Add correct host key in /home/gina/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/gina/.ssh/known_hosts:7
  remove with:
  ssh-keygen -f "/home/gina/.ssh/known_hosts" -R raspberrypi
ECDSA host key for raspberrypi has changed and you have requested strict checking.
Host key verification failed.
gina@gina-mint-PI ~ $ 

If you do, follow the instruction given - replacing "gina" with you own user name, viz.

gina@gina-mint-PI ~ $ ssh-keygen -f "/home/gina/.ssh/known_hosts" -R raspberrypi
# Host raspberrypi found: line 7
/home/gina/.ssh/known_hosts updated.
Original contents retained as /home/gina/.ssh/known_hosts.old
gina@gina-mint-PI ~ $

Now SSHing into the RPi gives :-

gina@gina-mint-PI ~ $ ssh pi@raspberrypi
The authenticity of host 'raspberrypi (192.168.1.85)' can't be established.
ECDSA key fingerprint is SHA256:eH1WdV9WJUJktIH5gEjaVgk1JqWtjKOrzP86pes0Tp4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'raspberrypi,192.168.1.85' (ECDSA) to the list of known hosts.
pi@raspberrypi's password: 

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@raspberrypi:~ $

Now we need to perform a couple of configurations using sudo raspi-config - type this into the terminal at the command line or copy it from here.

Screenshot from 2017-02-04 21-07-13.png

First job is to Expand Filesystem as highlighted.  Press right arrow on keyboard (this screen doesn't respond to mouse clicks) to <Select> and press Enter. 

Screenshot from 2017-02-04 21-15-15.png

Press Enter.

The RPi password can also be changed here.  Scroll down one and select it - follow the instructions (using the keyboard as before.  When finished navigate to <Finish> and press Enter.  When it asks if you want to reboot answer Yes.

Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

Broadcast message from pi@raspberrypi on pts/0 (Sat 2017-02-04 21:23:54 UTC):

The system is going down for reboot NOW!

pi@raspberrypi:~ $ Connection to raspberrypi closed by remote host.
Connection to raspberrypi closed.
gina@gina-mint-PI ~ $ 

Now is a good time to make sure all the operating system is right up-to-date.  Firstly, since the RPi has been rebooted we need to SSH into it again with ssh pi@raspberrypi.

gina@gina-mint-PI ~ $ ssh pi@raspberrypi
pi@raspberrypi's password: 

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Feb  4 20:03:52 2017 from gina-mint-pi.home
pi@raspberrypi:~ $ 

Now enter

sudo apt-get update && sudo apt-get upgrade && sudo reboot

at the command prompt (don't forget to press Enter to make it work). 

This will take a while.  Hundreds of lines of text (showing what it's doing) scroll up the screen.  Sometimes there seems to be a pause but it's just working.

When it asks "Do you want to continue? [Y/n]" press Enter for Yes.

The process will stop with a list of certificates - press q to quit to come out of the list (it doesn't quit the upgrade).

At the end of the process the system reboots.

The system is going down for reboot NOW!

pi@raspberrypi:~ $ Connection to raspberrypi closed by remote host.
Connection to raspberrypi closed.
gina@gina-mint-PI ~ $ 

We are now ready to install the INDI library and its dependencies but before doing that I suggest making a backup of the system so far then if anything goes wrong you can replace all the code on the micro SD card with the last backup.  Like a System Restore in Windows.  I will cover that in the next part.

One last point for this section :- Don't just pull out the micro SD card or unplug the RPi card, shut down properly using the following command :- 

 sudo shutdown -h -P now

pi@raspberrypi:~ $ sudo shutdown -h -P now

Broadcast message from pi@raspberrypi on pts/0 (Sat 2017-02-04 22:27:29 UTC):

The system is going down for power-off NOW!

pi@raspberrypi:~ $ Connection to raspberrypi closed by remote host.
Connection to raspberrypi closed.
gina@gina-mint-PI ~ $ 

If the last command was reboot (as above) you will need to SSH into the RPi again before shutting down.

END OF PART 3

Edited by Gina
Link to comment
Share on other sites

Tutorial - continued...

PART 4 - How to back up your work.

Make sure you have shut down the RPi properly as in Part 3 above, then switch off the power before removing the micro SD card.  That will avoid the possibility of data corruption on the card.

I use the Windows app Win32 Disk Imager for this as it is simple and straightforward.  It uses the reverse of writing to the card ie. reading it and saving the image to a file on the HD of the host computer.

I recommend setting up a special folder on your Windows PC to save your backups into to help avoid inadvertently deleting them.  eg. I use RPi Backup Images on drive E: - well separated from the system drive.

This is a list of my backup files from earlier when I started this process - as an example.

Screenshot from 2017-02-04 22-46-54.png

Now put the micro SD card in the card reader, close the AutoPlay window and run Win32 Disk Imager again.  Open the Image File folder from the blue Folder button and select your backup folder.  Type a file name in the box provided.

Screenshot from 2017-02-04 23-06-15.png

Click Open to choose this file name and return to the main Win32 Disk Imager window.  As it happens, this time I put the card in a different slot in the card reader and got a different drive letter.

Screenshot from 2017-02-04 23-13-53.png

Now with Device and file name to save to set up, it only remains to click Read to start the backup.

Screenshot from 2017-02-04 23-22-35.png

Screenshot from 2017-02-04 23-31-35.png

Thats it - DONE :)  Close window and Exit Win32 Disk Imager (or leave open for next time).

END OF PART 4

Edited by Gina
Link to comment
Share on other sites

Tutorial - continued...

PART 5 - Downloading and Installing the INDI library package.

If the micro SD card is still in a running Windows system, Eject it and remove the card.

Now insert in card reader on Linux machine (in my case my Linux Mint tower) and view the Desktop.  Two icons will be displayed representing the micro SD card for the two partitions that have been installed.  These are the boot partition that we saw in Windows and a main partition that will be called <card size> Volume.  eg. I used a 16GB card I had available but this is far bigger that required for the present purpose, that's why this is showing a 16 GB Volume.  Using a larger card doesn't matter - it just has more unused space.

Screenshot from 2017-02-05 11-11-26.png

Open the Volume to display the files.

Screenshot from 2017-02-05 10-54-43.png

Now double click home to display the home folder followed by pi to display the /home/pi folder.  This is where we will put the INDI library package.

Screenshot from 2017-02-05 11-25-43.png

Leaving this window open, we will now download the libINDI package.  In your browser go to page http://indilib.org/support/tutorials/139-indi-library-on-raspberry-pi.html

Screenshot from 2017-02-05 11-36-09.png

Hover over Download and choose Raspberry PI by clicking on it.

Screenshot from 2017-02-05 11-41-37.png

Screenshot from 2017-02-05 11-45-51.png

Click on the orange Download button and download the file.  Navigate to your Downloads folder and you will see the file you've just downloaded.  In this screenshot I show my Downloads folder with the file highlighted.Screenshot from 2017-02-05 11-53-21.png

Now display the RPi micro SD card contents in addition to this one and copy the downloaded file across to the micro SD card eg. drag and drop.  This should be the result.  Ignore any other files in the Downloads folder.

Screenshot from 2017-02-05 12-08-31.png

The libindi package is now installed into the micro SD card and ready for unpacking etc.  We have now finished with these windows and they can be closed.

Next show the Desktop and right click on either boot or Volume icons and choose EJect.  Both icons will disappear from the Desktop.  Now the micro SD card can be removed from the card reader. 

The indilib package is now installed and this seems a good point for a break.

In the next part we will SSH into the RPi and unpack and install all the driver files contained in the package.

END OF PART 5

Edited by Gina
Clarified wording in paragraph 2
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.