figure 1. a complete nearspace simple 18

30
The NearSpace Simple 18 is an entry-level flight computer. It has everything a flight computer requires, including sensor ports and APRS tracking. As soon as a battery and GPS receiver are connected, it’s ready to collect data and track the near spacecraft. The NearSpace Simple 18 is programmed in PICAXE BASIC, so it’s simple to operate sensors and collect their data. With 32k bytes of memory, data can be collected frequently during a mission. Tracking is provided independent of the PICAXE-18M2 by a Tiny Trak APRS tracker. Since a radio transmitter is part of the flight computer, no external radio and power is required to send position reports. Figure 1. A complete NearSpace Simple 18. Theory of Operation There are three components in the NearSpace Simple 18 flight computer, the antenna, GPS receiver, and Flight Computer. Antenna The antenna is a two-meter dipole built around a printed circuit board. Insulated, 12- gauge wire elements are soldered and bolted to the plate. The plastic wire clamps prevent the wire elements from twisting off the PCB. A third wire clamp keeps the RG-174 coax

Upload: others

Post on 22-Apr-2022

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Figure 1. A complete NearSpace Simple 18

The NearSpace Simple 18 is an entry-level flight computer. It has everything a flight computer requires, including sensor ports and APRS tracking. As soon as a battery and GPS receiver are connected, it’s ready to collect data and track the near spacecraft. The NearSpace Simple 18 is programmed in PICAXE BASIC, so it’s simple to operate sensors and collect their data. With 32k bytes of memory, data can be collected frequently during a mission. Tracking is provided independent of the PICAXE-18M2 by a Tiny Trak APRS tracker. Since a radio transmitter is part of the flight computer, no external radio and power is required to send position reports.

Figure 1. A complete NearSpace Simple 18.

Theory of OperationThere are three components in the NearSpace Simple 18 flight computer, the antenna, GPS receiver, and Flight Computer.

AntennaThe antenna is a two-meter dipole built around a printed circuit board. Insulated, 12-gauge wire elements are soldered and bolted to the plate. The plastic wire clamps prevent the wire elements from twisting off the PCB. A third wire clamp keeps the RG-174 coax

Page 2: Figure 1. A complete NearSpace Simple 18

firmly soldered to the antenna PCB. The coax terminates in an SMA connector that attaches to the flight computer.

GPSAny standard serial GPS will work for the flight computer, as long as it will produce output at near space altitudes. NearSys produces a suitable and inexpensive GPS receiver kit. The assembled GPS plugs directly into the flight computer’s GPS Port where it receives power and interfaces to the onboard APRS tracker. Power is supplied over pin 4 of the male DB-9 connector.

Flight Computer

Figure 2. The schematic of the NearSpace Simple 18.

Power for the NearSpace Simple 18 is provided by a low dropout voltage regulator (LM2940). As little as 5.3 volts will keep the flight computer functioning, but is not recommended to operate the flight computer at such low voltage. Six volts is a satisfactory voltage for the flight computer. Even better is a 7.2V LiPo battery pack.

At the heart of the NearSpace Simple 18 is the PICAXE-18M2 microcontroller. It has 2kb of memory and 13 inputs and 14 outputs. The inputs are used to digitize analog sensor voltages, read digital sensor values, and read in GPS sentences.

Page 3: Figure 1. A complete NearSpace Simple 18

The I/O channels on the Simple 18 are grouped into three ports based on their function. First, is the Analog Port of three channels. The Analog Port digitizes sensor voltages with a resolution of either 8 or 10 bits. Sensor outputs have a limited voltage swing from 0 to 5 volts. The port consists of a 3 by 4 receptacle. Sensor arrays connect to the Analog Port through a 1 by 5 pin header. The header provides +5 volts and ground to the sensor and the sensor array’s output voltages appear on the three remaining pins.

The second port is the Digital Port with its three channels. This is where sensors that produce ON/OFF signals connect to the flight computer. A good example is the Geiger counter, which produces a pulse (0 to 5 volts) upon the detection of a cosmic ray. Like the Analog Port, digital sensor arrays connect to the Digital Port with a 1 by 5 pin header, of +5 volts, ground, and three sensor outputs.

The final port (and different from the others) is the Camera Port, which operates the shutters of two cameras. The Camera Port is a 2 by 2 header. The Camera Port can control cameras with modified shutters. These are cameras in which a cable has bypassed the camera’s shutter button. Once bypassed, the cameras depend on the flight computer’s relays to trigger their shutters. Alternatively, if a camera’s power switch has also been bypassed, the two channels of the Camera Port can power on and off a single camera and trigger its shutter.

The tracker half of the Simple 18 is a Tiny Trak 3 by Byonics. Byon Garrabrant has obviously put a lot of care into the Tiny Trak 3. It’s a bullet-proof, one-way terminal node controller (TNC) that takes GPS data, reformats it for APRS, and then keys the onboard 2-meter transmitter to send the appropriate tones. Since the PICAXE and Tiny Trak 3 runparallel to each other, only a failure of the GPS or main power will bring a mission to an early end. The 2N3904 transistor between the Tiny Trak and the transmitter inverts the press to talk signal from the Tiny Trak. This is necessary to properly key up the BM1HT transmitter.

The remaining IC onboard the Simple 18 is a 24LC256. This is a 32kb I2C memory for storing flight data. Since the Tiny Trak 3 is not used to telemeter flight data, science data is stored onboard the flight computer and downloaded after recovery. This ensures your mission data is clean - you don’t have to edit out 90% of the position reports in an APRS log to get your science results.

Constructing the NearSpace Simple 18The following is a list of parts for the NearSpace Simple 18. Not listed is the GPS receiver, since that is customer supplied or purchased as a separate kit from NearSys.

Flight ComputerSimple 18 PCB 144.390 FM TransmitterPICAXE-18M2LM2940 (TO-220)

Page 4: Figure 1. A complete NearSpace Simple 18

2N3904Tiny Trak Microcontroller24LC2562) 18 pin DIP socket (300 mils wide)8 pin DIP socket (300 mils wide)4) 680 ohm2) 1k resistor2k resistor (1/4W)3k9 resistor (1/4W)3) 4k7 resistor (1/4W)8.2k resistor (1/4W)10k resistor (1/4W)2) 22k resistor (1/4W)100 uF tantalum cap22 uF tantalum (6.3V)PC mount male DB-92) PC mount female DB-92 by 2 Straight pin headerSMA Antenna header2) 1N4001 diode10 MHz Ceramic Resonator2) Reed relay2) 2 by 5 receptacle2-pin right angle headerCommit Tag Dacron cord )2-56 bolt 3/8” long6) 2-56 bolts 1/2" long7) 2-56 nylocks6) Nylon spacersShorting blockPC mount toggle switchLED (T1-2/4 green)LED (T1-3/4 red)LED (T1-3/4 yellow)LED (T1-3/4 bicolor)2) 1 by 9 straight receptaclesRed and green wire

Antenna12 gauge solid wire 40" longHeat shrink tubing3) Nylon wire straps3) #10-24 Nylon bolts and nutsSMA cable Antenna PCB

Page 5: Figure 1. A complete NearSpace Simple 18

Constructing the Flight Computer

Figure 3. The placement of parts for the Simple 18 flight computer.

There’s nothing tricky about assembling the flight computer. Begin with the resistors and diodes.

R1 680 ohm (blue, gray, brown, gold) R2 4k7 ohm (yellow, violet, red, gold) R3 10k ohm (brown, black, orange, gold) R4 22k ohm (red, red, orange, gold) R5 22k ohm (red, red, orange, gold) R6 1k ohm (brown, black, red, gold) R7 2k ohm (red, black, red, gold) R8 680 ohm (blue, gray, brown, gold) R9 680 ohm (blue, gray, brown, gold) R10 8k2 ohm (gray, red, red, gold) R11 3k9 ohm (orange, white, red, gold) R12 1k ohm (brown, black, red, gold) R13 680 ohm (blue, gray, brown, gold) R14 4k7 (yellow, violet, red, gold) R15 4k7 (yellow, violet, red, gold) D1 1N4001 D1 1N4001

Page 6: Figure 1. A complete NearSpace Simple 18

There is right angle header for the Commit Pin. Solder the short pins of the right angle header into the flight computer PCB in the location marked C.5 The long end of the header will stick out of the PCB.

□ C.5 2-pin right angle header

Then add the tantalum capacitors. Tantalum is used because they are sealed and can’t leak under a vacuum. Check the white silk on the PCB or the figure 3 above for their correct orientation.

□ C1 100 uF□ C2 22 uF

Solder the toggle switch. The proper orientation is marked in the top silk.

□ SW switch

Solder the 2N3904 transistor is next. Note its proper orientation in figure 3 and in the top silk.

□ Q1 2N3904

Next are the IC sockets. Confirm their proper orientation on the top silk before inserting the sockets. Use IC sockets; do not attempt to solder the ICs to the PCB.

□ U2 18-pin IC socket□ U3 18-pin IC socket□ U4 8-pin IC socket

U1 is the voltage regulator (LM2940). Its leads are bent at a 90 degree angle before being soldered to the PCB. Then after soldering, the regulator’s heat sink is bolted to the PCB using a #2-56 bolt and nylock. Bend the LM2940 leads back where their widths increase slightly and shown below. Then insert into the PCB at U1 and bolt into place. Afterwards, solder and trim its leads.

Figure 4. The bent leads of a LM2940, prior to being soldered.

□ U1 LM2940

Page 7: Figure 1. A complete NearSpace Simple 18

The transmitter (by Radiometrix) also has a socket made from a single row receptacle. Cut it into two pieces, each piece nine pins long. Insert the transmitter into the receptacles and then insert the receptacles into the PCB. Solder the end pins of each strip of receptacle and then remove transmitter. Finish soldering the receptacles. The transmitter kept the receptacles in alignment as you started soldering them.

□ Two 1 by 9 receptacles Transmitter Socket

Along the bottom of the PCB are the ports. The Analog and Digital Ports both use receptacles and the Servo Port uses headers. The receptacles were cut with a saw, so sand or file the cut edges of the receptacles so they look nicer. Solder the short pins the Servo Port into the PCB (you want the longer pins sticking up so servos can plug into them)..

□ 2 by 5 receptacle Analog Port□ 2 by 5 receptacle Digital Port□ 2 by 2 header Servo Port

Next, solder the SMA antenna connector. The SMA antenna connector could be either of two styles. The right angle connector is pointed to the bottom of the PCB (otherwise, it is more difficult to attach the antenna cable).

□ SMA Connector

Now solder the DB-9 connectors for the GPS Port, TinyTrak Port, and Programming Port. Each DB-9 has pins on the back, which aligns with the holes in the PCB. Begin by inserting the DB-9’s #2-56 bolts (1/2” long) from the bottom of the PCB. Slide the nylon spacers over the bolts and then install the DB-9 on top of the spacers. Attach the DB-9 using two nylocks. Now solder the DB-9

□ Male DB-9 GPS Port□ Female DB-9 TinyTrak Port□ Female DB-9 Programming Port

The relays solder to the PCB so that the faint white lettering on their side (the letter is only printed on one side) faces away from the top silk lettering for U3. In other words, the lettering on the relays faces the bottom of the PCB. The white stripe on the relays in figure 3 represents the white lettering on the relays

□ RL1□ RL2

Next, solder the resonator, which is not polarized.

□ X1The two wires for the flight computer’s battery pass through strain relief holes in the PCB. The wires pass from beneath the PCB, through the large strain relief holes, and then

Page 8: Figure 1. A complete NearSpace Simple 18

bend over to the smaller solder pads as shown in figure 5. Leave the loop in place until after the wires are soldered as a tight loop makes the wire force itself flush to the PCB. After soldering, pull the wire out of the strain relief hole to flatten the loop.

Figure 5. This wire passes through a strain relief hole before its soldered to a printed circuit board.

□ +V red wire□ GND black or green wire

The other ends of the battery cable must be terminated with a connector for your flight battery (preferably lithium). Since there is no telling which type of battery or connector your near spacecraft, no terminators are included n the kit. Recommended connectors include Anderson Power Poles and Deans connectors (used with radio control cars). Both are available at hobby shops carrying radio control toys.

Antenna

Figure 6. The completed antenna.

Page 9: Figure 1. A complete NearSpace Simple 18

The antenna consists of two dipole elements and a coax cable soldered and strain relieved to a PCB. The PCB includes four mounting holes in the corner to permit the antenna plate to be attached to the near spacecraft.

□ Cut the #12 AWG solid wire into two 20” long pieces (if your kit contains a single piece of wire)□ Strip 1/4 inch of insulation from one end of each wire□ Bend the wire 90 degrees at the point where the insulation is removed

Figure 7. The bent end of a dipole element.

□ Slide a short length of heat shrink tubing over the insulated wire at the bend□ Shrink the tubing down to increase the diameter of the wire slightly □ Place a nylon wire clamp over the heat shrink□ Insert the bare end of the first element into the antenna plate and bolt its nylon wire clamp into the antenna plate as shown in figure 8 using a nylon nut and bolt

Note: The element wires are soldered Antenna Plate’s top and bottom solder pads.

Figure 8. The two solder pads on the right side of the central islands of the antenna PCB are for the antenna’s elements. The two solder pads (one large and one small)

are for the coax that will be soldered after the elements.

□ Solder the element wire into place

Page 10: Figure 1. A complete NearSpace Simple 18

Note: This will take more solder than other solder pads in the kit. Therefore, you may need to turn up the temperature of the soldering iron for the #12 AWG elements.

Repeat for the second element. When they are finished, the elements point in opposite directions.

□ Cut off one end of the RG-174 coax cable, removing about three inches □ Strip the outer insulation from this end of the coax to expose the braided jacket and inner insulation.

Note: You need to expose about one inch of braid.

Figure 9. The stripped end of the coax.

□ Push the inner wire through the braid□ Strip about ½ inches of insulation from the inner insulation to exposure the inner wire

Note: There’s still ½ inches of insulation between the braid and the inner wire, so twist the braid and the inner wire tightly as shown in figure 10.

Figure 10. The inner wire and braid stripper and twisted.

□ Slide a short length of heat shrink tubing over the coax at the end of the jacket□ Shrink the tubing down to increase the diameter of the coax slightly

Page 11: Figure 1. A complete NearSpace Simple 18

□ Slide a nylon wire clamp over the RG-174 and bolt it to the antenna PCB with a nylonnut and bolt

Note: Before tightening the nut, twist the coax inside the clamp and insert the inner wire into the small solder pad and the jacket into the large solder pad as shown in figure 11.

Figure 11. Now the RG-174 coax is attached to the antenna plate.

□ Solder the coax to the antenna PCB to complete the antenna.

The last item to assemble is the Commit Tag. It’s a reminder to start the flight computer recording flight and science data.

Commit Tag

Figure 12. The red Commit Tag is a not-so-subtle reminder to pull the Commit Pin off the Simple 18.

□ Pass the Dacron cord through the rivet in the Commit Tag and through the small opening in the tail of the shorting block□ Tie and overhand knot and heat it with a small flame to melt the Dacron slightly to prevent it from unraveling.

Page 12: Figure 1. A complete NearSpace Simple 18

This completes the assembly of the NearSys Simple 18 flight computer. After an electrical test, you’ll insert all the ICs and practice programming the microcontroller and the Tiny Trak 3. The flight computer is then mounted to a sheet of Correplast. Afterwards you’ll add the radio, antenna, and a GPS receiver. That’s all you need to operate a near space mission.

Electrical Test

Do not insert any ICs or the transmitter at this point!

First look at the underside of the PCBs and verify that no solder has overflowed its pad and is shorting another pad. All solders should be small trimmed shiny cones. Loose blobs of solder may drop off at the worse possible time (at balloon burst), therefore, press on solders that look like they could break loose. Fix all poor soldered pads before launching the Simple 18 flight computer. Figure 13 illustrates examples of good and bad solders.

Figure 13. A good solder is conical and shiny and there should be very little wire sticking above it. Wires that are not cut short enough risk touching neighboring wires when the bend over. Cold solders do not strongly adhere to the copper pad

and will form intermittent connections that fail at unpredictable times. Incomplete solders are not a significant problem as long as the solder wraps most of the way

around the lead and pad.

Now that none of the solders look questionable, its time to begin testing voltages across the flight computer. This will identify backwards components, hidden shorts, and broken connections.

First, verify there is no short between power and ground on all the battery connectors. Set a DMM to continuity and tap the positive and negative leads of the flight computer’s battery cable. The DMM ring should not ring.

Next, verify there is no short between power and ground on the flight computer PCB (on the other side of the voltage regulator). Check for continuity between pins 4 and 5 of the GPS Port. These two pins provide five volts the GPS. In a successful test, the DMM will not ring, except possibly for a second or so as the capacitors charge. This test verifies there are no shorts between power and ground anywhere on the PCB. Therefore, if the DMM rings, all traces must be checked for a shorted trace.

Page 13: Figure 1. A complete NearSpace Simple 18

The one place we do want continuity is between the center pin of the antenna jack and the transmitter. Verify the center pin of the SMA antenna jack is connected to pin 2 of the transmitter’s bottom socket.

Figure 14. The center pin of the SMA antenna connector connects to pin 2 of the transmitter socket.

Now you can begin inserting the ICs into their sockets; however, at this time, do not insert the transmitter. You will test the ICs for a while and there’s not need to have the transmitter operating.

Programming TestThere are two programmable microcontrollers on the NearSpace Simple 18, the PICAXE-18M2 and the Tiny Trak 3. First, you will program the Tiny Trak and observe that it attempts to transmit and properly indicates the status of the GPS receiver. Then you’ll program the PICAXE and verify its operation of the Analog, Digital, and GPS Ports. Then you’ll test the Commit Pin and the ability of the PICAXE to store and read data in and out of memory. Finally, you’ll install the transmitter and antenna and observe the Tiny Trak is producing APRS data.

TinyTrak 3You’ll need a PC with a serial port to program the Tiny Trak. If your PC did not come with a serial port, then purchase a USB to Serial adapter. You can purchase a quality USB to Serial adapter from Parallax (www.parallax.com). Visit Byon’s website and download the Tiny Trak 3 configuration software (www.byonics.com) and install the software on your PC.

Also available for downloading from Byonics are the directions for how to program your Tiny Trak. Look the directions over as you go through the following steps.

Page 14: Figure 1. A complete NearSpace Simple 18

Figure 15. Start the Tiny Trak Configuration Editor, the screen will appear like this.

Figure 16. Set the editor to the proper serial port for your PC (and USB to serial adapter). You can determine the proper serial port under the Windows Control

Panel, System, Hardware tab, Device Manager.

Page 15: Figure 1. A complete NearSpace Simple 18

Figure 17. Enter the callsign for your near spacecraft. Typically the SSID for your first near spacecraft is 11, so for example, XX0XXX-11.

Figure 18. Consult with your local APRS community for the path setting, but something like WIDE2-1 is good. You don’t want the near spacecraft’s digi path to

create a problem because it can hit so many digis at 60,000 feet.

Page 16: Figure 1. A complete NearSpace Simple 18

Figure 19. The symbol setting defines the icon to display under APRS. The best fit is

Figure 20. I prefer a transmit rate of 60 seconds, one packet per minute.

Page 17: Figure 1. A complete NearSpace Simple 18

Figure 21. This text is transmitted at the end of position reports. Normally it’s an informative message telling anyone on APRS about the mission. After entering text,

decide how often the text message is included with position reports.

Figure 22. Be sure the Send Altitude option is selected.

Page 18: Figure 1. A complete NearSpace Simple 18

Figure 23. Because a near space mission only lasts a few hours, select to timestamp position reports in hours, minutes, and seconds.

Figure 24. Unselect the MIC-E option.

Page 19: Figure 1. A complete NearSpace Simple 18

Figure 25. If your Simple 18 is flying in conjunction with other near spacecraft, you should consider enabling time slotting. Time slotting forces the Tiny Trak to

transmit position reports at specific seconds after the minute. This prevents two trackers from stepping on each other’s reports.

Figure 26. Verify SmartBeaconing is not enabled. When enabled, the Tiny Trak does not transmit position reports until there are substantial changes in the near

spacecraft’s direction of travel.

Page 20: Figure 1. A complete NearSpace Simple 18

Figure 27. After setting the configuration of the Tiny Trak, press the Write Configuration button. This uploads the settings you selected to the Tiny Trak. The

Configuration Editor will verify the settings were properly uploaded.

Note: You can determine the current settings of the Tiny Trak by clicking the Read Configuration button.

PICAXE-18M2You will need the PICAXE Editor in order to program the flight computer’s PICAXE-18M2. The Editor is free and a link for the program is on the NearSys.com website.

Install the software and start the editor. Click View in the menu and then Options.

Page 21: Figure 1. A complete NearSpace Simple 18

Figure 28. In the Mode tab, select the PICAXE-18M2 option.

Figure 29. Verify the proper serial port for your PC is selected under the Serial Port tab.

After setting the Editor to the proper PICAXE and serial port, you can begin writing flight code. If your PC does not have a serial port, then purchase a USB to serial adapter. The Simple 18 flight computer is programmed through the serial port on the Control Panel. The following description is not a programming guide, you’ll need to learn BASIC

Page 22: Figure 1. A complete NearSpace Simple 18

with the help guides that are included in the Editor. However, the following descriptions do include code snippets that you’ll use within your flight code.

Connecting Sensors to the Simple 18The NearSpace Simple 18 is designed to use sensor arrays. That is, each port uses a single connector and operates up to three experiments. The Analog and Digital Ports ofthe Simple 18 provide five volt power to the sensor array connected to them. The reason each port uses a two row receptacle is to strengthen the port’s connection to the PCB. Since the two rows are shorted together, a sensor array can be plugged into any row of pins, but two sensors arrays cannot be plugged into a single port at the same time. The ports are arranged in with the ground pin on one end and the +5V pin on the other end.

.

Figure 30. NearSys three sensor arrays have termination that fits the Simple 18 I/O ports.

Making 5-pin Headers for I/O PortsIf you are designing your own experiment, then you may want to make your own 5-pin headers. You make the five pin connectors by soldering the bare ends of sensor wires to the short pins of a single row of five header pins. Start by tinning the bare ends of the sensor wires and the short pins of a one by five pin header. Then one at a time, place a tinned wire against a tinned pin and heat them with a soldering iron. The solder in the pin and the wire will fuse them together. Be careful that you do not accidentally solder a wire to two neighboring pins. After soldering the five wires to the pins of the header, slide a short length of heat shrink tubing over the soldered connections and shrink.

Insert the long pins of the header into a receptacle when tinning, soldering, and heat shrinking the sensor array connector. The receptacle keeps the pins in alignment during these processes.

Page 23: Figure 1. A complete NearSpace Simple 18

Figure 31. The long pins of a one by five header have been inserted into a receptacle. The receptacle will ensure the header does not distort during tinning, soldering, and

heat shrinking.

Figure 32. A five header for a sensor array. Color coding the wires in a sensor array connector is a good way to identify the proper orientation of the connector cable.

The red wire indicates +5V and the green wire indicates the ground pin. Color coding sensor wires is also useful.

Page 24: Figure 1. A complete NearSpace Simple 18

Analog Port

Figure 32. The Analog Port with its three channels.

The channels in the Analog Port are labeled C.0, C.1, and C.2. Each channel provides +5 volts and ground to the experiment plugged into it. The channels are inputs only and convert the analog volts of sensors into digital values that the flight computer can store in memory.

There are two commands that convert an analog voltage into its equivalent digital value. The first, READADC, digitizes to a level of 8 bits (0 to 255) and the second, READADC10, digitizes the analog voltage to a level of 10 bits (0 to 1023).

READADC channel, byte

Channel is the channel number the sensor is plugged into (C.0, C.1, or C.2)Byte is the RAM variable to store the result of the analog-to-digital conversion into (B0 to B27).

READADC10 channel, word

Channel is the channel number the sensor is plugged into (C.0, C.1, or C.2)Word is the RAM variable to store the result of the analog-to-digital conversion into (W0 to W13).

Page 25: Figure 1. A complete NearSpace Simple 18

Digital Port

Figure 33. The Digital Port with its three channels.

The channels in the Digital Port are labeled B.0, B.7, and C.6. Each channel provides +5 volts and ground to the experiment plugged into it. The channels in the Digital Port can be input or output. Signals in the Digital Port are a series of on-off pulses, there is no in-between. Examples of input signals include switch closures, Geiger counter pulses, and serial data. Examples of output signals include on/off voltages and serial data.

To detect switch closures, use the command,

IF PINy=x THEN label

PINy is the name of the input Digital Port channel the switch is connected to. Valid pins are PINB.0, PINB.7, and PINC.6.

Valid values for PINy is either 0 or 1. A value of 0 means the input to the pin is ground, or zero volts. A value of 1 means the input to the pin is five volts.

Label is the name of a label in the flight code. A label can be any name as long as it is not already a command. Labels of multiple words cannot have a blank space between the words. Either use an underscore or begin the second word with a capital letter. Examples of valid labels look like this.

Page 26: Figure 1. A complete NearSpace Simple 18

Camera:Next_picture:PositionServo:

When we put the pieces together, a command to jump program execution to a label in the code called Photograph when the voltage on Digital channel 2 is five volts looks like this.

IF PINB.0 = 1 THEN Photograph

To count the number of pulses from a sensor like a Geiger counter, use the command,

COUNT x,time,variable

X is the Digital Port channel the Geiger counter is connected toTime is the length of time the command counts pulsesVariable is variable to store the results in

The unit of time in the COUNT command is milliseconds. So a count for one second is written as 1000. The variable the results are store in can be either a byte or word, so for example, B0 or W0, are valid variables.

The COUNT command is valid for any sensor producing pulses. This permits a 555 IC to be converted into a sensor when it is connected to either a variable capacitor or variable resistor that varies as environmental conditions change.

The Digital Port can collect data from a sensor producing serial output using the SERINcommand. Read the PICAXE programming guide for information n this command.

Page 27: Figure 1. A complete NearSpace Simple 18

GPS Port

Figure 34. The GPS Port.

The GPS Port accepts a standard GPS Receiver. The port also provides power to operate the GPS Receiver through pin #4 of the DB-9 connector. A GPS only needs to be plugged into the DB-9. Afterwards, the APRS side of the Simple 18 will begin transmitting positions according to the TinyTrak settings. The PICAXE microcontroller accesses GPS sentences using the serial in command (SERIN). A GPS produces an inverted logic serial signal and needs to be read as illustrated in the example below.

SERIN C.7,n4800_4,("GGA"),b0,b1,b2,b3,b4,b5

This command reads the first six bytes of the GPGGA sentence, which is the time field.

Page 28: Figure 1. A complete NearSpace Simple 18

Camera Port

Figure 35. Camera Port.

The Camera Port can operate two camera shutters. Alternatively, it can operate the power switch and the shutter switch of a single camera. The only kinds of cameras that the Simple 18 can control are those with by-passed shutter switches. In other words, cameras with wires soldered to the two pins in the shutter switch that are shorted out when the camera shutter is pressed. Cameras are triggered with the following example cammands.

HIGH B.2PAUSE 1000LOW B.2

HIGH B.3PAUSE 1000LOW B.3

MemoryThe 24LC256 I2C memory stores up to 256 kb of data. The following program configures the PICAXE to use I2C memory setting the access speed to 400 kHz and one word records.i2cslave %10100000,i2cfast,i2cword

Page 29: Figure 1. A complete NearSpace Simple 18

The following code will store data into the 24LC256 memory chip. The data to stored into memory initially is stored in bytes B6 and B7.

Symbol Record = W0WRITEI2C Record,(B6,B7)PAUSE 10Record = Record + 2

The following subroutine will download one byte data stored in memory.

Symbol Record = W0Symbol Reading = W1

Download: SERTXD ("Start,") FOR Record = 0 to 4091 STEP 2 READI2C Record,(B2,B3) SERTXD (#Record, ",") NEXT

Commit Pin

Figure 36. Commit Pin.

Page 30: Figure 1. A complete NearSpace Simple 18

The Commit Pin prevents the flight computer from recording data prior to launch. The flight code is written to check the status of the Commit Pin. Until the pin is removed, the flight code endlessly loops through its check routine. The example code below illustrates how the Commit Pin is used to prevent collecting data on the ground.

Check_Commit: IF PINC.5 = 0 THEN Check_Commit

Flight_Code:

27 March 2013