Jump to content

Stargazers Lounge Uses Cookies

Like most websites, SGL uses cookies in order to deliver a secure, personalised service, to provide social media functions and to analyse our traffic. Continued use of SGL indicates your acceptance of our cookie policy.

Gina

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

Recommended Posts

hi.

anyone else having problems downloading Jessie lite.i am using windows 10 on a Toshiba i5.get it downloaded to comp,but then says corrupted file,wont mount.

Share this post


Link to post
Share on other sites

I suggest trying again - probably had a glitch during the download.  I don't have Windows 10 so can't test it myself in that OS.

Share this post


Link to post
Share on other sites

A comment on the tutorial may be appropriate - I am giving as much detail as I can and showing numerous screenshots to explain each stage.  This will give an impression that there's an enormous amount to do but if you just work through it you should achieve the required result.  I have aimed the tutorial at the lowest level and if you think I'm "telling grandma to suck eggs" (or whatever the expression is)...

Share this post


Link to post
Share on other sites

Tutorial - continued...

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 youy data!!

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

END OF PART 6

Edited by Gina

Share this post


Link to post
Share on other sites
2 hours ago, jarraman said:

hi.

anyone else having problems downloading Jessie lite.i am using windows 10 on a Toshiba i5.get it downloaded to comp,but then says corrupted file,wont mount.

On Win 10 pro here - levono i5 lappy, just downloaded Jessie Lite (the zip), got a corrupted message - but all looked ok, unziped and can see file in downloads,  1,357,824kb

I am not installing atm but downloaded diskimager and ran - jessie was accepted in the large box.  Had to quit as thats as far as I won't to go, may try a card later.

as a btb Gina, if any of these programs are updated later - hopefully this will all still work or these 'versions' still be available, I may download a store just in case.

Share this post


Link to post
Share on other sites

I would have thought that unzipping would find any errors.

Everything should work if you use the latest version but I can't guarantee it, of course.

Share this post


Link to post
Share on other sites

Tutorial - continued...

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

END OF PART 7

Edited by Gina
  • Like 1

Share this post


Link to post
Share on other sites

Tutorial - continued...

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
./configure
make
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
make
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.

END OF PART 8

Edited by Gina

Share this post


Link to post
Share on other sites

Tutorial - continued...

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

Electronics 03.JPG

Esprit Imaging Rig 01.JPG

This shows the Astroberry Focuser connections for the stepper driver.
Screenshot from 2017-02-11 12-23-35.png

And this shows the Pololu A4988 stepper driver.
Screenshot from 2017-02-11 12-19-31.png

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 as the 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.

END OF PART 9

Edited by Gina
Added bit about RESET on A4988.
  • Like 1

Share this post


Link to post
Share on other sites

That completes this tutorial.  I now open this thread for questions :) 

I may write another tutorial on modifying INDI drivers when I've worked out how :D  I can change the labels that show in KStars by editing the source files and also remove unwanted drivers from a source library as described above but I'm hoping to do more - watch this space :D

 

  • Like 1

Share this post


Link to post
Share on other sites

Very interesting, thanks for the focuser description! I'm considering having a go at constructing one! I'm most concerned about how to reliably connect the focuser itself to a stepper motor I suppose. I'm not certain I have the tools to do it!

  • Like 1

Share this post


Link to post
Share on other sites

Thanks, Gina. I've set up RPi's a couple of times, both Ubuntu and Raspbian, but always need to have a tutorial next to me, so I don't forget steps. It's great to have a complete setup walkthrough in one place.

  • Like 1

Share this post


Link to post
Share on other sites

Once you've set one up and backed it up you can create the image on a new micro SD card from the backup.  Either Win32 Disk Imager in Windows or dd in Linux.  OTOH you may want variations and want to edit the source code.

Share this post


Link to post
Share on other sites

I usually test variations. The problem with RPi is that after a while you don't remember what exactly is installed, and in which configuration. Maybe I need to put a textfile in the home folder which holds info on the configuration.

  • Like 1

Share this post


Link to post
Share on other sites

That's a good idea :)

Share this post


Link to post
Share on other sites

One thing I realised when using the tutorial to construct the focuser system for my widefield rig (Tutorial Part 9) and that's the RESET for the stepper driver which needs connecting to the +3.3v rail to give a logic 1.  I've added it as an EDIT to the tutorial.

The basic circuit diagram shows it connected to SLEEP but SLEEP is used by the Astroberry driver.  Reason is that RESET is pulled low internally so would hold the chip in RESET mode if left unconnected, stopping it working.

Share this post


Link to post
Share on other sites

One thing I realised when using the tutorial to construct the focuser system for my widefield rig (Tutorial Part 9) and that's the RESET for the stepper driver which needs connecting to the +3.3v rail to give a logic 1.  I've added it as an EDIT to the tutorial.

The basic circuit diagram shows it connected to SLEEP but SLEEP is used by the Astroberry driver.  Reason is that RESET is pulled low internally so would hold the chip in RESET mode if left unconnected, stopping it working.

Share this post


Link to post
Share on other sites

Don't suppose anyone knows of any direct links to the raspbian images since the raspberry pi site has chosen this moment to go mental just as I'm rebuilding my project.

 

EDIT: never mind http://downloads.raspberrypi.org/ still works and bookmarked for future.

Edited by Sp4rkR4t
  • Like 1

Share this post


Link to post
Share on other sites

A short note on part 5 of the tutorial.

Gina uses a Linux computer when downloading the indilib package. I don't have linux, so downloaded on my windows machine.

I used Windows remote desktop to connect to the raspberry pi.

On my windows computer, I downloaded the indilib package to my standard download folder.

On the Raspberry Pi:

opened the file browser and chose network which lets me connect to my windows computer (using my windows username and password)

Being connected to my windows file system from the Raspberry Pi, I opened the downloads folder and copied the indilib package to the Raspberry Pi, pi folder.

The file is now in the pi folder on the Raspberry Pi, ready for part 6 of the tutorial

  • Like 3

Share this post


Link to post
Share on other sites

First rather crude quick test of the auto-focus feature shows great promise IMO.  From my thread in "Imaging - Discussion" forum - I don't think an average HFR of 1.2 pixels is a bad start :) :-

14 hours ago, Gina said:

Clear sky to the east so tried auto-focus using KStars/INDI.  Here's the focuser window in Ekos - KStars.  This is using the Luminance filter.  Don't know if I'm using the best parameters but the results look pretty good to me :)  This is after Auto-Focus then Framing to look at a number of stars.  I haven't pointed the telescope in any particular direction so this is pot luck as to what stars are in the FOV.  It may be better with tracking on.

Screenshot from 2017-02-15 19-21-25.png

Edited by Gina

Share this post


Link to post
Share on other sites

Hi Gina. 

Where would an absolute newb start with these Raspberry Pi's? This all looks extremely technical and scares the jeepers out of me even wanting to begin to learn how these things work.

I see so many people use these for all sorts of projects, so they are clearly versatile devices, and I would love to bring one into my projects. I'm just feeling like its all way above my head.

Share this post


Link to post
Share on other sites
27 minutes ago, Daz69 said:

Hi Gina. 

Where would an absolute newb start with these Raspberry Pi's? This all looks extremely technical and scares the jeepers out of me even wanting to begin to learn how these things work.

I see so many people use these for all sorts of projects, so they are clearly versatile devices, and I would love to bring one into my projects. I'm just feeling like its all way above my head.

If you are interested in learning about them, I would buy a Raspberry pi, and of course a microSD card. Follow a guide (for example Gina's) on how to install raspian on the microSD card, or alternatively I think you can buy the microSD cards with it pre-installed. Then connect a HDMI monitor, keyboard and mouse and use it as a computer for a bit. Just play with it. Learn how to update the system and install new software using the terminal.

That's how I would do it. That's pretty much how I learnt to use Linux back in the day. I just installed it on my computer and played about with it!

  • Like 2

Share this post


Link to post
Share on other sites

Yes, that's just what I was going to suggest.  Amazon are as good a source as any - same price or less.  And yes, you can buy a micro SD card (+ adapter which you won't need yet) with Raspbian (or NOOBS version of Raspbian for newbies) already installed.  That was what I did when I started with the Raspberry Pi a little while back.

  • Like 1

Share this post


Link to post
Share on other sites

Me too. The first setup may be a bit tricky, as you need to get wifi working. But this may have been improved with the newest version, which has an internal wifi adaptor.

There are several good tutorials on the web for whatever you may need Pi-wise. Just enter your question in google.

And I'm sure there must be a good read for raspberry newbies. Personally, I would check the "... for dummies" series. But that's just me.

Have fun.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, wimvb said:

Me too. The first setup may be a bit tricky, as you need to get wifi working. But this may have been improved with the newest version, which has an internal wifi adaptor.

There are several good tutorials on the web for whatever you may need Pi-wise. Just enter your question in google.

And I'm sure there must be a good read for raspberry newbies. Personally, I would check the "... for dummies" series. But that's just me.

Have fun.

 

Yeah I would definitely recommend the Raspberry Pi 3, which has internal WiFi... and a few other upgrades like a faster CPU.

Share this post


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

By using this site, you agree to our Terms of Use.