Tuesday, April 16, 2013

Conversion Troubles

I have made some progress since last time I posted. I have now create an algorithm that can calculate the local side reel time. This will allow me to figure out where the equatorial coordinate system is currently located, and it will let me track objects with precision. The psudocode for this is made of these three functions:


public float getJulianDate(Date date){
    //calc julain date at 00:00:00 GMT on input date
    month = date.getMonth();
    year = date.getYear();
    day = date.getday();
   
    tempA = int(year/100);
    tempB = 2-tempA+int(tempA/4);
    tempC = int(365.25*year);
    tempE = int(30.6001*(month+1));
   
    return tempB + tempC+ tempE + day + 1720994.5;
}

public float getGST(Date date, Time gtime){
    float jdate = getJuLianDate(date);
    temp = (jdate - 2451545.0)/36525.0;
    temp0 = 6.697374558+ (2400.051336*temp)+(0.000025862*(T^2))+(gtime*1.0027379093);
    while(temp0>24 || temp0<0){
        if(temp0>24)
            temp0 = temp0 - 24;
        else if(temp0<0)
            temp0 = temp0 + 24;
    }
    return temp0;
}

public float getLST(Float longitude, Time ltime, Time utime, Date date){
    float gst = getGST(date, utime);
    Float lst = gst + (longitude/15);
    if(lst<0){
        while(lst<0)
            lst= lst+24;
    }
    else{
        while(lst>24)
            lst = lst-24;
    }
    return lst;
}

Right now, I am trying to figure out the next step. That is reading the Euler angles from my ArduIMU and converting them to a position on the equatorial coordinate system. This is proving to be complicate since the coordinate system literally changes with each passing second. I'm hoping to maybe just calculate this every couple of minutes to check for accuracy and somehow write an algorithm that will follow the movement of the coordinate system between the checks.

I am about half way through figure out the conversion. I believe the yaw is equal to declination and the roll is equal to the right ascension. This make working with declination really simply. I can basically treat it as the radius in a set of polar coordinates. The only problem is instead of starting at 0 it will start at 90 and decrease. Even as it crosses the the celestial equator, I believe this method should work. The right ascension will be a little more tricky since it will be constantly changing. So far this is what I have come up with for it. First I will have to convert hours to degrees (shouldn't be hard, 360/about24=about 15 degrees). At this point, I'm having a little trouble wrapping my head around what I should do next. Obviously local side reel time comes into play since it tells where the coordinate system is at the moment. I think I'm going to have to go and play around with the ArduIMU to better understand what the yaw angle is actually telling me and how it relates to right ascension. If you have any suggestions, feel free to jump in.

Thursday, April 11, 2013

Hello all. This blog will be dedicated to a new project of mine. I am just starting a project to create a tracking system for my Celestron C10-N telescope. I am very interested in astrophotography, but I do not want to pay $750+ for a new computerized telescope mount or a new telescope that includes a computerized mount. I have come up with a plan to create my own tracking system that uses fairly simple parts, and hopefully not too complicated programming.  I plan on using the following parts:
  1. ArduIMU+ V3
  2. 20 Channel EM-406A SiRF III GPS Receiver with Antenna (connects to ArduIMU+ V3)
  3. Two EasyDriver motor drivers from sparkfun.com
  4. One model A Raspberry Pi (I'm using this model to lower my power requirements)
  5. Dual axis motor drive from Celestron #93523 (basic stepper motors to move the telescope)
  6. 4.3" LCD meant for a backup camera system (you can buy them from popular sites, but you can get them for half the price if you search amazon for backup camera lcd and it is the same product)
  7. 2in1 Media keyboard/mouse. (Mine also has a built in laser pointer which will hopefully work well as a star pointer)
  8. Unknown power supplies for all of the above. I'm waiting to build everything so that I can measure how much power I will actually need to have.  
This is how I expect the system to be put together:
  •  The raspberry pi will be the main controller. It will have the 4.3" LCD hooked up to it as well as a 2in1 media keyboard/mouse. This will be where the user interface will be.
  • The ArduIMU will be connected to the RPI through the RPI's GPIO pins. This will be a serial connection.
  • The ArduIMU will provide a few bits of key information from its many sensors:
    • GPS coordinates (longitude and latitude)
    • Heading (or direction I'm pointing, from the GPS unit and the
      magnetometer)
    • Pitch, Roll, and Yaw. These will tell me exactly where the telescope is pointing. I can map these coordinates to match the equatorial coordinate system used for astronomy.
  •  The two EasyDriver motor dirvers will also be connected to the RPI via its GPIO pins. This will allow each motor to be independently controlled enabling them to possibly move at the same time if needed.
  • The motors (there are two of them, hence dual axis above) will be connect to there own EasyDriver.
  • I'm hoping to have one main power source for everything, but I know that the following will need to be connected directly for power: RPI and the EasyDrivers(partially). The Easy drivers will be powered two ways. The actually driver will be powered by the RPI, but the motors they drive will need another power supply that is more powerful. I'm hoping that the RPI will have enough power to power the ArduIMU through the GPIO pins, but I'm not sure if this will work or not.
So far, I have just started. I am mostly just soldering some headers onto a few of the boards so I can attach everything on a bread board before I solder everything together. I have started to program a little, but I am mainly exploring my options on how to achieve some specific things I will need. When I am finished, this tracking system should actually have some advantages over the $750 out of the box solution. For one, my system will include GPS (you might be able to add it on to the out of the box solution, but it will cost even more). This will make my system be more accurate and allow me to move it from place to place while staying accurate. 

My goal is for the following 8 steps to be all I need to do in order to start tracking an object:
  1. Wait for calibration and GPS fix (takes around 20 seconds for the ArduIMU to do this)
  2. Confirm that step 1 actually happened
  3. Set altitude within a certain margin of error. (To align you scope to the celestial north pole you must point it north and however many degrees up that your latitude is) The mount must start out completely level, this must be done manually on my mount with the bubble level built in to the mount.
  4. Set the right ascension and declination to "starting" position (the scope will be looking the celestial north pole after this step, and now the scope will be polar aligned)
  5. Calculate side reel time and get the initial coordinate system, repeating this step at a certain interval. (I will be using the equatorial coordinate system as I have an equatorial mount. This coordinate system moves based on time of day. Side reel time allows you to figure out where coordinate system currently is)
  6. Enter coordinates and go to location (my system will not initially be designed to have any kind of database connected to it. Instead I plan on looking up positions of stars before hand. Eventually I might try to include at least a small database, but they take up quite a bit of space since there are so many entries. I'm going to skip it for now)
  7. Once at the location, calculate speed needed to track the object, recalculate the side reel/coordinate system, move to new location, and engage motor (only one) at tracking speed. (Since we have polar aligned the scope, we should only need to move one motor as long as we aren't tracking something like the ISS)
  8. Check position using side reel time against ArduIMU sensors at a certain interval, and correct position and speed if necessary.