SPIX a program for the SPECTRUM (48k) to decode and display CCD images from UoSAT-1/OSCAR-9 USER'S GUIDE N.P. Taylor (G4HLX) 46 Hunters Field Stanford in the Vale Faringdon Oxon. SN7 8LX Program and explanatory material Copyright © 1986 N.P. Taylor 1. Introduction The UOSAT-1/OSCAR-9 (UO-9) satellite was designed and built at the University of Surrey and launched by NASA on 6th October 1981. It carries a number of experiments which generate data which are sent to ground stations on the two data beacons in the 145 and 435 MHz bands, using an AFSK modulation that can easily be received on simple amateur narrow band FM equipment. Amongst these experiments is the CCD imager, which is capable of recording visual images of the earth's surface. The CCD camera generates an image composed of 256 x 256 pixels, each of which is assigned a value on a 16-level grey scale. When the camera is pointed directly downwards, the image represents an area of around 480 x 480 km of the ground surface. The resolution of the image is somewhat poorer than those provided by the weather satellites such as the NOAA series, but the UoSAT system has the advantage that the signals can be received, decoded and displayed with simple low-cost equipment. With the SPIX program the minimum of hardware is required : an FM receiver and a Spectrum computer. 2. General Information The CCD image, stored in the spacecraft's on-board video memory, is transmitted as a serial data stream on the 145.825 MHz beacon. The grey level for each pixel is sent as a 4-bit value, and there are no start or stop bits, no parity bits, no checksum or other error check. Special 32-bit synchronizing codes are inserted at the start of each line, with a 1024-bit sequence marking the start of each frame. The entire image is transmitted in about 3.75 minutes, using the standard 2400 Hz and 1200 Hz tones for mark and space, frequency modulating the beacon transmission. The signal can be received on a simple FM receiver, the audio output of which can be fed directly into the "ear" socket of the Spectrum while SPIX is running, or alternatively to a cassette recorder for storing and decoding later. The SPIX program decodes the tones and continually searches for line and frame sync codes, filling a 32 Kbyte (i.e. 64 K-pixel) buffer with the image. SPIX will then display the stored image in one of two ways. The first is the "preview" format which is shown on the monitor screen. Either the first or last 176 lines of the image are displayed, at the full 256-pixel width. There is no grey scale in this format, each pixel being either on or off. The value at which the on/off transition occurs in the 16-level grey scale is setable by the user, so that the image can be viewed with the black/white level varied until optimum contrast is achieved. The second display format allows the full resolution and grey-scale information to be shown. This is achieved by printing onto a ZX, Alphacom 32, or similar printer, or any device which correctly obeys the BASIC command COPY. The image is dumped to the printer as four strips, which must be separated and glued together to form the complete frame. In this way 1024 x 1024 dots comprise the complete image, so that each of the 256 x 256 pixels is represented by a 4 x 4 dot pattern, a pattern of different density representing each level in the grey scale. A "negate" option inverts the video of the stored image, i.e. black becomes white and vice versa. Finally the stored image may be saved on tape or microdrive, to be reloaded and displayed later. In this user's guide to the SPIX progarm, it is assumed that you already know how to receive signals from the UoSAT satellites. The CCD experiments are only a part of a full schedule of transmissions from UO-9. To find the days on which the CCD image experiment is due to be active, see the news bulletins sent regularly by UO-9 and UoSAT-2/OSCAR-11 (UO-11). The full general news bulletin is usually sent at weekends, but the shorter bulletin which gives schedules of transmissions is sent frequently by the DIARY system on most days. These news bulletin transmissions are 1200 bps ACSII carried on the 145.825 MHz beacon. They may be decoded and displayed using a Spectrum computer with the SUDD program, available from G4HLX. Like SPIX, this program operates with no interface, just needing a direct audio connection to the "ear"socket. In addition to the text transmissions, SUDD (which handles both UO-9 and UO-11 data) also decodes the standard telemetry data. One final general point : SPIX decodes CCD images sent by UoSAT-1/OSCAR-9. The CCD image experiment on UoSAT-2/OSCAR-11 uses a different data transmission format, which cannot be decoded by this program. 3. Using SPIX The audio signal received from UO-9 must be connected to the Spectrum "ear" socket, and supplied at a level similar to that used for loading programs from tape. Some experimentation with the level of the audio can be beneficial. Although a direct output from the 145 MHz FM receiver (from the loudspeaker or headphone jack) is suitable, it is recommended that the signals are recorded first on tape and re-played into the Spectrum at a later stage. When scheduled for CCD transmissions, the satellite will usually send the image repeatedly, and it does not matter where in the cycle one starts when re-playing the signal into the Spectrum. Since a near overhead pass of UO-9 should provide good signals for 10 minutes or more, and a complete image is sent in a little under 4 minutes, recording the entire pass on tape enables you to select the clearest 4 minutes of signal for decoding. After loading SPIX from tape (using LOAD "SPIX" or just LOAD "") , you will see the main menu. Selections from this menu are made simply by pressing the key indicated. The effect of the various options are described below. 3.1 "D" - Demodulate Signal This will usually be the first option to be used. It causes SPIX to read the signal fed into the "ear" socket, demodulating the tones to recover the binary data, checking this for valid line sync. codes and loading the data into a 32 Kbyte buffer. While you are playing your recording (or live signals) into the ear socket, you will see a number of things on the screen. Firstly, the border should show a pattern similar to that obtained when loading programs, except that the colours are now magenta and green. Secondly there is the "front panel" display which features four "lights". The two lights on the left hand side show when a "mark"or "space" tone is being received. These should normally be flickering on and off, although if the picture contains a lot of black tone (i.e. the camera is not earth-pointing), the mark lights will predominate. The other two lights give an indication of when valid syncronization codes have been received. The "line" light changes colour at each line sync. Thus this light should alternate between yellow and red regularly, switching colour a little faster than once per second (actually every 880 msec). If it is not doing so at all, something is wrong : if the signal is fairly noise-free it is likely that the satellite is not sending a CCD image, but some other data (with experience you will learn to recognize the characteristic sound of a CCD image). If the line sync light is switching colour, but not regularly at about once per second, the signal is not being decoded correctly, probably because of too much noise. For a complete and perfect image to be decoded, this line sync light must be flashing red/yellow for the entire 3.8 minute duration. If it does not, a partial image may still be obtained. Note that the buffer is being filled only while the line sync light is switching colour (128 bytes filled each time), so that if there are periods during which it does not flash, the time taken to fill the biffer will exceed the nominal 3.8 minutes. Of lesser importance is the "frame" sync light. This will come on once only to indicate that a valid start-of-frame code has been received. This is used when displaying to correctly frame the image - but if no frame sync code has been received an image can still be produced (but it will start at the top of the buffer, wherever that might happen to be in the image). Note that when the demodulate option is invoked on a second or subsequent time, the existing buffer contents are overwritten by the new data as it is received, and the start-offrame position is formally reset to the top-of-buffer until a frame sync code is recognized. The demodulation is halted in one of two ways. Either the 32K buffer becomes full (which means a complete image should have been received), or the process is stopped by pressing the BREAK key (once only). In the latter case, the number of bytes received and stored in the buffer will be given. In both cases, after a pause, the "preview" option is automatically selected (see next section) . 3.2 "p" - Preview Display This option displays the stored image on the monitor screen in the "preview" form as decribed in section 2. When the screen is full, the available options are summarized at the foot of the screen. Either the first or last 176 lines of the image may be viewed, the "up" and "down" cursor keys (keys 7 and 6 on older keyboards) being used to switch from one to the other. If the print option is selected by pressing "P", the entire image (all 256 lines) is sent to the printer in this "preview" format. The point on the 16-level grey scale at which the black/white transition is made is set by using the "left" and "right" cursor keys (keys 5 and 8 on old-style keyboards). The figure shown in the top right corner of the screen is the currently selected level, which varies between 1 (for the blackest) and 15 (the lightest). Experimentation with this level can be rewarding, each image having its own optimum setting, and different features of the picture being enhanced at different settings. 3.3 "F" - Full resolution print Before selecting this option, ensure that the printer is online and loaded with sufficient paper. The full resolution image, with complete grey-scale information as a dot shading pattern, as described in section 2, will be dumped to the printer. This is done in four strips, each of which is produced by six consecutive screen dumps. To assemble the entire image, separate the four strips, cut one white margin from each strip and glue them together side-byside, carefully aligning at the ends. A problem may arise when using thermal printers if an image contains a lot of black tones. The print head gradually heats up over the relatively long time taken for the print, causing the blackness of the image to increase, until the isolated white dots in patterns representing dark tones cannot be seen at all. One way of obtaining a satisfactory print in such a case is to negate the image first (see next section), so that it is predominantly white, and the head does not generate so much heat. Of course, the image so obtained is in negative; the purist offended by this may like to photograph the printed image and invert it photographically. 3.4 "N" - Negate Image This option simply "inverts" the video of the stored image, i.e. changes the positive image to a negative one. Invoking the option a second time changes it back to the original again. Some features of an image may appear more dominant in the negative form. Another possible reason for negating the image, connected with the use of thermal printers and a very black image, was mentioned in the previous section. 3.5 "T" - Save/Load on tape or microdrive A further menu is displayed after selecting this option, which enables the entire stored image to be saved on cassette tape or microdrive cartridge, or a previously saved image to be re-loaded ready for display. The data saved in these operations consists of 32770 bytes, comprising the 32K buffer preceded by a 2-byte value, the address of the start-of-frame. In each case you will be asked to enter the required filename, which must conform to the usual Spectrum conventions. In the case of the microdrive save, the cartridge must not already contain a file with this name. 4 Restarting SPIX The execution of the SPIX program can be halted at most times by the BREAK key. Control is returned to BASIC. This may also happen if certain error conditions arise, for example a tape or microdrive error during save/load operations. In any case, SPIX can be restarted with the normal RUN command, with no loss of data from the stored image. 5 Making a copy of SPIX The SPIX program is copyright. You are however, free to create a back-up copy or transfer the program to microdrive for your own personal use. This is easily done by a "hidden" option on the display menu. Press SYMBOL SHIFT and "S" together; this will display a menu offering tape or microdrive saves. In either case, two files are saved, named "SPIX" (the BASIC) and "SPIXC1" (the machine code). In the case of a microdrive save (which is always to drive no. 1), files with these names must not pre-exist. The saved program may be loaded again using LOAD "SPIX" or LOAD*"m";1;"SPIX", as appropriate, which will also cause the second file to be loaded. 6 Miscellaneous hints and tips On the reverse of the SPIX tape is a sample CCD image received from UO-9, to enable you to experiment with the use of the program. This should be replayed in the usual way into the "ear" socket. Normally this will give good copy, but this is dependent on the characteristics of the replayed signal, which are rather more critical than those of a saved program. Experimentation with the audio level on replay can pay dividends. Correctly set head azimuth is important for good copy. In a few cases, if the signal from the cassette player is very assymetrical, improved decoding of the sample image may be had if the audio connections from the cassette to the Spectrum are inverted, i.e. the outer of the jack plug at one end of the lead is connected to the inner at the other and vice versa. But be careful : this can only be done if there is no other common earth connection between cassette machine and computer, otherwise damage may result. Ideally a battery-powered cassette player should be used if this inversion is attempted. The above comments relate only to replaying the sample image, and result from possible incompatibilities between your cassette machine and that used to record the data. You should find no problem in recording signals from UO-9 yourself and replaying them on the same cassette machine. To receive a perfect image, signals must be noise-free for the entire 3.8 minute duration of a transmitted frame. In some areas, in which man-made interference is a problem, better results may be had by receiving the data during an overnight pass, by some arrangement in which the cassette recorder switches on automatically when a signal is received. It should be possible to receive good strength signals from UO-9 with a simple antenna. However, if noisy signals are a problem and everything has been done to improve the RF side of the receiving system and antenna, a matched audio filter might be considered. A particularly effective design is the current version of the UoSAT decoder circuit by G3RUH, originally published in Wireless World, May 1983. In the newer version of this design, the tones are regenerated from the demodulated signal. These can be fed to the Spectrum ear socket as before (after some amplification), the whole system then being highly optimized. Note that the tones output by this circuit are to the UO-11 standard (inverted with respect to UO-9 tones); correct tones for SPIX (or SUDD) will be obtained by leaving the selector switch at "UO-11" at all times, even when decoding UO-9 signals. Details of this G3RUH UoSAT demodulator can be obtained from AMSAT-UK, who also produce a printed circuit board. A stamped addressed envelope should accompany any enquiry. The address is : AMSAT-UK, 94 Heronsgate Rd., Wanstead Park, London E12 5EQ. Membership of AMSAT-UK is recommended for any amateur satellite enthusiast - the bimonthly journal OSCAR NEWS is a useful source of up to date information. WARNING to ALPHACOM 32 Users Some users of the Alphacom 32 printer have experienced a problem when a printing an image containing a lot of pure black tone. As noted in section 3.3 of the SPIX manual, the print head can heat up in these circumstances. In rare cases, particularly when sub- standard paper is being used, the paper may char and clog up the print head, causing it to jam. Careful cleaning of the print mechanism may cure the fault. To avoid this problem, Alphacom 32 users are advised, when a predominantly black image is received (such as the sample supplied), to negate the image (see section 3.4 of users guide) before using option "F". The use of thermal paper of correct quality is also recommended.