Skip to content

Sensors

Using the sensors

Analogue and digital signal. Photo: Andøya Space

Analogue and digital signal. Illustration: Andøya Space

The Arduino Uno CanSat kit comes with a sensor board (shield). Connected to this board are an ntc temperature sensor and a digital multiple-sensor package with a pressure sensor, a 3-axis accelerometer, a 3-axis magnetometer and a 3-axis gyroscope.

The ntc temperature sensor is an analogue sensor which produces a voltage depending on the value of the parameter the sensor measures. It can take on any value in a certain range; such a signal is called an analogue signal, viewed at the top in the figure to the right. From the measured voltages, we can calculate the corresponding value, converting voltage to temperature.

This section will show you how to convert the analogue voltage measured at an analogue sensor, to the physical quantity with the correct unit.

Analogue to Digital

All digital components operate with discrete signals. Unlike the analogue signal, a signal that can only take on some discrete values is called a digital signal. In the figure to the right these two different signals are illustrated. The top graph shows an analogue (continuous) signal, and the bottom graph shows a digital (discrete) signal.

Desktop or laptop computers, as well as the small computer in the CanSat (called a microcontroller), can only process digital signals. To convert the analogue signal from the sensor into a digital one we use an Analogue to Digital Converter (ADC), which as the name implies, converts an analogue signal into a digital signal.

On the Arduino Uno board, the ADC converter is incorporated in the microcontroller and has 8 input channels. It is a 10 bit ADC; it will convert an analogue signal into a digital signal with a 10 bit binary number. One Bit represents one binary digit and can have a value of 0 or 1, which also can be represented by High or Low voltage, as well as On or Off. In programming 0 and 1 is also often represented by True (1) or False (0).

Each digit in the binary number can have 2 values, 0 or 1. A 10 bit binary number can have 210 = 1024 different values, and can represent an integer ranging from 0 to 1023. The microcontroller can understand digital numbers and use it for computations, which can be programmed into the processor by writing a program code. An example of such a code is the FirstCanSat6_2sketch-code which was used in the previous part of this manual.

The ntc sensor in the CanSat is sampled by an ADC, which turns each analogue value into a 10 bit number. 0 volts is converted into the binary number 0000000000 = 0 and 5 volts into the binary number $1111111111 = 2^10 + 2^9 + 2^8 + 2^7 + 2^6 + 2^5 + 2^4 + 2^3 + 2^2 + 2^1 + 1 = 1023.

By representing the 5 volt input by 1024 levels (including 0) we have a resolution of \(5V/1023 = 4,89mV\). This shows us that with a 10 bit ADC, the smallest voltage change we can measure is \(4,89 mV\). This is important to notice when we start working with the sensitivity of the sensors.

The sequence of events using an analogue (temperature-)sensor is thus as follows:

  1. The temperature sensor converts the measured temperature into a voltage. This is an analogue signal.
  2. The analogue signal (voltage) from the sensor is connected to one of the analogue ports on the Arduino Board.
  3. The ADC converts the analogue signal into a digital signal, which the processor can handle.
  4. Inside the microcontroller the signal is stored as a 10 bit binary number, which can be used for computations or can be transmitted via the Arduino TX port and a radio or USB cable to an external receiver.

The GY-91 has a 16-bit ADC converter incorporated and the signals from this sensor package therefore already are converted into 16-bit digital signals before they are handled by the Arduino Uno.

NTC

A temperature sensor used in the CanSat is the NTCLE203E3103JBO manufactured by Vishay/BC components. It is a NTC, or Negative Temperature Coefficient thermistor. The thermal conductivity rises with increasing temperature. Most ceramic materials exhibit such behaviour. Other materials however will have an opposite behaviour, with rising temperature the conductivity decreases. Most NTC thermistors are therefore made out of semi conductive materials, something in between an insulator and a conductor, with some special qualities.

Simply put, when the material is heated, the electrons in the material are energized, so even more electrons are able to move around, thus the material can conduct electricity more easily. When a material can conduct electricity more easily its resistance will decrease. Increased temperature will therefore lead to decreased resistance. This inverse relationship is the reason why this sensor is called a Negative Temperature Coefficient (NTC) resistor.

NTC measuring circuit. Photo: Andøya Space

NTC measuring circuit. Illustration: Andøya Space

On the sensor board, the temperature sensor is connected in series with a resistor (R1) which has a constant resistance of f.ex. 10 kΩ, as seen in the simplified diagram shown in figure to the right. \(V_{cc}\) is either 5V or 3,3V depending on what Arduino board you are using. For the CanSat shield and an Arduino Uno it is 5V. When resistors are connected in series the current in the circuit will be the same everywhere. The total resistance \(R_T\) in the circuit can be calculated by:

$ R_T = R_1 +R_{NTC} $

The current in the circuit is \(I = \frac{U}{R_T}  = \frac{V_{cc}}{R_1 + R_{NTC}}\)

The same current, \(I\), flows through the fixed resistor \(R_1\) and through the NTC giving a voltage \(V_{out}\) across the NTC. This can be put into the following equation:

\(I_{NTC} = \frac{V_{cc}}{R_{NTC}+R_1}  =\frac{V_{out}}{R_{NTC}}\)

From the above equation, we can find an expression for \(R_{NTC}\) :

$ \frac{V_{cc}}{V_{out}}  =\frac{R_{NTC}+R_1}{R_{NTC}} = 1 + \frac{R_1}{R_NTC} $

And therefore

$ \frac{V_{cc} - V_{out}}{V_{out}} = \frac{R_1}{R_{NTC}}$

and finally

$R_{NTC} = \frac{V_{out}}{V_{cc} - V_{out}}\cdot R_1 $.

To get a complete transfer function you will also need the relation between the temperature and the resistance of the sensor (\(R_{NTC}\)). You can find this in the sensor datasheet.

Here you can find an example of how to write the code for converting sensor voltage into temperature C using the Steinhart-Hart equation from the sensor datasheet. Note, that this example's fixed resistor value, the equation constants and the ADC resolution (10 bits or 12 bits) perhaps need to be adjusted to fit your specific case.

Data sheet

  • Data sheet for the NTC sensor can be found here.

GY-91

GY-91

The GY-91. Photo: Andøya Space

We use the GY-91 with an \(I^{2}C\)-communications interface.

The GY-91 consists of the barometric pressure sensor BMP-280 and the multiple-sensor package MPU-9255. The MPU-9255 is a System in Package (SiP) that combines two chips:

  • MPU-6500, which contains
  • a 3-axis gyroscope,
  • a 3-axis accelerometer,
  • and an onboard Digital Motion Processor™ (DMP™) capable of processing complex algorithms.
  • AK8963, a 3-axis digital compass (magnetometer).

GY-91

The GY-91 soldered. Photo: Andøya Space

With the GY-91, the CanSat is able to measure

  • air pressure with a sensitivity of ±0,12 hPa (equivalent to ± 1m) and a pressure range of 300 – 1100 hPa (equivalent to heights from +9000 m above sea level to 500 m below sea level).
  • acceleration i 3 directions, where the full scale range of the digital output can be adjusted to ±2g, ±4g, ±8g, or ±16g.
  • rotational speed around 3 axis, where the full-scale range of the gyro sensors can be digitally programmed to ±250, ±500, ±1000, or ±2000 degrees per second (dps).
  • magnetic field strenght in 3 directions with a full scale range of ±4800 μT.

Data sheets

  • Data sheet for the MPU-9255 sensor package can be found here.
  • Data sheet for the BMP-280 pressure sensor can be found here.

Calibrating the sensors

In some cases the transfer function between the measured physical parameter (for example the temperature) and the output voltage of the sensor is unknown or difficult to calculate from the component datasheet.

A simple method to determine the transfer function f.ex. of a temperature sensor, is to measure the output voltage at some (3-4) specific temperatures, plot the result into a graph as the one shown below and find the transfer function by regression.

Example of NTC measurements for calibration.

Example of NTC measurements for calibration. Figure: Andøya Space

For our specific NTC sensor we can assume that the relationship is linear within the range of interest. Linear regression can be used to find the linear equation of best fit.

Linearity means that the relation between voltage and the parameter (f.ex. temperature) can be expressed by the linear formula:

\(y = a \cdot x + b\)

or in our case temperature:

\(temperature = A ⋅ Voltage + B\)

The graph can be used to estimate the values of A and B. In this diagram you can plot the measured voltages on the x-axis, and the parameter (in this case temperature) on the y-axis. In the table below the diagram you will find some example measurements for this sensor. These measurements are also plotted in the graph. Step two is to draw a straight line through the points. Use the features in your CAS-tool (f.ex. Excel, TiNspire, …) to do this to get the most accurate result. The more points you use the more accurate your result will be. Use it to determine the values of A and B from the standard linear formula above.

A: is the slope of the line

B: is the intersection with the y-axis

Voltage (V) Temperature (T)
0,5 32
1,5 21
3,0 8

Example of measured ntc data.

Altitude calculations

The atmosphere is all around us; it is a thin gaseous layer surrounding our planet. The atmosphere is composed primarily of nitrogen (78%) and oxygen (21%). The remaining 1% consists of water vapour, CO2 and other trace gasses. The Earth’s atmosphere consists of different layers, each one having different properties (temperatures, pressure, composition, etc…).

The different layers are represented in the two figures, along with various human and weather activities seen in these layers.

Unlike our CanSat, most satellites operate in the exosphere. Here the density of the atmosphere is very low. The CanSat however operates in the troposphere, which is the bottom layer of the atmosphere. This layer contains about 80% of the total mass of the atmosphere, and stretches to about 10 kilometres altitude. A great deal of the weather we observe on a day-to-day basis (wind and clouds for instance) occurs within this layer.

The temperature and pressure of the atmosphere varies with altitude. Although the ambient temperature can rise and fall as you move through the different layers of the atmosphere.

Within the troposphere, there is a linear relation between the temperature and altitude. On average, ascending one kilometre from sea level will result in a temperature drop of 6.5 degrees Celsius.

The equation below provides the relation:

\[h = h_1 + \frac{T-T_1}\alpha\]

with

\(T\) - Temperature in Kelvin

\(T_1\) - Starting temperature at \(h_1\) altitude

\(h\) - Altitude in meters

\(h_1\) - Starting altitude

\(\alpha\) - Temperature gradient: \(-0.0065 K/m\).

The relation between the pressure and the altitude is somewhat more complicated. The pressure is not only dependent on the altitude but also on the temperature.

Let’s start with the relation of pressure to temperature:

\[\frac{p}{p_1} =(\frac{T}{T_1})^{\frac{-g_0}{\alpha R}}\]

with

\(p\) - Pressure in Pascal

\(p_1\) - Start pressure in Pascal

\(g_0\) - Gravitational acceleration: \(9.81 m/s2\)

\(R\) - Specific gas constant: \(287.06 J/kg⋅K\)

Inserting this formula into the temperature-altitude relation, we achieve the following expression for altitude as a function of temperature and pressure:

\[h = \frac{T_1}{\alpha} \cdot \left((\frac{p}{p_1} )^{\frac{-\alpha R}{g_0} }-1 \right) + h_1 \]