logging temp, turn off display - Script Writing - CHDK Forum

logging temp, turn off display

  • 5 Replies
  • 5725 Views
logging temp, turn off display
« on: 03 / January / 2013, 15:01:45 »
Advertisements
Hi,
For the purposes of astrophotography, I need to read the optical temperature while shooting some dark frames.  I'd like to write the temp along with the current picture filenumber to a log file to sort out later.  If I can't read temp directly, at least could I take a screenshot of the display or something?

I'd also like to know how to turn the display off while shooting.  I'll be taking shots several minutes long and need to save power.

*

Offline reyalp

  • ******
  • 14117
Re: logging temp, turn off display
« Reply #1 on: 03 / January / 2013, 16:32:58 »
Here's a lua function I wrote to record current date/time, exposure number, temperatures and battery voltage in a CSV file.

The file is opened/closed for each line, which may slow things down but avoids problems with running out of filehandles while shooting. It appends to the file if it already exists.
Quote
function logline()
   local fname='A/log.csv'
   local st=os.stat(fname)
   local f=io.open(fname,'ab')
   if not st then
      f:write('date,exp,ccd temp,opt temp,vbatt\n')
   end
   f:write(string.format('%s,%d,%d,%d,%d\n',os.date('%m/%d/%Y %H:%M:%S'),get_exp_count(),get_temperature(1),get_temperature(0),get_vbatt()))
   f:close()
end
The best way to turn the display off depends on the camera, this has been discussed a bunch of times on the forum. You may find this thread a useful starting point: http://chdk.setepontos.com/index.php?topic=9049.0

edit:
The script I used that in also took dark frames and turned off the backlight, so I'm attaching it here. Note this is a one-off I wrote to try (not very successfully) to catch some geminids, so it's not something you can use as-is but it might be a useful starting point. The dark frame mode makes it take only dark frames, and requires a build with native function calls enabled.

edit #2:
Note the set_raw_nr(1) line disables the default darkframe the canon firmware automatically does for long exposures.

CloseMechaShutter is needed before each shot, because the camera normally closes and opens the shutter only during CCD readout. If your camera can turn off the display completely, it may not open the shutter of the shot, then you'd want a corresponding OpenMechaShutter
« Last Edit: 03 / January / 2013, 16:54:42 by reyalp »
Don't forget what the H stands for.

Re: logging temp, turn off display
« Reply #2 on: 03 / January / 2013, 17:54:57 »
Awesome stuff, thanks.  I ran your function in an infinite loop and it logged 44 lines/s on an sx240 (digic 5).

Re: logging temp, turn off display
« Reply #3 on: 04 / January / 2013, 00:48:00 »
The sensor dropped from 20 to -7 in 15 minutes.  It was pretty linear, though I expected a log response.  There was a suspcious hover around 0 degrees.  Most temps only last 20 seconds, but it stayed at 0 for 1 minute.


*

Offline lapser

  • *****
  • 1093
Re: logging temp, turn off display
« Reply #4 on: 04 / January / 2013, 12:01:22 »
The sensor dropped from 20 to -7 in 15 minutes.  It was pretty linear, though I expected a log response.  There was a suspcious hover around 0 degrees.  Most temps only last 20 seconds, but it stayed at 0 for 1 minute.
0 degrees is the freezing point of water, so it will stay at 0 degrees until all the water on the lens (hopefully on the outside) has frozen. Here's a graph of a fish freezing that illustrates this.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline reyalp

  • ******
  • 14117
Re: logging temp, turn off display
« Reply #5 on: 20 / January / 2013, 16:30:58 »
The sensor dropped from 20 to -7 in 15 minutes.  It was pretty linear, though I expected a log response.  There was a suspcious hover around 0 degrees.  Most temps only last 20 seconds, but it stayed at 0 for 1 minute.
Late reply but anyway... We just return what the firmwares GetCCDTemperature function gives us. By observation, all the temperature functions return celsius and in my experience (comparing values to ambient on soon after powerup) are accurate to at least a few degrees. However, there's no guarantee that it's calibrated to any particular standard, and I suppose it's possible that going far outside the range expected by the firmware gives bad results.
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal