INPUT/OUTPUT PORTS
Now, let’s look at the inputs and outputs to the
PICAXE-28X1.
Analog Port
For the collection of sensor data, the UltraLight has
four channels (ADC0 to ADC3) in the Analog port. Each
channel digitizes (that is, converts analog voltages into
their digital values) sensor voltages in the range of zero to
five volts. The commands READADC and READADC10
permit the PICAXE to digitize voltages with resolutions of
either eight bits ( 19. 5 mV per bin), or 10 bits ( 4. 8 mV per
bin, or four times the resolution of the READADC
command), respectively. Each channel of the Analog port
provides five volts and ground to each of its experiments.
This means that in most cases, experiments will not
require a separate power supply. You literally plug and
play the experiment.
The following code digitizes sensor voltages into
1,024 bins ( 10 bits of resolution). Each reading is then
stored into EEPROM in one word records. More data
could be packed into EEPROM if two eight-bit analog
readings are stuffed into a word and then stored, but
that would leave out the third sensor voltage. Perhaps it
could be stuffed into a word along with a digital sensor
reading:
Analog:
for B2 = 0 to 2
readadc10 B2,W0
gosub Store_Data
next
return
Digital Port
Not every experiment produces an analog voltage.
Therefore, the UltraLight also has a Digital port for sensors
like Geiger counters. In the case of the Geiger counter,
the signal is a digital pulse at the detection of each cosmic
ray. For this example, the PICAXE counts the number of
“clicks” over a fixed time interval. The Aware Electronics
RM- 60 Geiger counters I typically use produce a 20
microsecond long pulse at each detection. The PICAXE
counts the number of pulses for 10 seconds, and I later
multiply the result by six in a spreadsheet. Here’s an
example of counting cosmic rays with the Digital port:
Cosmic_Ray:
count 0,10000,b2
gosub Store_Data
return
As with the Analog port, every channel in the Digital
port provides experiments with five volts and a ground,
relieving the designer of creating a power supply for the
experiment. The channels in the Digital port are input 0 to
input 2.
54 September 2011
Servo Port
There are times when devices must be opened,
closed, or oriented during a near space mission. For those
cases, the UltraLight also has a Servo port with two
channels. There is a small risk that servos could drain
batteries during a mission. There’s also a tiny risk that
the operation of a servo will create voltage jitters that
interfere with the rest of the UltraLight. For those
reasons, the Servo port uses a battery pack separate
from the main battery pack. The servo channels are
output 0 and output 1.
The following code rotates a servo on channel 0
to a position of 110 (close to the midpoint for most
servos):
servo 0,110
The range of a servo’s rotation depends on the servo,
but you can usually expect it to be from 75 to 225. If you
are going to drive a servo close to its limits, first test it by
gradually increasing the position value in the servo
command.
Camera Port
Each of the UltraLight’s two-channel Camera ports
have two ways to operate cameras. The first is for
cameras with modified shutters. In most cameras today,
the shutter switch is not a mechanical system, but instead
is a switch that signals the microcontroller inside the
camera to record an image. We can bypass the shutter
switch in this kind of camera with two wires. The wires
are connected to the Camera port so that the relay on
board the UltraLight replaces the function of the shutter
switch.
The same signal that operates a relay can also operate
a Canon camera running CHDK and the remote USB
shutter script. I haven’t tested it yet; however, I suspect the
UltraLight can operate both the relay and USB
connections simultaneously. If so, the UltraLight can
operate four cameras. (That is, if you don’t mind them
acting together in pairs.)
To take a picture, the PICAXE applies five volts to the
relay or USB port for about one second to trigger the
shutter. After waiting one second, the shutter is released
so the camera is ready to take the next picture. The code
to do just that is shown below:
Camera:
high 4
pause 1000
low 4
return
Antenna Port
At the bottom of the UltraLight is an SMA connector.
This is the output for the two meter transmitter used to
send position reports to chase crews on the ground. In a
later article, I’ll describe an antenna (and a camera rotator)