Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

Astro Projects

  • entries
    16
  • comments
    1,180
  • views
    6,327

Setting up a Raspberry Pi for Astro Imaging and Control - Ubuntu Mate


Gina

9,215 views

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

54 Comments


Recommended Comments



Can't see any differences.  Maybe the answer is to clear out the astroberry-diy/build directory and check all content of the astroberry-diy directory.

Link to comment

I'm afraid this Tutorial has reverted into an ordinary Blog - my apologies to our readers.  Once I have all this sorted out (and I will do) I may copy the relevant parts into a new Tutorial.

Link to comment

Deleted the astroberry-diy/build directory and removed the Astroberry Focuser compiling code lines from the CMakeLists.txt file.  Ran the cmake and make commands and it compiled.  So far so good.

Link to comment

Ran the last two lines of the list and it worked.

sudo make install
sudo reboot

Logged in again and ran the INDI drivers

gina@asc2:~$ indiserver -m 100 -vv indi_asi_ccd indi_rpibrd

Then ran KStars/Ekos, set up new remote site for asc2 and started INDI.  The control panel for the Astroberry Board came up as expected.  No camera as there isn't one connected.  This is the Astroberry Board controls as supplied in the package.  The error message is because I haven't saved a configuration.

371110555_INDIControlPanel02.thumb.png.505c67e22612507a62c0350f92fdfaa0.png

Link to comment

Conclusion :-  I have at last installed a 3rd party INDI driver that works.

Link to comment

So far so good - a definite step forward but for a usable astro imaging system we want a working focussing control preferably with auto-focus facility from KStars, so I need to sort out what's wrong there.  The Astroberry Board driver provides GPIO controls but would probably want altering to suit particular astro imaging systems such as dew heater control, with appropriate labels.  With care this is a relatively easy editing job on the C++ source file prior to re-compiling and installing.

Link to comment
Gina

Posted (edited)

I have successfully edited, re-compiled and installed source code for an INDI driver now.  But what I really want t o do is get my head round all the INDI driver building stuff and build a driver from scratch.  We, maybe using some examples.  I find the information on the INDI web site rather complicated.  I reckon that if I can get to understand it fully I could write a Tutorial in the form of "Writing INDI drivers for Dummies".  I've been told that I'm good at explaining things in a way that almost anyone can understand.

Edited by Gina
Link to comment

Seems the WiFi setup is dependent on the particular RPi host.  Probably uses the MAC address of the WiFi chip when setting up WiFi.  This is a nuisance as I was hoping to just clone micro SD cards for my various astro imaging rigs.  Or use a bench setup to install everything then move the card to whichever RPi.  Look like I shall have to go through the hour long or more setting up and installation on every RPi I want to use!  DRAT!!!

Link to comment

Ah!!  Thank you for that :)  Just what I was looking for.  I had a feeling there was a way to do it but couldn't quite remember.

  • Like 1
Link to comment

I have edited the Astroberry Board source files successfully to provide just what I want for my All Sky Camera.  Providing dew heater control and also Peltier TEC DIY camera cooling at two levels of cooling.  I also incorporated a simplified method of focussing employing four buttons viz. Coarse IN  Fine IN  Fine OUT  Coarse OUT.  The All sky Camera is now working to my satisfaction and is considered finished.  The only thing that might want changing could be the amount of dew heating for cold winter nights but time will tell.

Here is the rpi_brd.h code :-

/*******************************************************************************
  Copyright(c) 2014 Radek Kaczorek  <rkaczorek AT gmail DOT com>

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public
 License version 2 as published by the Free Software Foundation.
 .
 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Library General Public License for more details.
 .
 You should have received a copy of the GNU Library General Public License
 along with this library; see the file COPYING.LIB.  If not, write to
 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.
*******************************************************************************/

/*******************************************************************************
 Edited by Gina for All Sky Camera - 2018-07-01
*******************************************************************************/

#ifndef RPIBRD_H
#define RPIBRD_H

#include <string>
#include <iostream>
#include <stdio.h>

#include <defaultdevice.h>

class IndiRpibrd : public INDI::DefaultDevice
{
protected:
private:
	int counter;
    IText SysTimeT[2];
    ITextVectorProperty SysTimeTP;
    IText SysInfoT[3];
    ITextVectorProperty SysInfoTP;
	ISwitch Switch1S[2];
	ISwitchVectorProperty Switch1SP;
	ISwitch Switch2S[2];
	ISwitchVectorProperty Switch2SP;
	ISwitch FocusS[4];
	ISwitchVectorProperty FocusSP;
	enum { FINC, FINF, FOUTF, FOUTC };

public:
    IndiRpibrd();
	virtual ~IndiRpibrd();

	virtual const char *getDefaultName();

	virtual void TimerHit();
	virtual bool Connect();
	virtual bool Disconnect();
	virtual bool initProperties();
	virtual bool updateProperties();
	virtual void ISGetProperties(const char *dev);
	virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
	virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n);
	virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n);
	virtual bool ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n);
	virtual bool ISSnoopDevice(XMLEle *root);
	virtual bool saveConfigItems(FILE *fp);
	
	virtual bool LoadLines();

};

#endif

And the rpi_brd.cpp code :-

/*******************************************************************************
  Copyright(c) 2015 Radek Kaczorek  <rkaczorek AT gmail DOT com>

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public
 License version 2 as published by the Free Software Foundation.
 .
 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Library General Public License for more details.
 .
 You should have received a copy of the GNU Library General Public License
 along with this library; see the file COPYING.LIB.  If not, write to
 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.
*******************************************************************************/

/*******************************************************************************
 Edited by Gina for All Sky Camera - 2018-07-03
*******************************************************************************/

#include <stdio.h>
#include <memory>
#include <bcm2835.h>
#include <string.h>

#include "rpi_brd.h"

// We declare an auto pointer to IndiRpibrd
std::unique_ptr<IndiRpibrd> indiRpibrd(new IndiRpibrd());

// indicate GPIOs used - use P1_* pin numbers not gpio numbers (!!!)
#define IN1 RPI_BPLUS_GPIO_J8_31	// GPIO06
#define IN2 RPI_BPLUS_GPIO_J8_33	// GPIO13
#define DIR RPI_BPLUS_GPIO_J8_07	// GPIO4
#define STEP RPI_BPLUS_GPIO_J8_11	// GPIO17
#define SLEEP RPI_BPLUS_GPIO_J8_12	// GPIO18

#define STEP_DELAY 4 // miliseconds
#define LIGHT_DELAY 1000 // miliseconds  -  1s

int FineTicks = 20;      //  default 20
int CoarseTicks = 100;   //  default 100
 
void ISPoll(void *p);
void ISInit()
{
   static int isInit =0;

   if (isInit == 1)
       return;

    isInit = 1;
    if(indiRpibrd.get() == 0) indiRpibrd.reset(new IndiRpibrd());

}
void ISGetProperties(const char *dev)
{
        ISInit();
        indiRpibrd->ISGetProperties(dev);
}
void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int num)
{
        ISInit();
        indiRpibrd->ISNewSwitch(dev, name, states, names, num);
}
void ISNewText(	const char *dev, const char *name, char *texts[], char *names[], int num)
{
        ISInit();
        indiRpibrd->ISNewText(dev, name, texts, names, num);
}
void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int num)
{
        ISInit();
        indiRpibrd->ISNewNumber(dev, name, values, names, num);
}
void ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int num)
{
  INDI_UNUSED(dev);
  INDI_UNUSED(name);
  INDI_UNUSED(sizes);
  INDI_UNUSED(blobsizes);
  INDI_UNUSED(blobs);
  INDI_UNUSED(formats);
  INDI_UNUSED(names);
  INDI_UNUSED(num);
}
void ISSnoopDevice (XMLEle *root)
{
    ISInit();
    indiRpibrd->ISSnoopDevice(root);
}
IndiRpibrd::IndiRpibrd()
{
	setVersion(2,1);

    if (!bcm2835_init())
    {
		IDLog("Problem initiating Astroberry Board.");
		return;
	}

    // init GPIOs
    std::ofstream exportgpio;
    exportgpio.open("/sys/class/gpio/export");
    exportgpio << IN1 << std::endl;
    exportgpio << IN2 << std::endl;
    exportgpio << DIR << std::endl;
    exportgpio << STEP << std::endl;
    exportgpio << SLEEP << std::endl;
    exportgpio.close();

    // Set gpios to output mode
    bcm2835_gpio_fsel(IN1, BCM2835_GPIO_FSEL_OUTP);
    bcm2835_gpio_fsel(IN2, BCM2835_GPIO_FSEL_OUTP);
    bcm2835_gpio_fsel(DIR, BCM2835_GPIO_FSEL_OUTP);
    bcm2835_gpio_fsel(STEP, BCM2835_GPIO_FSEL_OUTP);
    bcm2835_gpio_fsel(SLEEP, BCM2835_GPIO_FSEL_OUTP);

	bcm2835_gpio_write(IN1, LOW);
	bcm2835_gpio_write(IN2, HIGH);
	bcm2835_gpio_write(DIR, HIGH);
	bcm2835_gpio_write(STEP, HIGH);
	bcm2835_gpio_write(SLEEP, HIGH);
}
IndiRpibrd::~IndiRpibrd()
{
}
bool IndiRpibrd::Connect()
{
	SetTimer(1000);
/*
	if ( !IndiRpibrd::LoadLines() )
	{
		IDMessage(getDeviceName(), "Astroberry Board connection error.");
		return false;
	}
*/
    IDMessage(getDeviceName(), "Astroberry Board connected successfully.");
    return true;
}
bool IndiRpibrd::Disconnect()
{
/*
    // close GPIOs
    std::ofstream unexportgpio;
    unexportgpio.open("/sys/class/gpio/unexport");
    unexportgpio << IN1 << std::endl;
    unexportgpio << IN2 << std::endl;
    unexportgpio << IN3 << std::endl;
    unexportgpio << DIR << std::endl;
    unexportgpio << STEP << std::endl;
    unexportgpio << SLEEP << std::endl;
    unexportgpio.close();
    bcm2835_close();
*/    	
    IDMessage(getDeviceName(), "Astroberry Board disconnected successfully.");
    return true;
}
void IndiRpibrd::TimerHit()
{
	if(isConnected())
	{
		// update gps time
		struct tm *local_timeinfo;
		static char ts[32];
		time_t rawtime;
		time(&rawtime);
		local_timeinfo = localtime (&rawtime);
		strftime(ts, 20, "%Y-%m-%dT%H:%M:%S", local_timeinfo);
		IUSaveText(&SysTimeT[0], ts);
		snprintf(ts, sizeof(ts), "%4.2f", (local_timeinfo->tm_gmtoff/3600.0));
		IUSaveText(&SysTimeT[1], ts);
		SysTimeTP.s = IPS_OK;
		IDSetText(&SysTimeTP, NULL);


		if ( counter == 0 )
		{
			SysInfoTP.s = IPS_BUSY;
			IDSetText(&SysInfoTP, NULL);

			FILE* pipe;
			char buffer[128];
			
			//update Hardware
			pipe = popen("cat /proc/cpuinfo|grep Hardware|awk -F: '{print $2}'", "r");
			fgets(buffer, 128, pipe);
			pclose(pipe);
			IUSaveText(&SysInfoT[0], buffer);

			//update uptime
			pipe = popen("uptime|awk -F, '{print $1}'|awk -Fup '{print $2}'", "r");
			fgets(buffer, 128, pipe);
			pclose(pipe);		
			IUSaveText(&SysInfoT[1], buffer);

			SysInfoTP.s = IPS_OK;
			IDSetText(&SysInfoTP, NULL);
						
			counter = 10;
		}
		counter--;
		
		SetTimer(1000);
    }
}
const char * IndiRpibrd::getDefaultName()
{
        return (char *)"Astroberry Board";
}
bool IndiRpibrd::initProperties()
{
    // We init parent properties first
    INDI::DefaultDevice::initProperties();

    IUFillText(&SysTimeT[0],"LOCAL_TIME","Local Time",NULL);
    IUFillText(&SysTimeT[1],"UTC_OFFSET","UTC Offset",NULL);
    IUFillTextVector(&SysTimeTP,SysTimeT,2,getDeviceName(),"SYSTEM_TIME","System Time",MAIN_CONTROL_TAB,IP_RO,60,IPS_IDLE);

    IUFillText(&SysInfoT[0],"HARDWARE","Hardware",NULL);    
    IUFillText(&SysInfoT[1],"UPTIME","Uptime (hh:mm)",NULL);
    IUFillTextVector(&SysInfoTP,SysInfoT,2 ,getDeviceName(),"SYSTEM_INFO","System Info",MAIN_CONTROL_TAB,IP_RO,60,IPS_IDLE);
    
    IUFillSwitch(&Switch1S[0], "SW1ON", "LOW", ISS_ON);
    IUFillSwitch(&Switch1S[1], "SW1OFF", "HIGH", ISS_OFF);
    IUFillSwitchVector(&Switch1SP, Switch1S, 2, getDeviceName(), "SWITCH_1", "Camera Cooler", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);

    IUFillSwitch(&Switch2S[1], "SW2ON", "ON", ISS_OFF);
    IUFillSwitch(&Switch2S[0], "SW2OFF", "OFF", ISS_ON);
    IUFillSwitchVector(&Switch2SP, Switch2S, 2, getDeviceName(), "SWITCH_2", "Dew Heater", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);

    IUFillSwitch(&FocusS[0], "FINC", "IN Coarse", ISS_OFF);
    IUFillSwitch(&FocusS[1], "FINF", "IN Fine", ISS_OFF);
    IUFillSwitch(&FocusS[2], "FOUTF", "OUT Fine", ISS_OFF);
    IUFillSwitch(&FocusS[3], "FOUTC", "OUT Coarse", ISS_OFF);
    IUFillSwitchVector(&FocusSP, FocusS, 4, getDeviceName(), "FOCUS", "Focussing", FOCUS_TAB, IP_RW, ISR_ATMOST1, 0, IPS_IDLE );


    return true;
}
bool IndiRpibrd::updateProperties()
{
    // Call parent update properties first
    INDI::DefaultDevice::updateProperties();

    if (isConnected())
    {
		defineText(&SysTimeTP);
		defineText(&SysInfoTP);
		defineSwitch(&Switch1SP);
		defineSwitch(&Switch2SP);
		defineSwitch(&FocusSP);	
    }
    else
    {
		// We're disconnected
		deleteProperty(SysTimeTP.name);
		deleteProperty(SysInfoTP.name);
		deleteProperty(Switch1SP.name);
		deleteProperty(Switch2SP.name);
		deleteProperty(FocusSP.name);
    }
    return true;
}
void IndiRpibrd::ISGetProperties(const char *dev)
{
    INDI::DefaultDevice::ISGetProperties(dev);

    /* Add debug controls so we may debug driver if necessary */
    //addDebugControl();
}
bool IndiRpibrd::ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
{
	return INDI::DefaultDevice::ISNewNumber(dev,name,values,names,n);
}
bool IndiRpibrd::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
{
	// first we check if it's for our device
    if (!strcmp(dev, getDeviceName()))
    {
		// handle switch 1
		if (!strcmp(name, Switch1SP.name))
		{
			IUUpdateSwitch(&Switch1SP, states, names, n);

			if ( Switch1S[0].s == ISS_ON )
			{
				bcm2835_gpio_write(IN1, LOW);
				IDMessage(getDeviceName(), "Camera Cooling LOW");
				Switch1SP.s = IPS_IDLE;
				Switch1S[1].s = ISS_OFF;
				IDSetSwitch(&Switch1SP, NULL);
				return true;
			}
			if ( Switch1S[1].s == ISS_ON )
			{
				bcm2835_gpio_write(IN1, HIGH);
				IDMessage(getDeviceName(), "Camera Cooling HIGH");
				Switch1SP.s = IPS_OK;
				Switch1S[0].s = ISS_OFF;
				IDSetSwitch(&Switch1SP, NULL);
				return true;
			}
		}

		// handle switch 2
		if (!strcmp(name, Switch2SP.name))
		{
			IUUpdateSwitch(&Switch2SP, states, names, n);

			if ( Switch2S[0].s == ISS_ON )
			{
				bcm2835_gpio_write(IN2, HIGH);
				IDMessage(getDeviceName(), "Dew Heater OFF");
				Switch2SP.s = IPS_IDLE;
				Switch2S[1].s = ISS_OFF;
				IDSetSwitch(&Switch2SP, NULL);
				return true;
			}
			if ( Switch2S[1].s == ISS_ON )
			{
				bcm2835_gpio_write(IN2, LOW);
				IDMessage(getDeviceName(), "Dew Heater ON");
				Switch2SP.s = IPS_OK;
				Switch2S[0].s = ISS_OFF;
				IDSetSwitch(&Switch2SP, NULL);
				return true;
			}
		}
// ********************************************************************************************************************
		// handle focus
		if (!strcmp(name, FocusSP.name))
		{
			IUUpdateSwitch(&FocusSP, states, names, n);

			if ( FocusS[0].s == ISS_ON )
			{
				FocusSP.s = IPS_BUSY;    //  Yellow Light

       // *************** Call Motor Code Here ************
	            bcm2835_gpio_write(SLEEP, HIGH);  // wake up

			    // INWARD
			    bcm2835_gpio_write(DIR, HIGH);

			    // process targetTicks
			    int ticks = CoarseTicks;

			    for ( int i = 0; i < ticks; i++ )
			    {
			        // step on
 			       bcm2835_gpio_write(STEP, HIGH);
			        // wait
			        bcm2835_delay(STEP_DELAY/2);
			        // step off
			        bcm2835_gpio_write(STEP, LOW);
			        // wait 
			        bcm2835_delay(STEP_DELAY/2);
				}
			    // motor sleep
			    bcm2835_gpio_write(SLEEP, LOW);

				IDMessage(getDeviceName(), "Focus IN Coarse");
				FocusSP.s = IPS_OK;     		 // Green Light
//                bcm2835_delay(LIGHT_DELAY);		 // Enough time to see Green light
//				FocusSP.s = IPS_IDLE;    		 // Light off
				FocusS[0].s = ISS_OFF;  		 // Clear Button
				IDSetSwitch(&FocusSP, NULL);
				return true;
			}

			if ( FocusS[1].s == ISS_ON )
			{
				FocusSP.s = IPS_BUSY;		    //  Yellow Light

       // *************** Call Motor Code Here ************
	            bcm2835_gpio_write(SLEEP, HIGH);  // wake up
			    // INWARD
			    bcm2835_gpio_write(DIR, HIGH);
			    // process targetTicks
			    int ticks = FineTicks;

			    for ( int i = 0; i < ticks; i++ )
			    {
			        // step on
 			       bcm2835_gpio_write(STEP, HIGH);
			        // wait
			        bcm2835_delay(STEP_DELAY/2);
			        // step off
			        bcm2835_gpio_write(STEP, LOW);
			        // wait 
			        bcm2835_delay(STEP_DELAY/2);
				}
			    // motor sleep
			    bcm2835_gpio_write(SLEEP, LOW);
				IDMessage(getDeviceName(), "Focus IN Fine");
				FocusSP.s = IPS_OK;      		// Green Light
//                bcm2835_delay(LIGHT_DELAY);  	// Enough time to see Green light
//				FocusSP.s = IPS_IDLE;    		// Light off
				FocusS[1].s = ISS_OFF;   		// Clear Button
				IDSetSwitch(&FocusSP, NULL);
				return true;
			}

			if ( FocusS[2].s == ISS_ON )
			{
				FocusSP.s = IPS_BUSY;    		//  Yellow Light

       // *************** Call Motor Code Here ************
	            bcm2835_gpio_write(SLEEP, HIGH);  // wake up
			    // OUTWARD
			    bcm2835_gpio_write(DIR, LOW);			    
				// process targetTicks
			    int ticks = FineTicks;

			    for ( int i = 0; i < ticks; i++ )
			    {
			        // step on
 			       bcm2835_gpio_write(STEP, HIGH);
			        // wait
			        bcm2835_delay(STEP_DELAY/2);
			        // step off
			        bcm2835_gpio_write(STEP, LOW);
			        // wait 
			        bcm2835_delay(STEP_DELAY/2);
				}
			    // motor sleep
			    bcm2835_gpio_write(SLEEP, LOW);

				IDMessage(getDeviceName(), "Focus OUT Fine");
				FocusSP.s = IPS_OK;      		// Green Light
//                bcm2835_delay(LIGHT_DELAY);  	// Enough time to see Green light
//				FocusSP.s = IPS_IDLE;    		// Light off
				FocusS[2].s = ISS_OFF;   		// Clear Button
				IDSetSwitch(&FocusSP, NULL);
				return true;
			}

			if ( FocusS[3].s == ISS_ON )
			{
				FocusSP.s = IPS_BUSY;    		//  Yellow Light

       // *************** Call Motor Code Here ************
	            bcm2835_gpio_write(SLEEP, HIGH);  // wake up
			    // OUTWARD
			    bcm2835_gpio_write(DIR, LOW);		
			    // process targetTicks
			    int ticks = CoarseTicks;

			    for ( int i = 0; i < ticks; i++ )
			    {
			        // step on
 			       bcm2835_gpio_write(STEP, HIGH);
			        // wait
			        bcm2835_delay(STEP_DELAY/2);
			        // step off
			        bcm2835_gpio_write(STEP, LOW);
			        // wait 
			        bcm2835_delay(STEP_DELAY/2);
				}
			    // motor sleep
			    bcm2835_gpio_write(SLEEP, LOW);

				IDMessage(getDeviceName(), "Focus OUT Coarse");
				FocusSP.s = IPS_OK;      		// Green Light
//                bcm2835_delay(LIGHT_DELAY);  	// Enough time to see Green light
//				FocusSP.s = IPS_IDLE;    		// Light off
				FocusS[3].s = ISS_OFF;   		// Clear Button
				IDSetSwitch(&FocusSP, NULL);
				return true;
			}
		}


	}
	return INDI::DefaultDevice::ISNewSwitch (dev, name, states, names, n);
}
bool IndiRpibrd::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
{
	return INDI::DefaultDevice::ISNewText (dev, name, texts, names, n);
}
bool IndiRpibrd::ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
{
	return INDI::DefaultDevice::ISNewBLOB (dev, name, sizes, blobsizes, blobs, formats, names, n);
}
bool IndiRpibrd::ISSnoopDevice(XMLEle *root)
{
    return INDI::DefaultDevice::ISSnoopDevice(root);
}
bool IndiRpibrd::saveConfigItems(FILE *fp)
{
	IUSaveConfigSwitch(fp, &Switch1SP);
	IUSaveConfigSwitch(fp, &Switch2SP);
        
    //controller->saveConfigItems(fp);

    return true;
}
bool IndiRpibrd::LoadLines()
{
	// load line 1 state
	if ( bcm2835_gpio_lev(IN1) == LOW )
	{
		Switch1S[0].s = ISS_ON;
		Switch1S[1].s = ISS_OFF;
		Switch1SP.s = IPS_IDLE;
		IDSetSwitch(&Switch1SP, NULL);
	}
	else
	{
		Switch1S[0].s = ISS_OFF;
		Switch1S[1].s = ISS_ON;
		Switch1SP.s = IPS_OK;
		IDSetSwitch(&Switch1SP, NULL);
	}

	// load line 2 state 
	if ( bcm2835_gpio_lev(IN2) == LOW )
	{
		Switch2S[0].s = ISS_ON;
		Switch2S[1].s = ISS_OFF;
		Switch2SP.s = IPS_OK;
		IDSetSwitch(&Switch2SP, NULL);
	}
	else
	{
		Switch2S[0].s = ISS_OFF;
		Switch2S[1].s = ISS_ON;
		Switch2SP.s = IPS_IDLE;
		IDSetSwitch(&Switch2SP, NULL);
	}

	return true;
}

 

Link to comment

I think the reason for irregular indents above is that some are spaces and some tab.  The tabs are 4 spaces in the editor and 8 spaces here.

Link to comment

Looking at this briefly I noticed you mentioned not even attempting this if you have a DSLR camera for your imaging rig... Is this still the case or are there now workarounds and drivers that enable this? It probably doesn't help that I have a Nikon camera as well! haha.

I'd really like to get a setup like this though as it saves leaving a laptop outside all night just as a headless setup. Would be much nicer with all the cables going into a pi and running that instead! :) 

Link to comment

@Gina this is a great tutorial! Thanks for your work!

I have just joined the forum so if you or anybody else need help with astroberry-diy drivers... I come to serve ?

Clear skies!

Radek Kaczorek
Astroberry Server | NEQ6 | Atik 460EX | Atik EFW2 | ASI 120MM

  • Like 1
Link to comment

Hi Radek - great to see you here - welcome to SGL ?  Your work on INDI drivers has been extremely helpful :thumbsup:

  • Thanks 1
Link to comment
On 16/10/2018 at 16:49, simondodd said:

Looking at this briefly I noticed you mentioned not even attempting this if you have a DSLR camera for your imaging rig... Is this still the case or are there now workarounds and drivers that enable this? It probably doesn't help that I have a Nikon camera as well! haha.

I'd really like to get a setup like this though as it saves leaving a laptop outside all night just as a headless setup. Would be much nicer with all the cables going into a pi and running that instead! :) 

It's several years since I used a DSLR for astro imaging and never tried with the RPi.  I think the main issue is whether anyone has written an INDI driver for a DSLR.  I would imagine it's possible.  You could try Google (other search engines are available) or the INDI forum.

Link to comment
Gina

Posted (edited)

With lots of problems with the firmware for my all sky camera I decided to take an already corrupted micro SD card and install a new system on it.  Downloaded the latest Ubuntu Mate (18-04-02 beta) and installed it using the latest version of Etcher.  After editing config.sys according to AstroPi3, put the card in the RPi connected to monitor, keyboard and trackball and ran Mate.  After the initial setup I set up WiFi which was simply a matter of entering the password and connecting.  Went onto github with Firefox, read the AstroPi3 script (on RPi this time) and followed the instructions.  All went well until I tried tried to run the script when I got an error message "dpkg locked" and to wait or stop the app that was running.  Waited over an hour but still the same.  Ran the System Monitor and there was nothing running except itself.  At this point I'm stumped.

Edited by Gina
Link to comment
Gina

Posted (edited)

I have just run through this procedure to install Ubuntu Mate and INDI drivers to a new micro SD card for my widefield imaging system.  I have followed the instructions on the AstroPi3 and Astroberry DIY sites on github precisely with no errors.  Radek has updated his Astroberry DIY code since my earlier go at this and has removed the drivers that were causing problems.  In view of this I shall write a new Tutorial to replace this one. 

All that remains to get my widefield rig working is to check my stepper driver connections against Radek's and adjust if required.  If/when the connections match I expect to use Radek's Astroberry Focuser driver with KStars/Ekos for auto-focussing.

Edited by Gina
Link to comment

Have checked A4988 driver module connections and DIR, STEP & SLEEP are the same as are MS1 & MS2 but I have MS3 connected to Gnd rather than GPIO24.  I can get the soldering iron out and change the MS3 connection to comply exactly with Radek's arrangement.

Link to comment

I'm considering combining the altered version of this tutorial with my earlier one where I included the hardware for remote focussing and controlling a dew heater.  Alternatively, I could write two separate tutorials - one with just the AstroPi3 for all the standard INDI drivers and the other for adding a DIY focuser involving the Astroberry DIY github project and details for adding dew heater and possibly other controls.

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