Feature Objective Hardware description
SharpSky Temperature Compensation
The objective of this feature was to introduce temperature compensation to the SharpSky focuser project. The purpose of temperature compensation is to allow the focuser to monitor temperature accurately and subsequently adjust the focus position to compensate for the contraction/expansion of the telescope body and optics as temperature changes over time.
Dave Trewren   15/12/2011
In order to achieve temperature compensation one first has to be able to measure temperature accurately.  To this end I used a 18B20 temperature sensor which has the following basic specification :

-  Temperature range -55C to +125C
-  Accuracy +/- 0.5C of range -10C to +85C
-  Resolution 0.004C
-  Conversion rate 750ms
-  Simple single wire serial interface
-  Very low cost (pennies)

The sensor is powered by the focuser and the data line is connected via PORTB RB3 with a 10k pullup.
Copyright © 2011 by Dave Trewren  ∑  All Rights reserved  ∑  E-Mail: dtrewren@ipwireless.com
Software Description
By far the lionís share of the work for this feature has been software.  I decided at the outset to concentrate the functionality within the SharpSky driver rather than the PIC firmware.  The driver is the master and requests temperature data from the PIC.  Once instructed via USB the PIC checks for the presence of the probe, reads the temperature and subsequently returns temperature data and status information to the driver.  The driver acts on this information locally and also passes information to the client via the ASCOM platform.

Software key features :

-   Allows the user to make the client aware temperature compensation is available
-   Selectable driver enable function to permitting temperature compensation even if the
    client is not capable of supporting the feature
-   Selectable compensation rate in steps/degree C
-   Selectable compensation hysteresis preventing the focuser from hunting or
    compensating too frequently
-   Selectable logging feature, all temperature data, position information and time/date sent
    to a date specific file
-   Separate temperature logging feature allowing timer driven or on-change based logging
    of temperature and position to a file even if compensation is disabled.

SharpSky driver Screenshot
Hardware control
Max Step
largest step count permitted
Max Increament
largest single step increament permitted
Period per step (ms)
The period in ms for each stepper motor step.  Influences the motor speed and torque produced
Backlash adjust (steps)
The number of steps automatically introduced on motor direction change to compensate for machanical backlash
Minimum focuser position
The focuser will stop at this point when decreasing in position
Maximum focuser position
The focuser will stop at this point when increasing in position
USB LED sense
Changes the sense of the USB status LED when connected/disconnected
Temperature compensation
Compensation available yes/no
Informs the client of feature availability
Compensation enable/disable
Enables/disables compensation within the driver
Focuser steps/degree
Amount focuser will move per degree or fraction of degree
Temperature hysteresis (degrees)
Amount by which temperature must change to invoke a move
Direction reverse
Reverses the direction of compensation, ie focuser tube in or out
Logging enable/disable
Enables logging of information to file (see below for detail)
Temperature Logging
Logging enable/disable
Enables/disables function
Logging timer/onchange
Checked, logging at logging period (below).  Clear logging when temperature hysteresis exceeded
Logging period (seconds)
Period after when I log is made assuming enabled
Temperature hysteresis (degrees)
Temperature change required to trigger log if enabled
Versions
Respective driver and PIC firmware versions.  PIC version obtained from PIC device on request
Focuser connect
Connect/disconnect from SharpSky hardware
NOTE : Temperature compensation period is once every ten seconds
Logfile Example
The following shows and example of a temperature log file.  The first example shows logging in timer mode and the second logging in on-change mode.  Log files are generate on the C:\ drive and have the following format : SharpSky_templog_dd-mm-yyyy.txt.  Therefore a new log file will be generated for each imaging night.
I simply put my finger on the sensor for a while and then removed while moving the focusaer about
On change logging with a hysteresis of 0.5C - again applying a finger and moving the focuser about
The new PIC firmware and driver are available on the SharpSky website : www.dt-space.co.uk/SharpSky
Copyright © 2011 by Dave Trewren  ∑  All Rights reserved  ∑  E-Mail: dtrewren@ipwireless.com