Jump to content


Astro Projects

  • entries
  • comments
  • views

Setting up a Raspberry Pi for Astro Imaging and Hardware Control




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.  I have copied relevant posts from a thread in the Discussions - Software forum :- Tutorial :- Setting up a Raspberry Pi for Astro Imaging and Hardware Control

  • Like 1


Recommended Comments


Posted (edited)


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
Link to comment

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.

Link to comment

Posted (edited)

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.


Edited by Gina
  • Like 1
Link to comment

Posted (edited)

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 :)


Edited by Gina
Link to comment

Posted (edited)

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
The ECDSA host key for raspberrypi has changed,
and the key for the corresponding IP address
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.
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
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 (' 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,' (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.


Edited by Gina
Link to comment

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).


Link to comment

Posted (edited)

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.


Edited by Gina
Link to comment

PART 6 - Installing dependencies, unpacking the libindi package and installing all the driver files.

Insert the micro SD card into the RPi and power up.  After a few seconds it will be ready.

SSH into the RPi from a Terminal window in Linux - ssh pi@raspberrypi

Install the dependencies (stuff needed by libindi but not included in the libindi package) - copy the following (long) line into the RPi and if it doesn't start immediately press Enter.  Make sure you get all the line or it won't work properly. 
Hint - triple click on line to select it all, then Copy.

sudo apt-get install cdbs libcfitsio3-dev libnova-dev libusb-1.0-0-dev libjpeg-dev libusb-dev libtiff5-dev libftdi-dev fxload libkrb5-dev libcurl4-gnutls-dev libraw-dev libgphoto2-dev libgsl0-dev dkms libboost-regex-dev libgps-dev libdc1394-22-dev

When it asks "Do you want to continue? [Y/n]" press Enter.  Masses of text will scroll up the screen as the packages are downloaded, unpacked and installed.  Sometimes there will be a pause as it processes.

I have just done this and got no errors - (you can scroll up the displayed text if you like, to see what happened - remember to scroll back down to the prompt when done).

Next we unpack the libindi package and install the driver files.  Copy the following lines into the RPi command line one at a time and wait for the processing to finish before doing the next (the first two are virtually instantaneous, the last takes longer).  Press Enter if needed.

tar -xzf libindi_1.3.1_rpi.tar.gz
cd libindi_1.3.1_rpi
sudo dpkg -i *.deb

Here's a copy of part of my RPi terminal - yours should look the same.

pi@raspberrypi:~ $ tar -xzf libindi_1.3.1_rpi.tar.gz
pi@raspberrypi:~ $ cd libindi_1.3.1_rpi
pi@raspberrypi:~/libindi_1.3.1_rpi $ sudo dpkg -i *.deb

At this stage all the drivers contained in the INDI library package should work.  There are other INDI drivers available from separate sources for equipment not included in the INDI library.  I shall show installing a couple in a later part.  Whether the current installation will work for you as is, will depend on what equipment you use.

Before trying the software it is a good time to make a backup as detailed in Part 4 but first we must shut down the RPi cleanly so as to avoid data corruption.  Copy sudo shutdown -h -P now to the command line or scroll up the history list, using the up arrow, to that command.

pi@raspberrypi:~/libindi_1.3.1_rpi $ sudo shutdown -h -P now

Switch off the power to the RPi and take out the micro SD card.  Now go to Part 4 for backup instructions.

IMPORTANT NOTE :- If you get the following screen come up close it immediately - don't let it try to "fix" it - that will destroy your data!!

Screenshot from 2017-02-05 14-31-52.png


Link to comment

PART 7 - Testing.

I have already installed KStars in my Linux Mint desktop and will use this for testing.  I also have an imaging rig set up on an NEQ6 mount in my living room and pointing out of a window.  The rig consists of Esprit 80ED Pro scope, ZWO EFW mini filter wheel and ASI1600MM-Cool camera.  13.8v power is provided by a bench PSU.  The EFW is connected to the USB hub on the camera and camera connected to USB port on the new RPi.  Mount is connected via a USB-serial adapter cable to a USB port on the RPi.  RPi currently powered by a Raspberry PSU.

I'm going to test the new INDI installation using the ZWO ASI1600MM-Cool camera and EFW plus NEQ6 mount.  The camera driver is indi_asi_ccd, the ZWO EFW driver indi_asi_wheel and mount indi_eqmod_telescope.

Put micro SD card into RPi and power up then SSH into it from Linux - ssh pi@raspberrypi

Copy indiserver -m 100 -vv indi_asi_ccd indi_asi_wheel indi_eqmod_telescope into command line and run.

To check it was working I ran KStars and then Ekos from the KStars menu.  Set up the Profile for the RPi and saved it.

Screenshot from 2017-02-05 15-36-19.png

Screenshot from 2017-02-05 15-39-36.png

Start INDI and the INDI Control Panel pops up.  Went to each tab and clicked Connect to check that each device would connect - they did and everything worked.

Screenshot from 2017-02-05 15-17-57.png

Here's an image of far trees about a mile away captured using this software. 

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

CONCLUSION :-  Test successful - INDI installation works fine :)


Link to comment

PART 8 - Adding an INDI driver not included in the INDI library.

Most of the hardware drivers I want are in the INDI library but not all, hence this section on adding and extra one or two from an alternative source.

I have my own DIY remote focussing system which I wanted to adapt to use with INDI and RPi.  The Astroberry Focuser pretty much provides this.  The Astroberry library also contains other drivers - a total of four.  Two of these I can use but not the other two.  See the sourceforge Astroberry page for information on their drivers.  When I tried to install the full set I got errors from one of the drivers I didn't want so I went into the source code and deleted the drivers I didn't want from the compilation.

Since these drivers connect through the GPIO pins on the RPi a driver is needed for the BCM2835 microprocessor to access the GPIO pins.

If not already connected to the RPi, SSH into it as before - ssh pi@raspberrypi

Now copy the following commands to the RPi command line one at a time and wait while each command is processed.  When you get "Do you want to continue? [Y/n]" press Enter.  Be careful not to miss any lines.

sudo apt-get install subversion cmake libgps-dev
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.50.tar.gz
tar xvfz bcm2835-1.50.tar.gz
cd bcm2835-1.50
sudo make install

Next to download the Astroberry source code.  Copy the following commands to the RPi command line one at a time and wait while each command is processed.  When you get "Do you want to continue? [Y/n]" press Enter.

cd ~/
svn checkout svn://svn.code.sf.net/p/astroberry/svn/trunk/ astroberry-svn 
cd astroberry-svn

Here is a list of the source files we have downloaded to the RPi.

pi@raspberrypi:~/astroberry-svn $ ls
AUTHORS         COPYING.LIB         indi_rpifocus.xml  README          rpi_brd.cpp    rpi_focus.h
CMakeLists.txt  indi_rpialtimu.xml  indi_rpigps.xml    rpi_altimu.cpp  rpi_brd.h      rpi_gps.cpp
cmake_modules   indi_rpibrd.xml     INSTALL            rpi_altimu.h    rpi_focus.cpp  rpi_gps.h
pi@raspberrypi:~/astroberry-svn $ 

The file we want to edit is CMakeLists.txt.  Previously I edited this with the Linux editor nano but that's rather fiddly to use.  I would prefer to suggest using a graphical editor (such as Notepad in Windows or Text Editor in Linux).  This would want the micro SD card put in a PC with a GUI.  While the micro SD card is out of the RPi it would be a good opportunity to make a backup.  Since the Windows machine is used for backup, I think the editing might as well be done in Notepad.

Made the backup then tried to use Notepad but only the boot partition seems available in Windows so I'll use Linux.

Used Eject in Windows to close the micro SD card, took it out of the Windows card reader and put it in the Linux card reader.  Navigated to /home/pi/astroberry-svn and opened CMakeLists.txt in Text Editor.

Screenshot from 2017-02-05 21-38-20.png

Now we can simply edit out the unwanted part which is the Astroberry AltIMU (the troublesome part) and Astroberry GPS (not wanted) and then Save back.

Screenshot from 2017-02-05 21-53-07.png

Eject card and remove from card reader.  Put card in RPi and power up.

SSH into it as before - ssh pi@raspberrypi

Copy the following commands to the RPi command line one at a time and wait while each command is processed.  This compiles the source code and installs the drivers.

mkdir indi-astroberry
cd indi-astroberry
cmake -DCMAKE_INSTALL_PREFIX=/usr ../astroberry-svn
sudo make install

Relatively small amount of processing this time so I'll list the results.  This is the whole session from cold.

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: Sun Feb  5 15:06:29 2017 from gina-mint-pi.home
pi@raspberrypi:~ $ mkdir indi-astroberry
pi@raspberrypi:~ $ cd indi-astroberry
pi@raspberrypi:~/indi-astroberry $ cmake -DCMAKE_INSTALL_PREFIX=/usr ../astroberry-svn
-- The CXX compiler identification is GNU 4.9.2
-- The C compiler identification is GNU 4.9.2
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
-- Checking for module 'libindi'
--   Found libindi, version 1.3.1
-- Found INDI: /usr/include/libindi (found version "1.3.1") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/indi-astroberry
pi@raspberrypi:~/indi-astroberry $ make
Scanning dependencies of target indi_rpifocus
[ 25%] Building CXX object CMakeFiles/indi_rpifocus.dir/rpi_focus.o
[ 50%] Linking CXX executable indi_rpifocus
[ 50%] Built target indi_rpifocus
Scanning dependencies of target indi_rpibrd
[ 75%] Building CXX object CMakeFiles/indi_rpibrd.dir/rpi_brd.o
[100%] Linking CXX executable indi_rpibrd
[100%] Built target indi_rpibrd
pi@raspberrypi:~/indi-astroberry $ sudo make install
[ 50%] Built target indi_rpifocus
[100%] Built target indi_rpibrd
Install the project...
-- Install configuration: ""
-- Installing: /usr/bin/indi_rpibrd
-- Installing: /usr/share/indi/indi_rpibrd.xml
-- Installing: /usr/bin/indi_rpifocus
-- Installing: /usr/share/indi/indi_rpifocus.xml
pi@raspberrypi:~/indi-astroberry $ 

Here's a more colourful version which also shows what happens when you add the wrong command :D  As in this case, it's often not disastrous but if it is, this is where the last backup comes in handy!

Screenshot from 2017-02-06 10-47-05.png

To make it work we need to reboot and log back in then run indiserver with a list of the drivers required.

sudo reboot
ssh pi@raspberrypi
indiserver -m 100 -vv indi_asi_ccd indi_asi_wheel indi_eqmod_telescope indi_rpifocus indi_rpibrd

Astroberry Focuser and Astroberry Board drivers are now working :)  All the other drivers and all the hardware also work.  Success!

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

Now with everything working it's time for a backup. 

Use Ctrl C to exit the INDI server in the RPi.  Shut down system using, sudo shutdown -h -P now,  power down and remove card from RPi.  Put in card reader in Windows PC and make a backup as in Part 4.


Link to comment

PART 9 - Hardware for remote focussing.

This is the RPi plus HAT and other components for the scope imaging rig.  The focus make use of the Astroberry Focuser driver to control a Pololu A4988 stepper driver module which in turn drives a modified 28BYJ-48 little stepper motor with built-in gearbox.

Here are some photos showing the electronics and the hardware with the gearing that drives the telescope focuser from the stepper motor.  The gears and motor bracket were 3D printed in ABS plastic but for those who don't have a 3D printer, the gears can be replaced with a timing belt and pulleys and the motor bracket with bent up aluminium sheet.

The power input is filtered from interference with electrolytic and ceramic capacitors.  Fuses supply the electronics and the camera.  The 13.8v power input is dropped to 5.1v for the RPi with a buck converter - attached to the HAT.  Provision was also made for a dew heater switch using a power MOSFET.  This can be seen near the middle of the HAT between stepper driver and buck converter.


Electronics 03.JPG

Esprit Imaging Rig 01.JPG

This shows the Astroberry Focuser connections for the stepper driver.

And this shows the Pololu A4988 stepper driver.
The first photo above shows the connections on the HAT.  That should show how the connections are made but if anyone wants more I'll produce a wiring diagram.  M0 and M1 in the Astroberry diagram correspond to MS1 and MS2 of the A4988 PCB.

EDIT :-  One thing I've noticed that may not be clear.  The RESET input on the A4988 needs connecting to logic "1" ie. +3.3v (Note voltage).  The link on the HAT  is partly obscured by the blue SLEEP wire in the photo.


Below is the modification of the 28BYJ-48 5v stepper motor to enable its use with a bipolar stepper driver such e Pololu A4988 (as can be seen on the HAT above).

On 28/08/2016 at 15:56, Gina said:

This mini-project is as a result of the focussing on my lens + FW + ASI1600MM-Cool widefield imaging rig being too coarse with 28BYJ-48 stepper motor and usual driver board.

The ubiquitous little 28BYJ-48 stepper motor is connected internally as a unipolar stepper motor with the centre tap on the windings connected together.  This prevents it from being used as it is with bipolar motor drivers such as the A4988 which provide micro-stepping.  These drivers need the two windings to be separate as it uses them in an H bridge.  However, there is a relatively simple modification that can be applied to the 28BYJ-48 to break the link between windings for anyone capable of handling small things and pliers or wire cutters and a craft knife.

The motor is held together by 4 tiny lugs on the casing which are bent inwards to secure the output shaft plate.  Using strong small pliers or wire cutters these little lugs can be prized outwards to release the end plate.  Then the innards of the motor can be extracted carefully from the round casing complete with wires and blue plastic piece.  Sliding the plastic bit up the wires reveals the coil connections as shown below.  Next job is to cut the track on the PCB that joins the two windings and cut off the red wire, which is no longer used.  Finally the motor can be reassembled.  For use as a bipolar motor the coils are yellow-blue and orange-pink.

One further point to note...  Each half winding is rated at either 5v or 12v as printed on the back of the motor so when the whole of each winding is used this doubles the voltage rating.  Also, the A4988 or similar has a current setting and this is used to control the power to the stepper motor, so the supply voltage can be more than twice the voltage printed on the case.  Thus a 5v motor can be run on 12v or even 13.8v as often used in observatories and provided by a nominally 12v car or pleasure battery.

With this modification and A4988 stepper motor controller with micro-stepping, finer control can be provided from a 28BYJ-48 stepper motor used in a remote focussing system.

Here are some photos :-

  1. Coils and connections
  2. Link severed
  3. Other parts of the motor
  4. Plastic part pushed back into position and assembly put back in case
  5. Rotor replaced
  6. Gearbox replaced but not yet aligned - care must be taken to engage the teeth of the rotor pinion with the first gear in the train.

Focus motor mods 01.jpg

Focus motor mods 02.jpg

Focus motor mods 03.jpg

Focus motor mods 04.jpg

Focus motor mods 05.jpg

Focus motor mods 06.jpg


Finally, here's the circuit diagram for the dew heater. 
Screenshot from 2017-02-11 11-59-29.png

That completes the hardware description. 

Hopefully the above will enable anyone to build a similar remote focuser but I'll be happy to answer any questions.


  • Thanks 1
Link to comment


I have the need to modify more 28BYJ-48 stepper motors as mentioned above but I found that I was unable to get the motor back together - the end of the rotor shaft would not go back into its bearing hole in the plate.  As a result I decided to try to cut the PCB track without taking the motor apart. 

I carefully drilled a hole through the blue plastic connection cover to access the PCB where the strip wanted cutting through.  Then I was able to take a very small screwdriver and scrape through the track without disturbing anything else.  This is shown in the close-up photo below.  As before the coils are orange-pink and yellow-blue.  Do not connect the red wire.


Link to comment


I've been finding a few problems with Raspbian as the Operating System and now looking at Ubuntu Mate which has some advantages and would seem easier to set up but have to see.  I may produce another Tutorial using Ubuntu Mate instead of Raspbian.

  • Like 2
Link to comment

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
  • 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.