Professional Documents
Culture Documents
2 Mission analysis 9
2.1 Geography and climate . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Balloon trajectory . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 Scientific relevance . . . . . . . . . . . . . . . . . . . . . . . . 10
2.4 Overall design . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5 Information flow . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5.1 Error and accuracy calculation . . . . . . . . . . . . . . 14
2.6 Extras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.6.1 Additional sensors . . . . . . . . . . . . . . . . . . . . 17
3 Structural design 19
3.1 Reference of structures and components . . . . . . . . . . . . . 19
3.2 Mechanical design of the ground station. . . . . . . . . . . . . 19
3.3 Shape of CanSat . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.4 Used Materials . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.5 Thermal Protection of the Satellite . . . . . . . . . . . . . . . 24
3.6 Positions of Sensors and other components. . . . . . . . . . . . 25
4 Electronics 28
4.1 Electronics hardware . . . . . . . . . . . . . . . . . . . . . . . 28
4.1.1 CanSat . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2 Ground station . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3 Power Consumption . . . . . . . . . . . . . . . . . . . . . . . 30
4.3.1 Satellite . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.3.2 Ground station . . . . . . . . . . . . . . . . . . . . . . 31
5 Communication protocol 35
5.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2 Essentials of a robust communication protocol . . . . . . . . . 35
5.2.1 Effectiveness . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2.2 Reliability . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2.3 Resiliency . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.3 Specific Requirements . . . . . . . . . . . . . . . . . . . . . . . 36
2
5.4 Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.4.1 Packets from the the ground station to CanSat . . . . 36
5.4.2 Packets from the CanSat to the ground station. . . . . 37
5.4.3 Communication link failure . . . . . . . . . . . . . . . 39
6 Microcontroller programming 40
6.1 The Microcontroller . . . . . . . . . . . . . . . . . . . . . . . . 40
6.2 Programming Tools used . . . . . . . . . . . . . . . . . . . . . 41
6.3 Interface to radio module and sensors . . . . . . . . . . . . . . 41
6.3.1 Radio module . . . . . . . . . . . . . . . . . . . . . . . 41
6.3.2 GPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.3.3 Pressure sensor . . . . . . . . . . . . . . . . . . . . . . 41
6.3.4 Temperature sensor . . . . . . . . . . . . . . . . . . . . 41
6.4 Modes of operation . . . . . . . . . . . . . . . . . . . . . . . . 42
6.4.1 Initialisation mode . . . . . . . . . . . . . . . . . . . . 42
6.4.2 Safe mode . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.4.3 Downlink only mode . . . . . . . . . . . . . . . . . . . 42
6.5 General description of the microcontroller program . . . . . . 42
9 Testing 64
9.1 Testing individual subsystems . . . . . . . . . . . . . . . . . . 64
9.1.1 Structure . . . . . . . . . . . . . . . . . . . . . . . . . 64
9.1.2 Electronics . . . . . . . . . . . . . . . . . . . . . . . . . 64
9.1.3 Communication . . . . . . . . . . . . . . . . . . . . . . 66
3
9.1.4 Microcontroller . . . . . . . . . . . . . . . . . . . . . . 67
9.1.5 Java programming . . . . . . . . . . . . . . . . . . . . 70
9.2 Testing the whole system . . . . . . . . . . . . . . . . . . . . . 72
12 Conclusion 85
13 Bibliography 86
4
14 Appendix 88
14.1 XML schema . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
14.2 Activity diagrams . . . . . . . . . . . . . . . . . . . . . . . . . 89
14.2.1 Control CanSat . . . . . . . . . . . . . . . . . . . . . . 89
14.2.2 Record acquisitions . . . . . . . . . . . . . . . . . . . . 93
14.2.3 Analyse acquisitions . . . . . . . . . . . . . . . . . . . 94
14.3 Sequence diagrams . . . . . . . . . . . . . . . . . . . . . . . . 95
14.3.1 Control CanSat . . . . . . . . . . . . . . . . . . . . . . 95
14.3.2 Record Acquisitions . . . . . . . . . . . . . . . . . . . . 96
14.3.3 Analyse Acquisitions . . . . . . . . . . . . . . . . . . . 98
14.4 Gantt chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5
1 Introduction
The CanSat project is a student project for first semester students in the
SpaceMaster programme. The objective is to design and build a payload
that can measure specific atmospheric properties during atmospheric descent,
process the measurements and send them to a ground station. On the ground
station, a program to store and visualise the data will be developed. One
CanSat will fly on the BEXUS 1 stratospheric balloon from Esrange, Kiruna,
Sweden, in winter 2008. Detailed specifications and requirements can be
found in [24].
1.1 Overview
After the introduction and the overview, this document defines a number of
subsystems and interfaces.
Section (2) deals with the mission analysis and the scientific relevance
of stratospheric balloon flights. This also includes an information flow con-
sideration in section (2.5) and specifically error and accuracy calculations in
section (2.5.1) on page (14).
Section (3) to (7) consider the detailed definition, design and implemen-
tation of the various subsystems as defined in section (1.2). Section (3) deals
with the structural design. Then, section (4) consider the electronics sub-
system, both for the CanSat and for the ground station. Next, section (5)
defines the communication protocol. Section (6) consider microcontroller
programming. The last subsystem, the Java programming of the ground
station application, is considered in section (7).
After the various subsystems have been treated in detail, implementa-
tion and integration for all subsystems is considered in section (8). Testing
is considered in section (9). In section (10), the time plan and the work
distribution are treated.
A conclusion of the project is described in section (12), including a dis-
cussion of possible improvements and future ideas in section (11).
Finally, a bibliography and a number of appendixes are included in section
(13) and (14).
1.2 Definitions
1.2.1 Definition of subsystems
The project has been divided in five subsystems.
1
BEXUS stands for Balloon EXperiment for University Students.
6
Structure In order to protect the electronics from the environment and
to increase the overall durability of the components, the appropriate
packages for the CanSat and the communication module of the ground
station should be developed.
7
3. Communication with the ground station.
4. Controlling of the cansat.
1. To receive and transmit data from the Cansat without any data
loss.
2. To detect any communication failure and alert for necessary ac-
tion.
3. To store all the data in a database for future retrieval and analysis.
4. To provide the user with a graphical display of data received.
• Interface between the ground station and the CanSat (radio link) using
the communication protocol.
• Interface between the electronics of the ground station and the com-
puter running the Java ground station application.
8
2 Mission analysis
The CanSat is designed assuming that it will fly on the BEXUS stratospheric
balloon from Esrange, Kiruna, Sweden, in winter 2008. Relevant questions
for analysing the scientific relevance of the mission are:
9
2.3 Scientific relevance
The subarctic location of Esrange allows for measurements on the ozone layer
and on the polar vortex. The polar vortex is a large cyclone around the poles
during winter [22], located in the upper troposphere and lower stratosphere.
On this vortex, ozone depletion takes place. The balloon will fly at an altitude
where this polar vortex is taking place. Measurements on this vortex are of
scientific interest. Chemical measurements require large and relatively heavy
sensors and are not feasible for the CanSat mission. However, measurements
on wind and temperature can be done and are interesting as well. Polar
Stratospheric Clouds (PSC) can form at an altitude of 15-25 km when the
stratosphere is very cold (T < −75◦ C) [21]. If present, temperature, humidity
and wind measurements can give information on how those are formed.
Among the issues that we can investigate are:
• What is the nature of stratospheric winds during the flight?
• What is the temperature distribution as a function of altitude?
• How does the temperature at stratospheric altitudes vary through the
geographical extent of the flight?
• How is the pressure distribution as a function of altitude?
• What is the error in altitude information from the barometric equation,
or, how does altitude information from the pressure compare with al-
titude information from the GPS?
• If present, what can be learnt about Polar Stratospheric Clouds? Under
what conditions are those formed?
• How does (instantaneous) velocity information from the GPS compare
with the (average) velocity information from taking the derivative of
the position?
10
Figure 1: Schematic of the architecture of the system.
11
• Temperature of the exterior, using the second temperature sensor.
– latitude
– longitude
– altitude
– velocity
– date/time
– error estimates
– “satellite” and receiver status
From this, we will measure the position (latitude, longitude and alti-
tude), the velocity and the time.
12
in the stratosphere. A more exact result would require knowledge of the
temperature in the column below the balloon, which is unknown.
The altitude information from the pressure can be compared with the
altitude information from the GPS.
In literature [6], two different barometric equations have been found, one
for the troposhere and one for the stratosphere:
5.256
p = 101.29 · 288.14−0.00649h
288.08
(0 < h < 11000)
p = 22.65 · e1.73−0.000157h (11000 < h < 25000) (3)
−11.388
p = 2.488 · 141.89+0.00299h
216.6
(h > 25000)
Equation (3) gives pressure as a function of altitude. Here, temperature
is in kPa and the altitude h is in meters.
Combining the standard atmosphere pressure model (equation (3)) with
the range of the pressure sensor (down to 15kPa, see section (4.1.1)), we
can use the pressure sensor to determine our altitude up to approximately
13.7km. The GPS can be used to determine altitude up to approximately
18km. Since our balloon flies at an altitude of approximately 30km, the
altitude cannot be determined.
13
T_in
T_out
Latitude
1 2 3
Atmega Micro-
Longitude Sensors
hardware controller
Altitude
Time
Pressure
5 4
GS
Communication link
6 hardware
9
7
Database XML
GS
application
8
10 GUI
Velocity
calculation
Figure 2: Flowchart for the information flow in the system. The chart shows
the flow from an information point of view, from the information being “gen-
erated” in the physical world, to the end points: storage in a database,
storage in a XML file (or set of XML files) and representation in a GUI.
The dashed box represents the ground station application. See text for a
consideration of the different links.
14
depending on the external temperature. The resolution is 9 bits. The
pressure sensor can have a maximum error of 1.5% at a temperature
of −40◦ C to 85◦ C. The error in the position for the GPS is between 5
and 25m for each dimension. The error in the time is about 1µs.
In addition to the documented error in the signals, there is noise in
the atmosphere leading to further disturbances in the signal from each
sensor.
2. This is the information link from the sensors to the electronical circuit.
In digitalising the pressure information, there is information loss.
The microcontroller uses successive approximation in the ADC and has
a 10 bit resolution. A succesive approximation ADC uses a compara-
tor to reject ranges of voltages, eventually settling on a final voltage
range. Successive approximation works by constantly comparing the
input voltage to the output of an internal ADC, fed by the current
value of the approximation until the best approximation is achieved.
At each step in this process, a binary value of the approximation is
stored in a successive approximation register (SAR). The SAR uses a
reference voltage (which is the largest signal the ADC is to convert) for
comparisons. The maximum quantisation error produced by the ADC
is
1
= 0.097%
1024
3. The microcontroller retrieves information which is already in digital
form. There can be bit errors in this retrieval. The microcontroller
processes the information and converts it to a form in which it is trans-
mitted to the ground station. In this conversion, information is lost.
4. The transceiver on the CanSat creates an analog radio signal from the
digital information which is the output of the microcontroller program.
In the communication link, information can be lost or damaged as a
result of a poor link quality and noise.
5. The transceiver on the ground station converts the analog radio signal
into digital information, which is another source of information loss.
6. The Java application reads information from the ground station elec-
tronics via the RS-232 port. There should be no information loss here.
It reads the (possibly altered) information as has been output by the
CanSat and converts this to Java types for own use.
15
The three position dimensions, the two temperatures and the pres-
sure are converted to a float. Floats in Java are represented by 32
bits: 1 bit for the sign, 8 for the exponent and 23 for the significand
[15]. That means that we have 223 = 8388608 values (not considering
the exponent); in decimal representation, this corresponds to around
10
log 223 = 6.924 significant digits, thus slightly less than 7. Tempera-
ture is represented in the communication by 1 byte or 8 bits, pressure
and altitude by 2 bytes or 16 bits, thus the precision of storage for tem-
perature, pressure and altitude in a float does not lead to information
loss, as the measurement itself is only 9 bits.
Longitude and latitude are represted by 4 bytes or 32 bits in the commu-
nication, thus this requires further consideration. With 23 significant
bits, the resolution for the latitude is (see equation (4)):
180 · 60
· 1852.2157m = 2.38m.
223
This is enough, because it allows for a higher accuracy than the GPS
can give.
The resolution for the longitude depends on the latitude The highest
the latitude, the better the precision. The worst case scenario would be
the equator, but here the precision at the longitude of Würzburg and
Kiruna are considered. The resolution at the longitude of Würzburg is
(see equation (5)):
360 · 60
· sin(90◦ − 49.785◦ ) · 1855.3257m = 3.08m
223
At the latitude of Esrange (Kiruna), this is:
180 · 60
· sin(90◦ − 67.8939◦ ) · 1855.3257m = 1.80m
223
In both cases, the float provides (just) enough precision for storing
longitude and latitude.
The time is converted into an integer. It is received as a 2-byte unsigned
integer. In the Java application it is represented as a 2-byte signed
integer. For values up to 215 = 32768 (in seconds, this corresponds to
slightly more than nine hours) this is no problem. If the mission takes
longer than nine hours, it is possible that the value will overflow and
become negative. However, a mission longer than nine hours is unlikely
(see section (2.2)).
16
7. The Java application stores information in the database. The database
uses SQLite, which has datatypes for float and integer. Information
may be lost if the precision of the SQLite float is smalle than the pre-
cision of the Java float. Floats in SQLite are 64bits, so no information
is lost when storing the data [18].
10. The velocity is calculated from the differential of longitude, the differ-
ential of latitude and the time.
2.6 Extras
Beyond the bare minimum required by the project definition, many possible
extras can be discussed.
If we cannot measure the current, we can still determine if the voltage of
the battery is being influenced by the temperature of the surroundings.
17
temperature range is from −40◦ C, which would not be sufficient for our
application. The humidity sensor Honeywell HIH-4000 humidity sensor
series has similar dimensions. The product specification [14] for it states
the same temperature range, and describes that other conditions will
result in a lifetime of less than 50hours. Since the flight time of the
CanSat is several hours at most, it may be permissible to slightly violate
the operating temperatures of this device.
In the design of our system, we have taken into account the possibility of
adding a humidity sensor, even though it has not been included in the final
report.
18
3 Structural design
3.1 Reference of structures and components
• Box for mechanical packaging of the ground station (figure (5)).
19
Figure 4: Voltage regulator
Figure 3: GPS receiver Holux
TS2940
GR-213
20
Figure 7: The communication Figure 8: External switches and
module of the Ground Station, top connectors (Power Switch, RS-
view. 232)
21
available volume, what means that the only one kind of shape that is con-
venient to use in this particular case is cylinder. In such a way all payload
volume will be used, what will give the best opportunity to create a device,
which meets all specific demands of the mission.
22
Figure 10: CanSat body. Figure 11: Bearing board (all di-
mensions are in millimetres)
Figure 12: CanSat case with cylinder heads (all dimensions are in millime-
tres)
maximum height of the tube to fit into the 500ml volume can be easily
calculated (h = Volume
π∗d2
) and is 130mm. It has been decided to leave the
4
height of the cylinder at 122mm. The reserve is spent to cylinder heads and
the second thermal sensor and some thermal insulation around the tube. The
thickness of the heads, as well as the thickness of the bearing board is 2mm,
what results in high overall durability of the device. The overall height of
the CanSat is 127mm (see figure (12)).
The thickness of the walls of Plexiglas tube is 5mm. It easily stands 1m
free falls, besides, the 5mm thick walls provide sufficiently significant thermal
insulation (the thermal conductivity of Plexiglas is more than 780 times less
than that of aluminium [2])
The usage of Plexiglas is convenient not only because of the low thermal
conductivity, but also because of its transparency for radio waves. It allows
placing the data transmitting antenna and the GPS module inside the body,
and thus results in the increase of overall tolerance to external exposures and
shocks.
23
Figure 13: Screw fixing of bearing board and cylinder heads.
As it has been mentioned above, the cylinder heads are made of alu-
minium and are screwed together with the aluminium plate. See figure (13).
The four projections are made on each head, so that they do not allow
the heads and the aluminium plate to turn around the long axis as well as
to be moved to any direction. The corresponding groves are made on both
sides of the Plexiglas tube. See figure (14).
In order to fix aluminium-made projections on the aluminium surface, the
LOCTITE 401 glue is used. It is designed for the assembly of difficult-to-bond
materials which require uniform stress distribution and strong tension and/or
shear strength. According to the data sheet provided by the manufacturer,
its strength remains on the appropriate level if undergone the temperatures
down to −40◦ C [4]
24
Figure 15: Thermal insulation layer
25
Figure 16: Positions of components inside the CanSat
26
trical insulating tape has been put on the back side of the circuit board. It
has been decided to glue the battery and the GPS module to the other side
of the aluminum plate using hot-melt glue. The second temperature sensor
is placed outside on top of one of the heads of the cylindrical body. To pro-
tect it against the environment, it is covered with several layers of electrical
insulating tape and is fixed on the cylinder head with plastic clamp. The
sensor is connected to a circuit board with 4 wires, put through a hole in the
cylinder head.
27
4 Electronics
4.1 Electronics hardware
4.1.1 CanSat
A schematic can be found in figure (17).
Power supply The CanSat mainly requires two different voltage levels 5V
for ATmega128 and 3.3 V for RF transceiver module. A single 9V can be
deployed for this two levels and desired voltage can be produced using the
regulators namely TSC2940
28
Sensors The three main sensors used for the satellite operations are tem-
perature sensors (FM 75), pressure sensor (MAX4115A) and GPS (GR-213).
The temperature sensors FM75 contain a high-precision CMOS tem-
perature sensor, a Delta-Sigma analog-to-digital converter, and a SMBus-
compatible serial digital interface. Typical accuracy is ±2◦ C over the full
temperature range of −40◦ C to 125◦ C and to ±1◦ C over the range of 0◦ C to
100◦ C, with 9 bit resolution. The temperature sensors value can be directly
read from the SDA and are input to the microcontroller using the Two-wire
Serial Interface.
The pressure sensor used in the mission is MAX4115A. The operating
temperature of the sensor is 0◦ C to 85◦ C and is temperature compensated
for −40◦ C to 125◦ C. The output voltage ranges from 0.2V to 0.48V and
can measure a pressure from 15kPa to 115kPa. The analog data from the
pressure sensors can be converted into digital values through the ADC port
available in microcontroller. According to equation (3), a pressure of 15kPa
is reached at an altitude of approximately 13.7km.
The GPS module is used to locate the position of the CanSat. This
module can track up to 20 satellites and the accuracy depends on the number
of satellites. The protocol used by the GPS is NMEA v2.2 and sends the
data in the form of ASCII values. The operating temperature for the sensor
is −40◦ C to 80◦ C and the position accuracy is ±5 − 25m. The altitude
information from the GPS works up to 18km.
29
Figure 18: Schematic for the electronics on the ground station
Power supply The power required for the ground station can be provided
from the USB. Two regulated power supplies of 5V and 3.3v are required one
for the max 232 and for the communication module respectively.
PC The PC is used for controlling the CanSat from the ground station
and delivering essential commands. The PC software is built in Java and
Operating System is Windows.
30
Component Quantity Voltage Max. op- Max. Percentage Average
Name require- erating power con- of time in power con-
ments, current, sumption, use, % sumption,
V mA mW mW
Microcontroller 1 5 55 275 100 275
ATmega128 [5]
Pressure Sensor 1 5 10 50 100 50
MPX4115A [16]
Temperature 2 3,3 0,250 0,825 100 0.825
Sensor FM75
[9]
GPS module 1 5 80 400 100 400
GR-213 [11]
Radio module 1 3,3 31 102,3 10 10.23
RT433F4 [3]
31
the RS-232 or USB interfaces, the power consumption of the ground station is
not as critical as that of the remote module. The power consumption charac-
teristics of the ground station components (without taking into consideration
the PC) are represented in table (2).
32
1 2 3 4
1uF
A C1 + U1 C5 A
VCC
1 2 Cap
C1+ VDD
3 16 +
C1- VCC
+ 4
C2+
5
C2-
C2 1uF
E 11 14
U2 T1IN T1OUT
10 7
T2IN T2OUT
1 18
GND (ANT) GND 12 13
2 17 R1OUT R1IN
ANTENNE VCC 9 8
Antenna 3 16 R2OUT R2IN
GND (ANT) PD
4 15
NC SP2 15 6
5 14 GND VEE
NC TX
6 13
NC NU MAX232ACPE
7 12
NC RX +
8 11
NC SP1 C5
9 10
GND GND Cap
1uF J1
B 1 B
RX433F4
6
2 11
7
3 10
8
4
9
5
33
D Connector 9
TSC 2940
Vin Vout
GND
S1 Volt Reg
SW-PB + +
C3 C4
C Cap2 Cap2 C
VUSB 10uF 10uF
1
2
3
4 GND
USB
Title
D D
VCC
C5 + U1 C6 1uF
1uF 1 2 Cap
C1+ VDD
3 16 R3
E C1- VCC
U2 + 4 1K R2
C2+
5 1K VCC 5V
C2-
1 18
A GND (ANT) GND C7 1uF A
2 17 11 14 SDA INT1 PD1 SDA VDD
ANTENNE VCC T1IN T1OUT
Antenna 3 16 10 7 A0
GND (ANT) PD T2IN T2OUT
4 15 SCL INT0 PD0 SCL
NC SP2
5 14 12 13 A1
NC TX R1OUT R1IN
6 13 9 8 OS
NC NU R2OUT R2IN
7 12 A2
NC RX
8 11 15 6 GND
NC SP1 GND VEE
9 10 FM75
GND GND
MAX232ACPE Outer temp sens
+
RT433F4 C8 VCC 5V
Cap SDA INT1 PD1 SDA VDD
1uF SCL A0
SCL INT0 PD0
OS A1
A2
GND
FM75
B B
MPX4115A SCL INT0 C1_25 inner temp sens
RXD_RS232 C4_2
VOUT
GND
VS
NC
NC
NC
TXD_RS232 C4_3
1 2 3 4 5 6
VBUS C5_1 VBUS
34
1
USB_D- C5_2 D-
2
C2_29 USB_D+ C5_3 D+
3
VCC 5V
R1 PF0 (ADC0)
C9 4
ADC0_PRES
1K
USB
1uF PD2 (RXD1/INT2) C1_27
1
PD3 (TXD1/INT3) C1_28
2
S2 J1
C C
RESET J1 1 /RESET_1
C1_22
J1 2 GND_RESET GND 1 C2_21
GND 2 C2_31
GND 3
S3 R1 J1
TX RS232 1
RESET 10K C2_23 ADC6_TD0_PF6 VCC 5V 2
1 5V TX TTL 3 S
Vin Vout
VCC 1
VCC 2
3 4
GND RX TTL 5
C1 2 TSC 2940 C2 CRUMB 128 RX RS232 6
1 3.3V
1. effectiveness
2. reliability
3. resiliency
5.2.1 Effectiveness
A communications protocol needs to be effective and efficient with respect
to the equipment. It needs to be defined clearly before implementation.
5.2.2 Reliability
Reliability of data transmission is essential for a good communication proto-
col and it involves error detection and correction, and if error occurred there
need to be a way for requesting retransmission. Communication systems
use different methods to detect and remove the errors. These can be check
sums, parity bits and cyclic redundancy checks. In our system we planned
to implement cyclic redundancy check for this purpose.
5.2.3 Resiliency
Network failure common for a communication system, known as topological
failure in which a communications link is cut, or degrades below usable qual-
ity. Most modern communication protocols periodically send messages to
test a link. In our design, we try to implement it using handshaking signals
and it will be discussed in the following sections.
35
5.3 Specific Requirements
• All properties we are interested in and we are measuring at the CanSat
are received at the ground station
• Data transmission is guaranteed
• Control instructions are sent from the ground station to the CanSat
• The CanSat must detect and recover from communication problems.
5.4 Protocol
Based on the requirements and the feasibility study carried out, it is found
that a protocol similar to TCP/IP will be suitable for the CanSat mission.
The data send from or to CanSat can be considered as packets, sequence of
bytes. Packets can be broadly classified as:
• Packets from the CanSat to the ground station.
• Packets from the ground station to the CanSat.
SA F
36
An acknowledgement for a packet that it receives from CanSat
Before sending a particular data packet, the CanSat stores the packet in the
EEPROM of the microcontroller on board. This is a precautionary mea-
sure. Because every time ground station receives a packet it has to give the
acknowledgement to CanSat. This packet inform the CanSat that it has
it has received a particular packet identified by the number, otherwise the
CanSat will resend the packet again till it gets the acknowledgement for spe-
cific packet. After receiving the acknowledgement it can erase the value in
the EEPROM. This packet is described in table (4).
AC No
Data packets The data packet represents the data from sensors which is
send to the ground station from CanSat. The data could either be designed
as fixed length or as variable length. The simplest solution is to have fixed
length packets with fixed positions for the data from the different sensors.
Such a packet does not need any size field in the header. For the CanSat,
creating the packets and storing the packets in a buffer is easy. The position
of packets stored in the buffer can be predicted without reading any data.
For the ground station, reading the packets is easy. The amount of data sent
in a package is fixed: if more data needs to sent (because of congestion or an
increased sampling rate), that means sending more packages. If the relative
amount of data acquired by the sensors is changed, some packets will contain
no information on the sensor whose sampling frequency was decreased. A
much more flexible solution is to have variable length packets with variable
positions for the data from the different sensors. This can be implemented
by having a size field in the header and either the different sensor segment
37
sizes in the header, or delimiters between the different sensor segments in the
body. This complicates considerably the creation of packets, the reading of
packets, the storing of packets in the data buffer and the reading of packets
in the data buffer. We have chosen for a fixed length packet. The data packet
is described in table (5).
Start (Starting bytes). The first two bytes of any data packet are S and
A.
t (Timestamp) The first byte is used to denote the hours, the second byte
is used to denote the minutes and the third one is used for the seconds,
in total three bytes.
Lat (Latitude) This field represents the latitude of the CanSats current
position It uses five bytes. The first byte denotes the degrees. The
second bytes degrees describes the minutes. The third byte describes
one-hundredths of a minute (0-99): .mm. the fourth byte describes
one-tenthousandth of a minute (0-99): .00mm. The fifth byte is N
(north) or S (south).
38
Long (longitude) The longitude is described by seven bytes. The first
three bytes describe the three digits of the degrees. Bytes 4-6 are
similar to the 2-4 bytes for the latitude. The 7th byte is E (east) or W
(west).
H (Altitude) The number of bytes for the altitude varies padded into five
bytes for a maximum of five digits (up to 99.999km).
Stop (stop bytes) This field denotes the ending of a particular packet. It
is represented with two bytes, S and T.
SA F
39
6 Microcontroller programming
6.1 The Microcontroller
The microcontroller used to control the CanSat module is an ATmega128,
8-bit microcontroller. It is a low power, high performance advanced RISC
architecture controller. By executing powerful instructions in a single clock
cycle, the ATmega128 achieves throughputs approaching 1 MIPS per MHz al-
lowing the system designer to optimise power consumption versus processing
speed [5]. The device is manufactured using Atmels high-density nonvolatile
memory technology. The On-chip ISP Flash allows the program memory to
be reprogrammed in-system through an SPI serial interface, by a conventional
nonvolatile memory programmer, or by an On-chip Boot program running on
the AVR core. The boot program can use any interface to download the ap-
plication program in the application Flash memory. The ATmega128 AVR is
supported with a full suite of program and system development tools includ-
ing: C compilers, macro assemblers, program debugger/simulators, in-circuit
emulators, and evaluation kits.
Main features relevant for the CanSat are [5]:
• 4K Bytes EEPROM
40
6.2 Programming Tools used
AVR Studio 4 IDE
WinAVR C compiler
avrdude gui software to download programs to chip
realterm software for checking the USART data
The microcontroller program necessary for CanSat are developed in AVR
Studio 4. Programs are written in the C programming language. The source-
code is compiled using the WinAVR compiler and downloaded to the flash
program memory of the microcontroller using the avrdude- gui.
6.3.2 GPS
GPS is connected to the USART 1 of the microcontroller. By default GPS
sends data in 8 bit, 1 start bit 1 stop bit format in 4800 baud rate [11]. Data
is read from the usart1 and processed it before sending it to ground station.
41
(SCL) and one for data (SDA). This is a master slave kind of operation in
which microcontroller acts as master and the temperature sensors are slaves.
All address packets transmitted on the TWI bus are 9 bits long, consisting of
7 address bits, one READ/WRITE control bit and an acknowledge bit. If the
READ/WRITE bit is set, a read operation is to be performed; otherwise a
write operation should be performed. The MSB of the address byte is trans-
mitted first. All data packets transmitted on the TWI bus are 9 bits long,
consisting of one data byte and an acknowledge bit. During a data transfer,
the master generates the clock and the START and STOP conditions, while
the receiver is responsible for acknowledging the reception. The MSB of the
data byte is transmitted first [5].
42
The programming of the microcontroller consists of different submodules:
• Process the data and store it in a buffer. This includes creating the
packets.
• Transmit the data to the ground station using the radio module
RT433F4.
43
System CanSat
Digital_temp
Temp sensor
RF_ATmeg RF_GS
Analog_
pressure ATmega128
Pressure Microcontroller RF module
sensor
GPS
Digital_Gps
System CanSat
SIGNAL
Analog_pressure ( Analog)
Digital_Gps ( Ascii )
RF_ATmeg ( Bytes)
RF_GS (Bytes)
44
Process Diagram
Initialization
Wait for
timer interrupt
Timer
interrupt
Data
acquisition ,
Processing
Sense Data
Data
acquisition ,
Sending Data Processing
Timer
Data to Interrupt
Groundstation
Signal from
groundstation
Send
Complete
Check the
Message
Wait for
timer interrupt
Sampling ACK
Change
Discard the
Save changes acknowledged
in sampling period
packet
45
7 Java programming on the ground station
To monitor and control the satellite and its measures, the ground station run
a software that was specifically designed and developed by the CanSat group
for this purpose. The software application meets some compulsory require-
ments. In addition to those, some constraints were defined by the CanSat
group keeping in mind the resources available (time, knowledge, workforce
and others) and the employment of the software. The requirements and the
guidelines will be explained in more detail in the following sections, as well
the organisational plan for this subsystem of the project. Finally, the soft-
ware design is introduced, following the graphical user interface and brief
guide to the use of the Ground Station application.
1. Hardware: normal PC
46
The hardware specified allows a huge processing, storage and user friendly
interface capacity when compared with the CanSat. The developed the pro-
gram in Java will allow to reach the portability of platform with few or
perhaps even none important restriction. Also, Java is a well documented
and supported language offering libraries that helped the group to accomplish
the functionalities for the application in easier way.
Additionally, the requisites stated some features of the application,
namely:
4. Store/Save data;
47
interface. Considering the expertise of the group with such classes, that they
provide a comprehensive and easy set of components for the interface and
its extensive use and documentation, this decision was reasonable. However,
implementation of specific classes to render data graphics were also employed.
It was chosen two approaches to deal with the fourth application feature.
As a pattern solution to store data, a database was implemented to save the
CanSat acquisitions. In the same time, however, the application provides
the storage of data in XML file format. As far XML is the standard for
data exchange, the CanSat makes, in this way, its information available for
employment in other systems. The redundancy of the XML file format is
not a critical issue regarding to the size of the files because the duration
of the data acquisition combined with the ideal sampling frequency will not
generate a huge volume of data. For the implementation of the database, it
was used the SQLite with the SQLiteJDBC Driver/Wrapper. To implement
the XML functionality, the Java JDOM API was used. The decision both
for the SQLite and for the JDOM is due the portability they allow between
Windows and Linux, the simplicity, easy to use and the previous experience
of the group with them.
Additionally, the application can write the positions to a file that can be
read by Google Earth, so that the position of the CanSat can be tracked live
combined with other data in a popular Geographical Information System.
48
3. Dynamic behaviour view: Emphasises the dynamic behaviour of the
system by showing collaborations among objects and changes to the
internal states of objects. In a simple way, it is said that they show
what happens when there is an interaction in the system.
For each view of the system, there could be more than one type of UML
diagram. However they would represent similar information in different ways.
To make a comprehensive, and not exhausting, model of the ground station
application, the procedure followed is explained below (it is supposed from
now on that the reader is familiar with the object oriented concepts):
1. Use case diagram: the use case diagram describes what the system
should do from the standpoint of an external observer. Through it was
possible to define exactly what functionality it is intended to provide
to the application from an external perspective.
49
Figure 23: User case diagram
7.4 Design
The resulting diagrams from the ground station application will be now in-
troduced in the order they were engineered. The use case diagram for the
software that was employed is shown in figure (23).
The diagram shows the three functionalities of the application and the
actors involved in them. The first functionality is to control CanSat. By con-
trol should be understood: to connect to CanSat, to disconnect from CanSat,
to monitor online the measurements of sensors in CanSat. All these func-
tionalities regard the point of view of the users in the Ground Station. These
users are called generically “Analyst”. The functionality “Control CanSat”
also comprises to set sampling ratio. This functionality, however, both the
“Analyst” and the “CanSat” can or will use. The second functionality of the
diagram is the “Analyst Record Acquisitions”. That means that the users in
the ground station will be able to save the data they are online monitoring.
The third functionality is “Analyst Analyse Acquisitions”. The functionality
states the possibility of the users in the Ground Station load in the graphical
user interface previous acquisitions from CanSat while they are not connected
to it.
The diagrams representing the dynamic behaviour views of the system
are in the Attachment 2 of this report. They are being skipped from the
50
main text due to its size. Finally, the class diagram is showed in figure (24).
It is shown that the system consists of eight classes. The relation among
the classes and their attributes and methods are also shown in the figure.
The system was derived keeping in mind the requirements for the Ground
Station and the guidelines defined by the group. The components of the sys-
tem were abstracted to provide easy maintainability and modularity. That
is, there is one class to deal with the user interface (UIWindow2), one with
the database (MeasureDAO), one with the networks issues (WirelessNet-
work) and two with XML data storage (MeasureDAOXML and Acquisition-
DAOXML). Despite that, two classes (Acquisition and Measure) represent
real objects/entities. By last, one class was designed to integrate all these
classes and work as a core of the software. It is important to mention that
existing classes from JAVA APIs and libraries were not represented in the
designed diagrams.
7.5 GUI
The GUI (Graphical User Interface) provides to the analyst an easy inter-
action interface to the CanSat system at the ground station. It allows the
visualization of acquisitions online (while measurements are being sent by
CanSat) and offline (when the measurements are loaded from the database),
the execution of queries in the database of previous acquisitions, to monitor
the communication control between cansat and ground station and finally it
also provides the analyst the possibility to control the measurements sam-
pling frequency. The important features for the analyst in the GUI, showed
in the picture (25), are;
• the control application buttons - the buttons provide to the analyst all
needed interaction to operate the application. See the chapter 7.6 for
more details!
51
MeasureDAOXML AcquisitionDAOXML MeasureDAO UIWindow2
52
-temperature_out: Float -currentAcq: Acquisition
+setTime(newTime: Integer) -recording: Boolean
+getTime(): Integer -acqFreq: Float
+getAltitude(): Float -cansatLink: ReadJ
+setAltitude(newAltitude: Float) -currentDB: File
+getHumidity(): Float -dbConn: MeasureDAO
+setHumidity(newHumidity: Float) -desiredFreq: Float
+getLatitude(): Float -online: Boolean
+setLatitude(newLatitude: Float) -recordLog: String
+getLongitude(): Float -coordinates: String
+setLongitude(newLongitude: Float) -restartAcq: Boolean
+getPressure(): Float -userWindow: UIWindow2
+setPressure(newPressure: Float) -xmlConn: AcquisitionDAOXML
+getInnerTemperature(): Float +loadAcquisition(file: File)
+setInnerTemperature(newInnerTemperature: Float) +setAcqFreq(newSamplingFreq: Float)
+getVelocity() +record(file: File)
+setVelocity(newVelocity) Acquisition ReadJ +getDesiredFreq(): Float
+getVoltage(): Float +connect()
-measures: Measure -application: AppCore
+setVoltage(newVoltage: Float) +requestNewSampleFreq(newSamplingFreq: Float)
-acqCreationInstant: String -twoway: Boolean
+getCalculatedAltitude(): Float +addMeasure(newMsr: Measure)
+getCalculatedVelocity(): Float +getMeasures(msrList: ArrayList) -currentPacket: Integer
+addMessage(msg: String)
+getOuterTemperature(): Float +setMeasures(masureList: ArrayList) +analyzeAcquisition(s: String)
+sendNewDesiredFrequency(multiple: Integer)
+setCalculatedAltitude(newCalculatedAltitude: Float) +addMeasure(newMeasure: Measure) +start()
+serialEvent(event: SerialPortEvent)
+setCalculatedVelocity(newCalculatedVelocity: Float) +stopRecording()
+setApplicationConnection(appObj: AppCore)
+setOuterTemperature(newOuterTemperature: Float) +finishRecording()
+setTwoWayLink(newTwoWayValue: Boolean)
can double click over the display and enter a new desired sampling
frequency. The analyst can set the communication link mode typing
either “downlink” or “twoway” in the message box that appears when
the display is clicked. This frequency however, is not ensured to be
employed (see section 5.4.1).
• Tracker map - the tracker map offers a view of the ground track of
53
the cansat. It contains a aereal picture of the region where the cansat
will operate/fly. The ground track is drawn in a yellow string over this
picture. It should however be considered only for a rough view of the
ground track, since it was euristhically calibrated (see section (2.5.1).
54
do it, after to load a database in the offline environment, the analyst
should press the button “Search” and enter the desired SQL query. The
query is executed over the opened database and not on the acquisition
shown in the acquisition interface. Invalid queries will not be warned,
however the acquisition interface will be empty. The successfull exe-
cuted queries will be shown instantaneously in the acquisition interface.
Afterwards, the analyst will be able to perform any offline operation.
55
offline environment”.
56
location will be same of the database file, but with the extension .xml)
and a log file will also be generated with the relevant events in the com-
munication between cansat and ground station that happened while the
application was recording (the name and location will be same of the
database file, but with the extension “.log”). The analyst will be able to
perform the following offline operations: “Seeing information about the
development of the CanSat system”, “Loading a previous acquisition”
and “Turning into the online environment”.
57
8 Implementation and integration
8.1 Implementation
8.1.1 Structure
Refer to section (3) for the implementation of the structure subsystem.
8.1.2 Electronics
CanSat The electronic subsystem system of the CanSat is designed so as to
monitor, acquire pressure and temperature of the environment and the posi-
tion of the satellite and transmit it successfully to the ground station. These
requirements of the satellite are implemented mainly through four subsys-
tems Power supply, Microcontroller, Sensors and, Communication Module.
The Circuit diagram for the CanSat is provided in figure (20) on page
(34)
The major changes from the M1 to M2 report in the CanSat is the in-
terface for programming the CanSat has been changed to to USB. An extra
aliasing filter has been added to avoid the noise from the pressure sensors.
Both the GPS and the USB interface are connected to the UART1.
Ground station The ground station is the part of the mission where the
complete data received from the CanSat is processed and displayed to the
user. The main units in the ground station are Power supply, Communication
module, Level The main change in ground station is the power delivered is
Through USB.
The Circuit diagram for the Ground Station is provided in figure (19) on
page (33).
8.1.3 Communication
The protocol for CanSat is implemented using the RF transceiver RT433F4,
the ATmega 128 microcontroller and the RT433F4 transceiver which has an
operating frequency of 433 MHz and has 10 user programmable frequency
channel. The module can be set to three baud rates: 9600, 19200 and 38400
baud. In the CanSat we planned to use a baud rate of 9600 and frequency
channel of 433.80 MHz. The module can be put into power down mode which
consumes less power when compared to active mode.
After sensor data sampling and data processing the data packet is send
from CanSat to ground station (for details see section). Before sending the
data, it is stored in the EEPROM of the microcontroller, when the ground
58
Figure 27: Cansat sending data to ground station.
59
station receives data, it check the packet number and perform necessary
error checking. then give an acknowledgement signal to CanSat about the
successful reception of the corresponding packet. When the CanSat do not
receive the acknowledgement for a specified time it resends the packet.
The ground station can control the working of the CanSat by sending
a specific control packet. The sampling rate can be changed by sending a
packet with the specified sampling rate. This is more convenient that having
a separate packet structure for doing the same thing. The CanSat responds
to this control signals by redirecting the control packet to ground station.
This will also ensure that the control signal has reached CanSat and it is
successfully implemented there.
60
Figure 28: Ground station sending acknoledgement for received data.
61
Figure 30: CanSat sending control signal back to ground station.
62
8.1.4 Microcontroller
Refer to section (10.4.3) on page (78).
8.2 Integration
The integration of all subsystems into a full system is a time-consuming
part of every project. We are planning to do a “bottom-up approach” for
integration. As a first step, each subsystem is tested for errors as defined in
the testing section (refer to section (9) on testing for details). After making
sure that the functionality of each subsystem is satisfying, integrate smaller
sections one by one. For integration of different subsystems, it is important to
consider the crucial phases of each subsystem. Completion of the electronics
subsystem is most crucial in the sense that all other subsystems need to
work with that in one way or another. The plan for integration can be
briefly described as follows:
6. Final testing.
63
9 Testing
9.1 Testing individual subsystems
9.1.1 Structure
Every device should be tested carefully and regularly during its production
process in order to check the requirements compliance. While developing
complex electronic equipment, there is often a risk of device failure due to
external factors. In case of the CanSat, such factors are thermal changes,
various shocks during the mission and landing. It must be said that for the
real satellite, the testing phase (which includes overall testing of the equip-
ment) requires up to 50% of the whole development time. Thus the testing
phase of the equipment starts playing the significant role in development of
any kind of equipment.
In order to check the mechanical strength of the CanSat, it is required to
ensure that its body will not break during landing. It is also important to
take into consideration that the fragility of the material goes up while the
temperature decreases. Thus, the frozen body should survive after applying
of mechanical loads.
Since the most critical body part of the CanSat is the Plexiglas cylinder,
an experiment has been made, during which one side of the cylinder has
been cooled to approximately −40◦ C, while the temperature of the opposite
cylindrical side remained +20◦ C. Under these conditions the cooled side
underwent different mechanical loads (free falls, 200g hummer fall onto the
cooled surface of the cylinder from 0.5m height). The body has successfully
withstood the test. Also the one-meter free fall of the assembled CanSat
have been made in order to ensure the shake tolerance of the device.
9.1.2 Electronics
Testing phase is one of the most significant parts of development of the
product of any kind. Usually there is no standard sequence of tests to check
any device. The testing procedure depends very significantly on the device
type, on the operating frequency ond on the functions. And sometimes the
test design requires as much time as the development of device itself. Even
though the test departments of the companies usually have a lot of expensive
equipment, very often they are forced to design some new device in order to
check the device under test thoroughly.
The electrical design of this project mainly consists of the circuit board
development. The ready-assembled components are given, and the only task
is to connect them in a right way (to design the circuit board). Though the
64
task seems simple, it is important to check everything carefully before the
assembling. Right after the electrical design the microcontroller program-
ming part starts. In case the developers get a non-working device, they may
spend a lot of time before the actual designing mistake will be found.
The basic tests, which help to eliminate hardware errors, are described
below:
• Visual test
Consists of visual observing of the electrical circuit and eliminating
defects, such as faulty soldered joint or short-circuit. It is also required
to check whether the actual circuit of the device corresponds to the
designed one. This test is often very simple and doesn’t require any
equipment.
65
Figure 31: Common electronic tests using oscilloscope
2. The test was carried out through tracing the signal by oscilloscope (and
a small error in the radio module was identified) and was corrected.
3. The link was sucessfuly established and we were able to send and recieve
signals both way, uplink and downlink.
Test results:
9.1.3 Communication
Due to its nature, the communication subsystem cannot be tested as a sep-
arate entity. It depends entirely on the relevant parts of the ground station
66
and the CanSat being implemented. Testing the communication subsystem
means testing the integration of the various subsystems. Refer to section
(9.2) for that.
9.1.4 Microcontroller
Checking the program using a simulator is the first step in program testing.
AVRStudio4 has many features to simplify the program testing. In debugging
mode, single step execution and simultaneous checking of each and every
variable is possible. There are also options to check the registers, memory,
IO ports etc. For advanced troubleshooting features like JTAG emulators
can be used.
A bottom-up approach is done for the testing of the microcontroller pro-
gramming. For ease of troubleshooting each submodule in the CanSat is
individually programmed and tested for errors and then later integrated all
together.
67
Special test setup Serial communication is involved in many sections of
the programming. We plan to use special software called “RealTerm Serial
Capture program 1.99.0.34” to check the serial data communicated via the
RS232, to check the protocol and to check the connection to corresponding
serial port RX and TX lines. The advantage of using such software is that
there is no problem for the ground station program, thereby reducing the
error detection difficulty. See figure (32).
Radio module The radio module has a specified set of programming se-
quences which need to be followed for the proper working. As a first step an
arbitrary set of bytes is sent to the ground station through the radio module.
1. Check for the received data at the ground station. The signal from the
receiver part of the ground station can be checked by connecting the
RX pin of the radio module to serial port. The data can be checked
using RealTerm
2. Sometimes it can happen that data may not be detected by such soft-
ware. Then simply a CRO can be utilised to check any data is coming
to the pins of radio receiver. Return to step 1.
3. Check for any error in the transmitter. It can be checked by connecting
usart 0 pin of the serial port and checking using RealTerm. If this test
passes, go to step 1.
4. Check using CRO if step3 fails. If this test passes, go to step 3
68
Pressure sensor The pressure sensor is connected to the ADC of the mi-
crocontroller. It can be easily checked using the serial port realterm arrange-
ment as described in the previous case.
• Check using the serial port realterm setup, whether the whole program
is working and packets are formed in accordance with the protocol
definition, without enabling the radio link.
• Check the link failure by deliberately switching off the ground station
for a specified time and switch on again and receive the data and check
the time information along with the packet to validate the result.
69
9.1.5 Java programming
For the purposes of testing, the Java application consists of several subsys-
tems. Those subsystems can be further subdivided into further and further
smaller subsubsystems, down to the smallest units that the program consists
of, small (helper) methods of only a few lines of code. By testing that those
methods work, then testing that the methods using those methods work,
all the way up to the entire program, a fault introduced by a change can be
identified and pinned down immediately. This is the principle of unit testing.
Database subsystem
• Check that getting all data from the database retrieves the exact same
data as the data that was put into the database.
• Check for a number of hard coded select statements that the resulting
data corresponds with what one would expect from the
70
Test implementation and results The class TestMeasureDAO.java
tests the class MeasureDAO and all classes used by this class, thus most of
the database subsystem. It implements the design described in the previous
paragraph.
Creating a database, storing random data and retrieving the data is suc-
cesful.
Figure 33: Screenshot of the GUI in use. See also figure (25) for an identifi-
cation of the different parts of the GUI.
Communication subsystem
71
3. Test whether the program detects any communication failure and re-
covers from it if one exists.
4. To test and confirm that there is no data loss during the communica-
tion.
5. To test whether the sampling rate is being controlled from ground sta-
tion or not.
• Measure whether the CanSat dimensions are within 0.5L and measure
whether the weight under gravitational acceleration corresponds to a
mass less than 0.5kg.
The CanSat dimensions can be seen in figure (12) on page (23). The
mass of the CanSat has been measured. It is: 426gram.
• Check whether the CanSat and the ground station are on when supplied
with power.
This test has been performed and the result is positive.
• Test whether the CanSat can acquire, filter and pre-process sensor data.
The tests in section (9.1.2) and (9.1.4) are sufficient for testing this,
refer there for the results.
72
measuring the external temperature. To solve this, a layer of insulation
needs to be put between the circuit and the body, so that the circuit
does not get grounded by the case again.
See also in section (9.1.4) the paragraph about the radio module.
• Test the thermal insulation; compare the inner and outer temperatures
in extreme conditions and check whether the systems are still function-
ing properly. To this purpose, we could put the CanSat in a freezer.
Due to time constraints, this test has not been carried out.
• Test whether the CanSat and the ground station recover autonomously
after a temporary communication loss and whether a link failure is
properly detected and temporarily stored.
At a moment on which the ground station and the CanSat are in con-
tact, the ground station is switched off to emulate a communication
link failure. When the ground station is switched on half a minute
later, the communication link was re-established and the missed data
was retransmitted by the CanSat.
73
Property Measure Reference Difference Tolerance
Longitude 9.973078◦ 9.973075◦ ◦
0.000003 ≈ 2m 5 to 25m
Latitude 49.780875◦ 49.780839◦ 0.000046◦ ≈ 4m 5 to 25m
Altitude 278.8m 271m 7.8m 5 to 25m
Temperature 7◦ C unknown unknown 1 to 2◦ C
Pressure 98kPa 98.20kPa 0.20kPa 1.5%
• Test if the information displayed in the GUI not only matches with the
real world, but also with the information stored in the database and
the information exported to XML.
The information stored in the database is correct, as well as the infor-
mation dumped into the XML file.
74
10 Time plan and work distribution
For the purpose of dividing and planning the work, the project is divided in
five main modules as defined in the introduction in section (1.2.1).
The responsible people per task are listed in table (8).
Table 8: Tasks with responsible and second responsible person. The tasks
are carried out by the responsible person and the replacement together. For
the ground station, Gerrit is the third person working on it.
A time plan and a distribution of work have been made in a Gantt chart
[19]. The Gantt chart has been attached to the report: see figure (46) on
page (101).
10.1 Structure
Consists of designing and implementation of the mechanical packaging, of
the ground station and CanSat. The properties and the characteristics of
the packages are described Chapter 3.
• Testing of the packages for the purpose of compliance with the require-
ments.
75
10.1.2 Crucial phases
It is much more convenient to carry out the programming testing phase using
the fully or at least partly assembled components. Thus it is desirable to
finish the fabrication of the CanSat and the ground station packages before
the start of the programming testing phase.
The design of the electrontic board can only be finalised after the design
of the structure.
10.2 Electronics
10.2.1 Work plan
The work plans were mentioned in the Milestone 1 and is as follows:
3. The circuit has to be checked for packing into the CAN (Mechanical
structure).
76
10.3 Communication
10.3.1 Work plan
Major work in implementing communication protocol is divided as follows.
1. Define the protocol
2. implenetaion of the protocol
3. testing of the protocol for reliability
• defintion of the protocol handled by joshy and gerrit
• implementaion is to be done by joshy and raveesh
• testing is to be done by joshy and raveesh
10.4 Microcontroller
10.4.1 Work plan
Like with the Java programming (see section (10.5.1)), the main phases of
work are design (mostly finished by Milestone 1, 5 November), implemen-
tation (should be practically finished by Milestone 2) and testing (must be
finished by Milestone 3). Within each of these phases, a number of sub-tasks
have been identified:
• Read data from sensors
• Process read data
• Communication with the ground station.
The amount of relative work put in those tasks depends on the exact
definition, but the tasks can be further subdivided according to the workflow
sketch in figures (21) and (22) on page 44 and beyond.. See also the relevant
part of the Gantt chart (attached to the document).
77
10.4.2 Crucial phases
Completion of the CanSat elecronics.
78
11 Discussion and future expansion
The CanSat can be improved in a number of ways.
A humidity sensor could be added. Advantages of this are discussed in
section (2.6.1) on page (17).
The voltage over the battery can be measured. This would allow for
monitoring and fault detection.
The CRC check as discussed in section (11.2.2) has not been implemented.
Implementing this would result in a higher relialibity of transmitted data.
The CanSat could decide autonomously to change the sample rate based
on the link quality, as discussed in section (5.4.2).
The ground station could include an option for “fly with the balloon”,
where the view as it would be from the balloon is shown. This could be
integrated with Google Earth.
The KML file (for Google Earth) could include all measured information.
79
11.2 Improvements on the CanSat
11.2.1 A handshaking signal
A handshaking signal is a specific packet which is initiated from the ground
station and CanSat has to reply for this signal in a specific format witch will
be described later. This are signals which checks weather the communication
link is connected or it encountered a communication link loss. Ground station
sends this signal in a specified interval, for example in 5 minutes. This packet
is described in table (9).
80
• All odd numbers of errors.
• All burst errors less than or equal to the degree of the polynomial used.
• Most burst errors greater than the degree of the polynomial used.
0 1 0 1 0 1 1 1 0 0 0 0 0 0 0 0
1 0 0 0 0 0 1 1 1 (6)
0 1 0 1 0 1 0 0 1 0 0 0 0 0 0 0
81
The XOR the input bit above the divisor bit by bit with divisor (in other
words, the input bit above each 1-bit in the divisor is toggled). The divisor is
then shifted one bit to the right, and the process is repeated until the divisor
reaches the right-hand end of the input row. Here is the last calculation:
0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 0
1 0 0 0 0 0 1 1 1 (7)
0 0 0 0 0 0 0 1 0 1 0 0 0 1 0
• Separate the message and checksum. Calculate the checksum for the
message (after appending zeros) and compare the two checksums.
4∗K 4 ∗ 1024
No of data packet which can be stored in memory = = = 204.8
20 20
82
Note: stop and start bytes of the packet do not need to be saved in
memory.
So if the link failure persists even after the memory is filled, there is a
chance that the next measurements cannot be saved in memory. So there can
be a discontinuity in the measured values when communication is reestab-
lished. One minor solution is to reduce the sampling rate into a slower rate
and then create some space in memory by removing some data packet with
respect to new slower sampling frequency, and save new data in this new
vacant memory space.
Figure 34: A possible data saving scheme for a CanSat operating in au-
tonomous mode.
83
value and with this new sampling frequency, sensor data is sampled and
stored in the EEPROM (for more details please refer to the communication
protocol). In effect it avoids a discontinuity of the sensor data with a cost
of reduced sampling rate. This mode can be deactivated from the ground
station if it is more important to have the good sampling rate.
84
12 Conclusion
Over a period of several months, a CanSat and a corresponding groundstation
have been built, programmed and tested from scratch. It has been shown
possible to achieve this in a relatively short amount of task by students
who have a limited amount of time. Finally, there has been (yet) another
verification of Hofstadter’s Law [10]:
Theorem 1 It always takes longer than you expect, even when you take into
account Hofstadter’s Law.
85
13 Bibliography
References
[1] Energizer 522 9-volt battery. http://data.energizer.com/PDFs/
alkaline appman.pdf. [Online; accessed 18-December-2007].
[5] Atmel Corporation. 8-bit AVR Microcontroller with 128K bytes In-
System ATMEGA, 2006.
[12] Frida Homberg, Emma Holst, Lisa Johansson, and Tomas Jussing. Nemo
- nordic experiment measuring ozone. http://tinyurl.com/39bnxr,
2006. [Online; accessed 15-January-2008].
86
[15] Clark Lindsey. Floating-point in java. http://www.particle.kth.se/
∼lindsey/JavaCourse/Book/index.html, October 2005. [Online; ac-
cessed 16-January-2008].
[16] Motorola Inc. Integrated Silicon Pressure Sensor MPX4115A, 2001. [On-
line; accessed 15-January-2008].
87
14 Appendix
14.1 XML schema
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="measureList">
<xs:sequence>
<xs:element ref="measure" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
88
</xs:complexType>
<xs:complexType name="measureValues">
<xs:sequence>
<xs:element ref="timeXML" />
<xs:element ref="latitudeXML" />
<xs:element ref="longitudeXML" />
<xs:element ref="pressureXML" />
<xs:element ref="intTempXML" />
<xs:element ref="extTempXML" />
<xs:element ref="altitudeXML" />
<xs:element ref="altitudeCalcXML" />
<xs:element ref="velocityXML" />
<xs:element ref="velocityCalcXML" />
<xs:element ref="humidityXML" />
<xs:element ref="voltageXML" />
</xs:sequence>
</xs:complexType>
</xs:schema>
89
Analyst Ground Station Control Application
90
CanSat Ground Station Control Application
[ measurement ]
[ else ]
[ online ]
[ else ]
[ recording ]
91
Analyst Ground Station Control Application
Update Screen
92
14.2.2 Record acquisitions
See figures (39) on page (93).
Chose File
[ file selected ]
[ cancel ]
[ new ]
[ existing ]
[ add ]
[ else ]
Stop Recording
93
14.2.3 Analyse acquisitions
See figure (40) on page (94).
Chose Acquisition
[ cancel ]
This action should:
1 - close opened DB
1 - open the selected DB
2 - creates a new acquisition
3 - enables the "Search" button
Update Acquisition Interface
[ else ]
[ cancel ]
Query executed over the
Load Result database in the selected file,
not over the acquisition showed
in the interface
94
14.3 Sequence diagrams
14.3.1 Control CanSat
See figure (41) on page (95).
userWindow : UIWindow2 application : AppCore dbConn : MeasureDAO xmlConn : AcquisitionDAOXML currentAcq : Acquisition
1 : connect()
2 : finishRecording()
3 : loadDB()
4 : newMeasureList
5 : storeAcquisition()
Store Acquisition
in XML
6 : closeDBConnection()
7 : loadOfflineScreen()
8 : connect()
9 : closeDBConnection()
<<create>>
10
11 : cleanMessageLog()
12 : removeCurrentAcquisition()
13 : loadOnlineScreen()
14 : setSampleFreq()
95
14.3.2 Record Acquisitions
See figures (42) to (43) on pages (96) to (97).
userWindow : UIWindow2 application : AppCore dbConn : MeasureDAO currentAcq : Acquisition xmlConn : AcquisitionDAOXML
1 : record()
2 : finishRecording()
3 : loadDB()
4 : newMeasuresList
5 : storeAcquisition()
6 : closeDBConnection()
7 : setDBConnection()
8 : wasExisting()
9 : wasEmpty()
10 : enableStartRecord()
11 : start()
<<create>>
12
13 : removeCurrentAcquisition()
14 : enableRecording()
15 : stopRecording()
16 : enableStopRecording()
96
sd Store Acquisition in XML ()
1 : formatAcquisitionToStorage()
2 : getMeasures()
3 : getInstance()
4 : formatMeasureToStorage()
5 : getTime()
6 : getLatitude()
7 : getLongitude()
8 : getPressure()
9 : getInnerTemperature()
10 : getOuterTemperature()
11 : getAltitude()
12 : getCalculatedAltitude()
13 : getVelocity()
14 : getCalculatedVelocity()
15 : getHumidity()
16 : getVoltage()
17 : elMsr
97
14.3.3 Analyse Acquisitions
See figures (44) and (45) on pages (98) to (99).
userWindow : UIWindow2 application : AppCore dbConn : MeasureDAO currentAcq : Acquisition
1 : loadAcquisition()
2 : setDBConnection()
3 : removeCurrentAcquisition()
4 : loadDB()
5 : newMeasuresList
6 : getMeasures()
7 : addMeasureToPlot()
8 : cleanMessageLog()
9 : updatePlotInterface()
10 : enableDBAnalysis()
11 : analyzeAcquisition()
12 : removeCurrentAcquisition()
13 : searchDB()
14 : newMeasuresList
15 : getMeasures()
16 : addMeasureToPlot()
17 : updatePlotInterface()
98
sd Load Measure from DB() : Measure
<<create>>
1 : Measure()
10 : setVelocity(newVelocity): void
99
14.4 Gantt chart
100
101
Figure 46: Gantt chart