Recent Changes - Search:

EPOS-N - European Plate Observing System

Projects 2020

Projects 2019

Seismometers / vault construction



Stations: Upgrade/install notes



Ideas for improvements

Installation / Inventory


edit SideBar

Last update: February 17, 2020, at 01:26 PM
Version: pmwiki-2.2.126



10 September, 2015

The purpose of this summer project was to have fun1) and do something useful at the same time - evaluating different sensor modules attached to RaspberryPi and also investigating LoRa telemetry.

The sensor station shown below transmitted sensor data each second via LoRa telemetry module. Another networked RPi received data via identical LoRa unit; a Python program collected data and forwarded them on network as UDP broadcast telegrams, in JSON format - making it simple for other networked applications to harvest data, and perform whatever operation desired ...

This is just a snapshot of the project.

Click to enlarge.
Sensor station, inside enclosure. 1-wire sensors not shown (mounted outside enclosure). Click to enlarge - here is PDF version.


Inspiration - instruments used during hovercraft "Sabvabaa" FRAM-2014/15 expedition.
Click to enlarge.
Electronics installed in polyester reinforced fiberglass enclosure from L-COM. Click to enlarge.
Click to enlarge.
Remote sensor station soon ready for deployment; LoRa antenna not installed yet. Camu net and tape in order to prevent unwanted attention - at this time the IMSI-catcher question was puzzling the nation ... click to enlarge.


  1. Wind speed / direction / temperature unit
  2. Barometer
  3. Temperature sensor
  1. Air pressure sensor
    Bosch BMP180. See appendix for earlier evaluation of this sensor.
  2. Current/voltage sensor
    Two each - "break out board". Monitoring consumption / charging lead acid battery, and solar panel production. See appendix for earlier evaluation of this sensor.
  3. Humidity sensor
    AM2315 - Encased I2C Temperature/Humidity Sensor. (Not enough time to interface - looks complicated.)
TELEMETRY LoRa radio module: Dorji mod 1278DM, using extra RPi serial RS232 port (0-3.3 "TTL" voltage levels) on RPi expansion header

Average power consumption was 2.6 Watt; using "rule-of-thumb" this should require 10x solar panels (in terms of wattage) to keep power balance during nights and cloudy days.

Charge controllers, tried two different types:

  • Biltema p/n: 31635
  • More advanced MPPT type (Maximum Power Point Tracker) which supposedly provides 10-20% more power since it "forces" solar panel to operate at current/voltage combination that yields maximum power.


  • USB-to-1-wire adapter mod DS9490R.
  • 1-wire humidity and temperature sensor mod TAI-8540]]. Notice the two RJ-connector slots, making it easy to extend the 1-wire bus to the next device.
  • TAI-8570: 1-wire pressure sensor.
  • Note: AAG Electronica, the manufacturer of these sensors, is no longer active.

2.1 Wind speed and direction sensor

1-wire wind vane / anemometer unit -- Device ID: 1D (i OWFS = One-wire File System)

Two "counts" for every rotor revolution.

Wind Speed = CONSTANT*Vrotor (in revolutions per second), METER_PER_SECOND, CONSTANT: 1.096

1998 article describing the original Dallas 1-wire weather station.

Most likely we have "AAG Version 3 weather station" which has two "counts" for every revolution.

Calculating Wind Speed from an AAG V3 Weather Station (PDF) -- Regarding version 3

3 LoRa (Long Range) TELEMETRY UNIT

3.0.1 Ordered from EBay - Dorji "DRF1278DM"

Semtech LoRa SX1276 SX1278 UART Interface RF wireless module DRF1278DM

Manufacturer: DORJI, sale rep: Manufacturer web site, and here is Datasheet (PDF)

DRF1278DM Data modem, mfr: Dorji.


  • LoRaTM Frequency Spectrum
  • 433Mhz ISM frequency band
  • -137dBm receive sensitivity
  • 20 dBm max. output power
  • Serial port wake-up
  • Wireless wake-up
  • Star networking ability
  • Supply voltage 3.4~5.5V

Data sheet

Configuration software - serial link to PC - remember to use USB-serial adapter with 3.3V signal level.

This Dorji module is based on chip made by Semtech. Attach:sx1276_77_78_79-1.pdf

USB adapter is included. Using this adapter in Windows require driver from SiLabs. Chose this driver for Windows XP/Server 2003/Vista/7/8/8.1 (v6.7).

here's a comprehensive overview over LoRa and various LoRA-modules on the market (as of july 2015).

Article criticizing LoRa technology - check.

3.0.2 How to attach LoRa-module to RaspberryPi

  • LoRa unit requires 5 V supply
  • Set ENABLE input pin to 0 V
  • TX- og RX-inputs use 3.3V TTL - so they can be directly connected to RPi serial port on expansion header.
  • This RPi serial port - accessed as /dev/ttyAMA0 - is also used as TTY-terminal for linux login, and also output channel for linux kernel boot messages. These functions must be disabled. It can be done in raspi-config or by following instructions here.

3.0.3 Configuration of LoRa unit

The LoRa unit can be set to e.g. various power levels by sending a command sequence. This means it cannot be employed in a link receiving arbitrary binary data because we risk accidentally sending a command sequence. Ref later section on how this problem is solved.

Command structure:

   Sync word    ID code      Header    Command    Length    Data    CRC       End code
   0xAF 0xAF    0x00 0x00    0xAF       XX YY       LEN     XXXX     CS       0x0D 0x0A

          0x80  in sending command
          0x00  in response command

          0x01  write
          0x02  read
          0x03  standard
          0x04  Central
          0x05  Node   

   Data block always 12 bytes in size:

     #    n   Parameter     Options
     1    1   Baudrate      1=1200, 2=2400, 3=4800, 4=9600, 5=19200,6=38400, 7=57600
     2    1   Parity        0=no parity check, 1=odd parity, 2=even parity
    3-5   3   Frequency     The value=Frequency/61.035. E.g. For 433MHz, the value=433000000/61.035
     6    1   RF_Factor     7=128, 8=256, 9=512, 10=1024, 1=2048, 12=4096
     7    1   Mode          0=standard, 1=central, 2=node
     8    1   RF_BW         6=62.5k, 7=125k, 8=250k, 9=500k   (RF = Radio Frequency BW = Band Width)
    9-10  2   ID            0x0000 ~ 0xFFFF, high byte first
    11    1   NetID         0x00~0xFF
    12    1   RF_Power      1=4dBm, 2=7dBm, 3=10dBm, 4=13dBm, 5=14dBm, 6=17dBm, 7=20dBm

    "CS refers to CRC code which is the remainder of the sum of data section divided by 256."
    ERROR IN DOCUMENTATION: Check sum is calculated of ALL preceding characters (before the CS itself).


   Sync word    ID code      Header    Command    Length    Data    CRC       End code
   0xAF 0xAF    0x00 0x00    0xAF       XX YY       LEN     XXXX     CS       0x0D 0x0A

   $AF,$AF,     $00,$00,      $AF,     $80,$01,     $0C, (=12 stk)
   data block:  $02,$00,$6C,$80,$12,$09,$00,$07,$00,$00,$00,$01,           # Power = 4dBm
   CS+end code: $AB,$0D,$0A

   $AF,$AF,     $00,$00,      $AF,     $80,$01,     $0C,
   data block:  $02,$00,$6C,$80,$12,$09,$00,$07,$00,$00,$00,$02,           # Power = 7dBm
   CS+end code: $AC,$0D,$0A

3.0.4 Setting up SLIP or PPP-link between two RasperryPi, via LoRa-modules?

3.0.5 Misc.

3.0.6 How to transfer file (e.g. from PiCamera) via low bitrate serial link?

3.0.7 Other useful tips regarding gpsd, minicom, RFID:


3.0.8 Fra Cooking Hacks


4.1 Compression and "printable ASCII" encoding

The LoRa radio module we use can be put into command mode by sending a specific combination of characters.

The ASCII character set reserves many codes for link and message control. Here is the ASCII table, for reference. Control codes are in the 0-31 range.

Note that our LoRa radio module uses codes from the extended character set as control characters (SYNC WORD and HEADER = 0xAF).

It means we must ensure this combination never occurs in normal data telegrams. The ordinary way of achieving this is by encoding the data telegram so only printable ASCII characters are sent. By "printable ASCII" we mean characters in the range 32 - 127. On the receiving end the telegram is decoded.

Encoding can be combined with compression in a single expression using the Python zlib library which is included by default. The zlib is a comprehensive package with it's own documentation at

    enc = zlib.compress(telegram, 9).encode('uu')

On the receiving side the reverse process is performed:

    dec = zlib.decompress(response.decode('uu'))

4.2 Calculating checksum (CRC = Cyclic Redundancy Check)

Message integrity is protected by calculating and adding CRC. The receiver recalculates CRC and confirms the result. Any discrepancies can be treated according to telemetry protocol: a) Whole telegram is discarded, 2) a NACK (negative acknowledge) is sent to the transmitter, resulting in retransmission of corrupted telegram.

4.3 ACK - NACK protocol

Some ASCII control characters we can utilize (ref ):

		SOH = 0x01 # Start of Heading
		STX = 0x02 # Start of Text
		ETX = 0x03 # End of Text
		ETB = 0x17 # End of Transmit Block
		EOT = 0x04 # End of Transmission
		FS  = 0x1C # File Separator
		GS  = 0x1D # Group Separator
		RS  = 0x1E # Record Separator
		US  = 0x1F # Unit Separator

                ACK = 0x06 # Acknowledgment
                NAK = 0x15 # Negative Acknowledgement
                ENQ = 0x05 # Enquiry

Check also Z-, Y- and X-modem file transfer protocols.


5.1 Test of Bosch BMP180 pressure sensor June 2015

In June 2015 we collected data from Bosch BMP180 air pressure sensor, and compared results to weather station data collected at Geophysical Institute, University of Bergen, which is very near our department.

We used this sensor break-out board: Adafruit: BMP180 Barometric Pressure/Temperature/Altitude Sensor- 5V ready.

Click to visit Geophysical Institute web page.
Geophysical Institute, University of Bergen. Their Aanderaa weather station is situated in the tower.
Click to enlarge.

Comparison of data from Aanderaa mod. 2810 Air Pressure Sensor (blue curve) at Geophysical Department, University of Bergen, and Bosch BMP180 (red curve). Constant offset 3.5 hPa subtracted from BMP180 data and plotted (light red). Click to enlarge. NOTE: Sensor designation is not correct in plot - must be fixed - by someone ..

5.1.1 Gnuplot documentation

Plot made using GNUPLOT - see nice plot gallery. It's very convenient that plotting of timestamped data sets with different sampling rates are taken care of automatically - this would have represented a headache in e.g. Excel. Plotting offset subtraction is also easy to achieve with Gnuplot. Download Gnuplot command file below and execute in terminal window by typing gnuplot [file name]; of course, you have to install Gnuplot first and (on Win machine) either update the PATH environment variable (Google provides assistance) to include link to gnuplot executable, or provide complete path to the gnuplot binary file. You also need to download two data files to the same directory:

# GNUPLOT commands related to test of pressure sensor Bosch BMP180
# University of Bergen, Norway
# Department of Earth Science
# Files:
#   pressuresensor-BM180-test-11June2015.txt
#   Geofysen-trykkdata.txt
# Pressure offset estimation, at 10 deg C, from
#    Normal conditions, at sea level .............................:  1013.25 hPa 
#    Geophysical Department, reference sensor location 45 m ASL ..:  1007.76 hPa
#    Bosch BMP180 sensor location (estimate), 28 m ASL ...........:  1009.83 hPa
#                             DIFFERENCE 45-28 m ASL .............:     2.07 hPa           
# O.M.  14 June 2015

#---- Set terminal (output) type. We want PNG graphic file.
##set terminal png size 1280,800 font helvetica 9  
set terminal pngcairo size 1000,760 enhanced font 'Verdana,10'

#---- Name our output file
set output 'pressure_sensor_Bosch_BMP180.png'

#---- Give the plot a title
set title \
"NNSN - SEISMO LAB - Test of pressure sensor Bosch model BMP180 - by O.M. - 14 June 2015\n\
Sensor location: Room 2130, Realfagbygget, Alle gt. 41 - estimated 28 m A.S.L.\n\
Reference sensor: Aanderaa Air Pressure Sensor model 2018, location: Geophysical Institute, Alle gt. 70, tower, 45 m A.S.L.\n\
Department of Earth Science - University of Bergen - Norway" \
font 'Verdana, 10'

set key box opaque

#------  Set label with more information
#LABEL = "Air pressure vs height at a given temperature:"    # Text to display, dump in variable
#set obj 10 rect at screen 0.1, 0.2 size char strlen(LABEL), char 1 
#set obj 10 fillstyle empty border -1 front
	#set label 10 at screen 0.1, 0.2 LABEL front left
set label "Calculated offset adjustment for height difference 45-28m: 2.07 hPa (at 10 deg. C).\n\
Source:" at screen 0.1, 0.192 left 

# First define two new linestyles (#100 & #101)
#    lt = linetype   = 1 (solid line)
#    lc = linecolor  = set RGB vaules
#    lw = lineweight = make as wide as the axes lines
set style line 100 lt 1 lc rgb "#999999" lw 1   # MAJOR grid lines format
set style line 101 lt 0 lc rgb "#666666" lw 1   # MINOR grid lines format
# Put the grid behind anything drawn and use the linestyle 81
set grid back xtics mxtics ytics ls 100, ls 101    # "xtics" = major X gridlines; "mxtics" = minor X gridlines, etc

#  X-axis setting
set xdata time
set timefmt "%Y-%m-%d %H:%M:%S"
set format x "%Y-%m-%d\n%H:%M"
set xlabel 'Time [UTC]'
set xrange ["2015-06-09 00:00:00":]

#  Y-axis settings
#set yrange [10:13]
set ytics 2.0
set ylabel 'Air Pressure [hPa]'

# Each line in data files holds many values - define field separator
set datafile separator ","

# Text label
#set label 'Lighr red: Offset adjusted -3.5 hPa' at screen 0.2, 0.3 center rotate by 45 front
set label 'Offset -3.5 hPa' at screen 0.1, 0.75 left 


plot 'pressuresensor-BM180-test-11June2015.txt' using 2:3 title 'Bosch BMP180 Pressure Sensor' with lines linecolor rgb "#FF0000",\
     'pressuresensor-BM180-test-11June2015.txt' using 2:($3-3.5) title 'Bosch BMP180, offset adjusted -3.5 hPa'\
         with lines lc rgb "#FF8888",\
     'Geofysen-trykkdata.txt' using 1:2 title 'Reference sensor, Aanderaa Air Pressure Sensor model 2018'\
         with lines lc rgb "#0000FF" linewidth 1.5

5.2 Testing current/voltage monitoring chip, May 2015

We purchased current/voltage sensor with I2C interface - Adafruit current/voltage monitor - with future Jan Mayen upgrades in mind: Many such sensors can be combined on the same serial (I2C) bus, making it possible to monitor current/voltage on several places within any new prototype Jan Mayen power system - by e.g. logging current from wind generator and solar panel, battery charge/discharge current and also voltages.

We tested the new sensor by obtaining discharge characteristics of a typical Seismo lab battery, manufactured by Yuasa, with model designation RE7-12 (12V/7Ah). Prior to testing, the battery was fully charged, using Nordic Power model SBC-8168 charger; during charging process the charger didn't indicate anything wrong (it has a "repair" LED indicator).

Afterwards a constant current circuit acted as a battery load; with current set by resistors and a LM317 regulator IC. The sensor was attached to Arduino board where a program collected sensor data, halting further discharge of the battery when the terminal voltage reached the recommended lower limit (10.5 V). The Arduino transmitted serial data to a laptop where a tiny Python scripts did time stamping and file storage.

Yuasa rechargeable battery model RE7-12.

Yuasa rechargeable battery model RE7-12.

5.2.1 Test results

Conclusion: Capacity was 2.1Ah - only 30% of the rated 7Ah.

The battery is old - from May 1999 - so perhaps we shouldn't expect anything else. So lead batteries requires some attention.

Lead battery capacity test. Discharge curve shows both terminal voltage and accumulated charge [Ah]. Constant current load is 0.05C, where C is capacity, in this case 350 mA since it's a 7Ah battery.

Discharge characteristics for Yuasa NP-series lead acid battery. Probably quite similar to corresponding RE-series. Source: NP_7_12_DataSheet.pdf

Test should be repeated with controlled charging first - we are now dependent on battery charger - we have neither knowledge nor control over charging characteristics. What, for instance, determines when charging stops? We should consider acquiring a battery charger recommended by Yuasa, described here.

5.2.2 Test configuration

Click to enlarge.

Battery discharge test setup. Click to enlarge.

Click to enlarge.

Battery discharge test setup. Constant current load, consisting of LM317 regulator and resistors, in upper left section. Click to enlarge.

5.3 DNT 900 radio modul

Another telemetry module tailored for RPi, based on DNT900, can be evaluated on the next occasion:


DNT900 radio telemetry boards:

DNT900 radio telemetry boards:

("Pi 900 Mini telemetry radio" - check - another candidate: Manufacturer: Cosworth )

5.3.1 DNT900DK = "Development Kit"

1) Opinions regarding this matter varies a lot.

Edit - History - Print - Search
Page last modified on November 21, 2016, at 11:02 AM
Electronics workshop
Department of Earth Science - University of Bergen