*** UNDER CONSTRUCTION ***
Set up using a PC
As usual, start by installing the SDHC image writer (Win32DiskImager) on your PC, then download Pi CLI Jessie lite.
The Pi Astro-cam will be controlled from a CLI (Command Line Interface) via it's Ethernet cable and your LAN from your PC. To access the Pi via your LAN, I recommend PuTTY - so install that on your PC next
Prepare the SDHC card
'Burn' the Jessie image to a SDHC card (use at least a 4Gb (class 4) chip). After 'burning', Windows will only 'see' the small FAT32 partition. This partition contains both config.txt and cmdline.txt, both of which you can change on the PC, to make things easier, before movomg it to the Pi.
config.txt changes
To enable TV out (and disable HDMI), in config.txt, remove the # from front of the line "#sdtv_mode=2" (i.e. change so it looks like below) :-
# uncomment for composite PAL
sdtv_mode=2
By default, the aspect ratio of the TV out is 4:3. If your display differs, add one of the following :- sdtv_aspect=1 4:3 sdtv_aspect=2 14:9 sdtv_aspect=3 16:9
To avoid any possibility of the text 'falling off the edge' of an (analogue) display, in config.txt, remove the # from front of each of the 4 "#overscan_.." lines :-
overscan_left=16
overscan_right=16
overscan_top=16
overscan_bottom=16
To enable the camera (and disable the camera 'activity' LED), in config.txt add the lines :-
start_x=1
disable_camera_led=1
For more on config.txt see elinux.org documentation
cmdline.txt changes
If you will always plug the Astro-cam into your LAN, where it can use DHCP to get it's own IP address, you don't need to set a specific IP address
However, if you will ever use it 'in the field' i.e. with a direct connection to your PC (with no Router so no DHCP), then, when DHCP fails, the Pi randomly chooses an address in the 169.254.X.X range, i.e. it could be any of 65,000 !.
You start by adding at the end of the single line of text in cmdline.txt a command (between 'rootwait' and 'quiet') to force a specific IP. After the Pi boots, you then have to change the /etc/network/interfaces file (if you want the Pi to reach the Internet). The command definition is:- ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<dhcp> So, to set the Pi to ip=192.168.1.100 with your PC (server) at ip=192.168.1.1 and disable dhcp modify the line as follows :-
rootwait ip=192.168.1.100::192.168.1.1:255.255.255.0:rpi:eth0:off quiet
NOTE If you don't include the 'off', then the Pi will launch it's dhcp client which will fail to get an address and then replace whatever you specified in cmdline.txt with some random address in the 169.254.X.X range !
Once the Pi boots and you can SSH to it at 192.168.1.100 (or whatever you chose), you can remove the cmdline.txt change and replace it with the 'proper way' to set a static IP i.e. sudo nano /etc/network/interfaces and modify the iface eth0 setting as follows :-
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
For some more about cmdline.txt, see elinux.org documentation
NOTE. This applies to Pi Zero running in 'normal' mode (i.e. with a USB Ethernet 'dongle'). For the Pi Zero running in 'USB Device' mode (i.e. directly connected by USB cable to your PC) see my Using the Pi Zero as a USB device page
On first boot-up
Plug in the PoE cable and let the Pi boot. The last command in cmdline.txt is " init=/usr/lib/raspi-config/init_resize.sh" = this will auto-resize to the SDHC card max and then remove that instruction from cmdline.txt and, after a 5 second delay, reboot the Pi. So be patient ..
It doesn't seem to be possible to specify a max. expand (eg '200Mb less than 4G so we can always back up out 4G cards'), so you are stuck with 'all' (leave it to do it's thing) or 'none' (delete the command before plugging in the SDHC card). Unless of course, you are prepared to modify the 'init_resize.sh' script yourself (don't forget to mod. cmdline.txt before plugging the SDHC into your Pi :-) )
After the reboot, you can connect to connect to and control the Pi using SSH (eg PuTTY) from your PC
Taking still photos (raspistill, raspistillyuv)
By default, the camera displays a 5 second 'preview' before taking the shot. To suppress the preview display, use the '-n' option. To set the preview time, use '-t n' (n= mS delay before taking the shot, so '-t 5000' = same as default). The '-f' option sets a full screen preview and the '-fp' option sets 'full resolution preview' mode (i.e. shows exact same size as the capture will be) at 15fps
For a series of time-lapse images, use the '-tl n' option (where n is the 'gap' (in mS) between shots, where '0' means 'as fast as possible') which then redefines the -t parameter as the total sequence time (in mS, where '0' means 'run for ever'). In -tl mode, the '-o' file name can include '%04d' to insert 4 digit serial number (or %06d for 6 digits etc). For example :-
raspistill -t 30000 -tl 2000 -o photo%02d.jpg
This will spend 30 seconds taking shots at 2 second intervals (so 15 shots). The files will be placed in the current directory and named 'photo00.jpg' to 'photo.14.jpg' inclusive.
By default, the output file only** contains JPEG (or YUV420, for raspistillyuv). You can add RAW to the file with the '-r' option. Other output formats are set using the '-e' option (gif, jpg, bmp), however encoding for other formats is down by the CPU (whilst JPEG and RAW is handled by the GPU), so these choices will actually take longer to 'save' the image than using RAW. NB. raspistillyuv has an extra option, '-tgb', which saves the image in RGB888 (8 bits per channel) rather than the default YUV420.
** actually, by default, the JPEG file also includes a thumbnail, which slightly increases the file size and adds to the overall 'save' time. To specify no thumbnail use '--thumb none'.
The maximum rate at which you can take photos 'depends'. When saving full sized photos, the system is data rate limited - even saving to ram-disk you will be lucky to exceed 3.5 fps. If you reduce the photo size, the rate goes up to 5fps (at 640x480), however I've never got anything near the 'theoretical' max. of 15fps
For max. speed test of 10 seconds :- sudo raspistill -iso 800 -n -bm -o %02d.jpg -t 10000 -tl 0 --thumb none (further time might be saved if AWB is disabled ('-awb off') or 'use same as last' ('awbg'))
ISO 800 is the max. = if you don't specify, the Pi typically 'auto-selects' 200 ISO and that means longer exposure times. The '-n' and '-bm' options tell raspistill that no preview is required and not to 'switch modes' back to preview after each image is taken.
To control the taking of photos from the CLI (PuTTY) window, use the '-k' option ('enter' = take image, X enter = abort)
If your camera is 'upside down', use the horizontal and vertical flip options ('-hf', '-vf') Other options for getting the photo you want :- '-ss 6000000' = shutter speed max (6000000 nano seconds = 6 seconds). '-sh 50' = sets the 'sharpness' (50 = same as default ?) '-br 50' = sets the 'brightness' (it's unclear what this does, perhaps some 'boost' after the basic ISO perhaps ?) '-sa -75' = sets the 'saturation (boosts the 'colourfulness' of the image) '-ev 24' = sets the 'ev' to + 24 * 1/6ths = 4 stops (max + gain). It's unclear how this works (if at all) with ISO 800 (max.) '-awg off -awbg 1,1' = when you disable auto White Balance, red and blue gain is set 0 (so you get green images). -awbg sets r+b to '1' (same as g)
Note, if the resulting image is too bright, it's likely reducing the ISO (down as far as 100) will give a better image (less 'grain') before reducing the exposure time (less 'noise')
Flat-field correction
You have to apply your own flat-field correction
The GPU applies a 'standard lens shading correction table' to the RAW sensor data whilst generating the JPEG. It's not possible (as of Sept 2016) to prevent this (or replace the table) - so if you remove the standard lens, all 4 'corners' of the sensor will still be 'boosted', so your 'flat field' JPEG will come back with a sort of 'anti-vignette' effect, whilst the RAW should be correct :-)
Note that the 'still image' exposures are achieved using a slow 'rolling shutter'. This means the last scan line of the image will be 'read' from the sensor about 1/3rd seconds after the first (not a problem with stars, could be an issue with meteors !)
For a really good explanation of how the camera works, see here (it's aimed at Python users, not CLI, however the hardware is the same)
Viewing images
'Local viewing' (via TV out) can be achieved with some variation of the Photoframe display method
Essentially, the fbi utility is allowed to 'run for ever' showing 'dummy' images that have been 'aliased' to the real photos. A second script than 'watches' the ram-disk (or wherever new photos are saved), generates a thumbnail and 'switches' the alias
Streaming via Ethernet
Real-time focusing means viewing the video stream on a local PC.
The easy way to do this is to just wire the Pi 'TV out' to a locally positioned AV display. It's also 'dead easy' for the Pi to place still-image photos into a local or remote 'shared folder' allowing them to be viewed on a PC. More difficult is to have the Pi 'transmit' a movie stream via Ethernet to a PC A typical full HD (h264) data stream requites less than 4Mbytes/s = 32mbps, so a 100mbps Ethernet link should have no problems keeping up. At the PC end, the Open Source VLC media player is an ideal choice of viewer
Autoguiding
One obvious use of the Pi is as an auto-guider (on a small co-mounted 'guide scope') to 'direct' the main telescope for long exposure DSI with a SLR.. The tiny pixels are ideal for 'spotting' a deviation from the guide star in time to prevent 'streaking' or 'smearing' of the main image
For more details see my page