Control module

Work on control module is making good progress – here are pictures of breadboard prototype, PCB and schematics:

GPS

Venus GPS with GPS antenna tracks 14 satellites while consuming as little power as three LED’s. I set it to output two NMEA sentences ($GPGGA and $GPRMC) at 1Hz rate.

TinyGPS library for Arduino does a nice job parsing NMEA output from this GPS.

Pressure & Temperature

BMP085 sensor measures air pressure and temperature. It will track altitude and ascent/descent status in case of GPS malfunction.

Sensor requires quite some code to interface with; I used this and this examples to query the sensor and convert its readings to altitude and temperature values.

Camera

Adafruit camera will provide real-time photo stream. I set the camera to take 640×480 (0.3 megapixel) photos, and each JPEG file is about 50KB in size.

Camera sits on a separate voltage regulator that Arduino can turn on and off. I used Adafruit library to interface with the camera, but modified it to make it work asynchronously.

Camera appears to be very sensitive to infrared spectrum, so all images initially had washed-out colors. With B+W IR/UV cut-off filter, colors become tolerable. Here is comparison:

adafruit color camera 2

Transmitter

To transmit telemetry and imagery, I chose long-range XBee module. It operates at 900MHz frequency with maximum 250mW output power, which should be sufficient for 10 miles line-of-sight range. With high-gain antennas the range should double.

There are too kinds of long-range XBee’s: high-speed / low sensitivity and low-speed / high sensitivity. To maximize the range, I’m going with latter one. Data transfer speed will be 10kbps – each JPEG will take about a minute to download. I’ll get a faster radio when NASA approves my budget 🙂

XBee configuration:

ATRE            Reset to defaults
ATHP 5          Preamble ID
ATID 42         Network ID
ATDL FFFF       Broadcast all packets
ATMT 1          Broadcast all packets twice
ATCE 2          Disable routing
ATBD 2          Serial speed 4800 bps
ATFT D0         Assert CTS at 208 bytes in buffer (128 free)
ATWR            Write to memory

A few words on flow control. Since all packets are broadcast twice, effective rate will be half of available 10kbps bandwidth. XBee serial speed is set accordingly to 4800bps. XBee has internal 336-byte buffer and will raise CTS pin when the buffer fills up to 208 bytes – i.e. 128  free bytes remain. Arduino will use matching 128-byte transmit buffer and transmit data only when space is available in both its own and XBee’s buffers.

Arduino

Choice of processing unit was driven by two factors: (a) 3.3V system (b) multiple serial interfaces. Arduino Mega Pro Mini has 4 serial ports, 8k memory, 256k flash for code / 32k for data, and powers from 3.3V source. All four serial ports are used:

  • Serial 0 = I2C interface with pressure/temperature sensor
  • Serial 1 = XBee radio
  • Serial 2 = GPS unit
  • Serial 3 = Camera

In addition, I’m using:

  • 4 analog pins for battery and rail voltage measurements
  • External voltage reference
  • Digital pins for camera on/off, XBee flow-control (CTS), burn wires on/off

Software

Arduino is programmed with ~1,000-line code that implements the following:

  1. Listens to incoming NMEA messages from GPS and decodes them
  2. Polls pressure/temperature sensor and calculates altitude and temperature
  3. Reads battery and rail voltages
  4. Interfaces with camera and downloads JPEG files
  5. Every 30 seconds, sends telemetry to ground station
  6. All other time, continuously sends photos
  7. Tracks battery voltage; if it drops too low, turns off camera and throttles all transmissions to once a minute
  8. Tracks distance from “home” location
  9. Saves telemetry data to internal flash memory
  10. Receives commands from ground station and executes them
  11. All data is encapsulated into packets with CRC checksums
  12. All functions are implemented in non-blocking (asynchronous) manner. The program is interfacing with all components simultaneously.