Showing posts with label dome. Show all posts
Showing posts with label dome. Show all posts

Friday, June 1, 2012

Controling Devices With JSON

RTS2 has an XMLRPC which also supports JSON. This make it very easy to poll and control devices external of the driver. Here is a simple example of controlling the Tban fan controller based on temperature difference between inside the dome and the outside ambient temperature.




from rts2json import jsonProxy, createJsonServer 
import socket
import xmlrpclib
import json
import httplib

#connect to server
createJsonServer('localhost:8889','','')

#get temps from devices
externalTemp = jsonProxy().getValue('S0','TEMP_AMB')
internalTemp = jsonProxy().getValue('S2','DS1')

#calc the difference
diffTemp = internalTemp - externalTemp

#set the fan speed based on rules
if diffTemp < 0:
    jsonProxy().setValue('S2','MFanCon',0)

elif diffTemp > 7:
    jsonProxy().setValue('S2','MFanCon',3)

elif diffTemp > 4:
    jsonProxy().setValue('S2','MFanCon',2)

elif diffTemp > 0:
    jsonProxy().setValue('S2','MFanCon',1)

The rts2json is in the RTS2 repo. Simply connect via a JSON proxy and get and set values of devices. The script is set to a 15 minute cron and adjust fans speeds accordingly.

Tuesday, February 7, 2012

Dome in Motion



Lee closes up the dome after we finished some testing.

Monday, September 26, 2011

Problems of 9/25/2011

Got a lot accomplished since last list but as usual more problems creep up over time.

Software
  • Focus driver - implementing in RTS2 - DONE
  • AstroHaven dome driver needs update to stop spamming error messages and to add feedback from new dome control hardware
  • TBan driver needs code to handle when device is not there rather than spam messages - DONE
  • Add user friendly GUI to control primitive features of the system
  • Possibly add Android app interface/add
Hardware
  • Ordered another Webswitch, they are so cool - DONE
  • Mount Telescope and pier - DONE
  • Buy cabling management for inside of dome
  • Repair crack in AstroHaven Dome
  • Still need to spec out computer capable of extreme temperatures. Computer still needs to have PCI slots and serial ports. Don't want to use USB<->Serial
  • Draw a plan for UPS during extreme temps - put off
  • Add lens heater on LX200GPS to reduce night dew.
  • Corrosion on BigNG board - ordered new one - DONE

Monday, July 18, 2011

Fixing AstroHaven Enterprises dome driver

Timing is everything and especially so when it comes to computers.

When issuing a command the dome controller will run the command exactly for one second. So when writing the driver the code to open and close the leafs were dead simple. Or so I thought so......


cmdSent=0;
response = '\x00';

while(response != POLL_B_OPENED && cmdSent < MAX_COMMANDS)
{
sconn->writePort(CMD_B_OPEN);
sconn->readPort(response);
cmdSent++;
}

if(cmdSent < MAX_COMMANDS)
{
return 1;
}
else
{
return -1;
}


This code simply sends the command and keeps sending till it gets the wanted response. There is a upper limit set in the header file. The variable cmdSent is incrementing to the limit. The limit is just in case something might happen we can report a fail to open or close. A question might come up why we can't simply hard code a number?

Two reason, first is the controller and motors isn't exact. I can't say opening the dome will take X amount of seconds because with age the time to open and close will change. Second this driver will work for all three sizes of AHE domes with same controller. (Heard AHE now ships with different controller) Make it versatile as much as possible.

The problem started when converting the AHE driver from a custom serial driver to the standard RTS2 ConnSerial driver. So simply replaced write and read with the functions of the ConnSerial and tested. Everything worked except the opening and closing.

I worked on this problem for several hours. Mainly it took so long because it was super late and debugging abilities lessen with lack of sleep. :) Can you spot the problem? Hint: readPort() is non blocking......

Originally the serial read function of the custom serial was blocking. So when I replaced with the new code forgot it was non blocking. When this code runs it will reach the upper limit before the leaf started to close or open thus throwing an error and quitting. Quick fix is to sleep giving time for dome controller to move.


while(response != POLL_B_OPENED && cmdSent < MAX_COMMANDS)
{
sconn->writePort(CMD_B_OPEN);
sleep(1); //simple fix here
sconn->readPort(response);
cmdSent++;
}


Lesson learned, never assume anything and RTFM!

Thursday, July 14, 2011

Dome Wiring

Our wiring is out of control! We can't make anything permanent yet because we still have to install major things like the telescope pier. Not to mention we still have some repairs/updates that need to be done to the dome motor system.

In any case, I've cleaned things up a bit and zip-tied some of the longer cables. In the future it would be good to have some shelving or mounting for some of the boxes as well as more tubing or clamps to hold wiring against the wall. On another note, there are some interesting creatures living in the cabling - maybe I'll post a few photos in the future.

Problems of 7/14/2010

In an effort to try to keep on top of issues I have decided to post them. As we solve each problem will write a follow up post explaining how and why we solved it.

Here is a current list the developers (Matt and I) are working on.

Software
  • BigNG sensor has analog sensor dumps but libtban does not return a temperature when calling analog sensor individually. - fixed
  • Apogee Alta CCD camera driver is currently not working. Problem lies in setting binning other than 1x1 will cause camera to hang on next exposure.
  • RTS2 UPS integration has not been started yet. - fixed
  • Convert RTS2 driver to use general SerialConn versus Vermes template. - fixed
  • Meade LX200 driver not talking correctly to LX200GPS - fixed
  • Filter driver - done just needs ported to RTS2 interface
  • AstroHaven Enterprises dome driver not working correctly - fixed
  • Add udev rules for all the USB devices
Hardware
  • Still waiting on AstroHaven Enterprises dome motor replacement.
  • Webswitch III died last weekend. Waiting for support to call use back. Maybe defect/warranty case.
  • Still need to spec out computer capable of extreme temperatures. Computer still needs to have PCI slots and serial ports. Don't want to use USB<->Serial
  • Draw a plan for UPS during extreme temps
  • Add lens heater on LX200GPS to reduce night dew.
We certainly have plenty of things to do and to fix. There are also some problems we don't have solutions for quite yet. Any ideas welcome!

Tuesday, July 12, 2011

Summer Temperatures

A major concern of ours is internal dome temperatures. Right now we have a small ventilation system, but no cooling or heating system. Extreme temperatures will pose a problem because most UPS (uninterrupted power supplies) and computer systems are not designed to handle freezing or extreme heat.

On the left is a plot of our recorded temperature over a few months. The dome doesn't seem to be trapping heat or cooking our components yet. The dome currently houses an experimental computer with no special cooling and most of our required equipment (UPS, weather station, etc). So far the only casualty has been a remotely controlled power strip, but this is probably a defect and not a result of heat.