Category Archives: Orienteering

Hur man uppdaterar batteristatus i en SI-enhet efter batteribyte

This post is in Swedish, but the same information is available in English on the last page of this PDF from Sportident.

Om man har bytt batteri i en Sportident-enhet så är det en bra idé att tala om för enheten att det nu sitter ett nytt batteri med full kapacitet i enheten så att den kan försöka hålla reda på hur mycket kapacitet som återstår. Som bekant så använder man programmet  SPORTident Config+ för att programmera SI-enheter, ställa tiden, uppdatera firmware mm, men tyvärr så kan man i vanliga fall inte komma åt funktionen för att ställa om batteristatusen. Kanske anser Sportident att funktionen är för riskabel att ha allmänt tillgänglig, men det går ganska lätt att slå på den. Så här gör man:

Högerklicka på genvägen till SPORTident Confg+ på skrivbordet. Då dyker en meny upp som ser ut något i stil med detta:

Menyn som kommer upp vid högerklick på Config+ikonen.

Välj alternativet “Egenskaper” längst ned. Nu dyker följande fönster upp:

Dialogrutan med egenskaper för genvägen.

Tricket man behöver göra är att lägga till texten −−service sist i rutan “Mål:”. Enklast görs detta på följande vis:

  • Tryck på pil höger så att den blåmarkerade texten avmarkeras och markören hamnar sist i rutan.
  • Tryck mellanslag.
  • Skriv in −−service (dvs två minustecken och sedan ordet service utan några mellanslag). Så här bör det se ut:
Flaggan −−service har lagts till.
  • Tryck OK för att stänga rutan.

Om man nu startar SPORTident Config+ från den ändrade genvägen så finns plötsligt den nya menyn Service högst upp:

Service-menyn har dykt upp.

Om man väljer alternativet “New device battery” så får man upp följande:

Fönstret för att uppdatera batteristatus

På en BSF8 med vanligt litet batteri (1/2 AA) så är det normalt 1000 mAh man ska mata in och om man precis satt in ett nytt batteri så ska såklart Usage stå på 0%. På en BSM7 (med sladd) med batteri i AA-storlek är det normalt 2000 mAh i batterikapacitet.

Mer information om andra saker att tänka på när man byter batteri finns i följande dokument från SportIdent:

Battery exchange in BSF7 and BSF8 stations

Fixing Sportident Thermal Printer Issues

The youth section of my orienteering club has a Sportident thermal printer connected to an SI station for use on trainings. This has worked fine for a few years, but for some reason it started printing garbage and I was asked to have a look at it.

I had never used the printer before, but I started troubleshooting. The SI station had old firmware, so I updated that using Sportident Config+, but this did not help. At first I did not get the printer to print anything, but that turned out to be because I had failed to realize that the SI logo was actually a hidden power button one has to press briefly to turn the printer on or off. After the printer was powered on, it did indeed print garbage when I tried to print the contents of an SI card.

The printer is a Martel MCP7830-242 printer with a serial port and I was able to find a manual for it. It turns out a customized manual is also available from Sportident. I suspected the problem might be that the printer was set up to use an incorrect baud rate and I first tried to set the SI station in its two possible states, namely 4800 and 38400 bauds, but that did not help. The manuals have instructions on how to change the baud rate on the printer and according to those instructions, one should keep the power button pressed a couple of seconds until the LED starts blinking, then one should press the button four times and wait for the LED to blink four times (this enters the baud setting mode), then press the button six times to select 4800 baud. Unfortunately this did not help and the printer still printed garbage.

I then decided to talk to the printer from a PC and I wrote a small Python script to try to send commands to it at different baud rates. After some fiddling around, the printer started responding, but at the unexpected baud rate of 600 bauds!

The Python code is shown at the end of this post in case someone is interested.

I retried the baud rate setting, but still with the result of getting the printer to accept 600 bauds. A note above the tables in the manual says one should do a single button press to select 19200 bauds, but the table says the button should be pressed five times. This made me try to press the button three instead of six times (4800 comes two steps after 19200 in the table) and after this, the printer started working at 4800! So the correct sequence for setting the baud rate to 4800 is this:

  1. Printer is off
  2. Hold down the button for a few seconds until the LED starts flashing.
  3. Press the button 4 times.
  4. Wait for the LED to flash 4 times.
  5. Press the button 3 times.
  6. Wait for the LED to flash 3 times.
  7. Done!

After I got it all to work I realized that one can check the mode of the printer in the following way:

  1. Printer is off
  2. Hold down the button for two seconds.
  3. The printer prints its status, including the baud rate.

If I had known this from the start I might have solved this much quicker.

Below is the Python code.

#! /usr/bin/python


Rev 0.1, 2016-09-28
Per Magnusson, Axotron,

This code is public domain and comes with absolutely no warranty. Enjoy!

Send some data on a serial port to test a Martel/Sportident MCP7830 printer.

from __future__ import print_function
import serial
import sys
import time
import msvcrt
import struct

# Look for a COM port that might have a serial port adapter connected
portfound = False
ports = list(
for p in ports:
    if "Prolific" in p[1]:
        print("Found port on " + p[0])
        if not portfound:
            portname = p[0]
            portfound = True
            print("Using " + portname)
            print("Ignoring this port, using the first one that was found.")

if portfound:
    ser = serial.Serial(portname, 4800, timeout=0.1)
    print("No good serial port found. Exiting.")
    sys.exit("No good serial port found.")

def to_printer(ser, data):
    for b in data:
        print("{:d} ".format(ord(b)), end="")

def send_ESC(ser):
    to_printer(ser, b'\x1b') # 27 == ESC

def send_NULL(ser):
    to_printer(ser, b'x\00')

def set_sweden(ser):
    to_printer(ser, b'R5')

def set_mode_default(ser):
    to_printer(ser, b'!\x00')

def reset_printer(ser):
    to_printer(ser, b'\xff')

def reset_printer2(ser):
    to_printer(ser, b'@')

def printer_self_test(ser):
    to_printer(ser, b'\xfe')

def printer_move_fwd(ser):
    to_printer(ser, b'J\x08')

def printer_print(ser):
    to_printer(ser, b'd\x01')

def print_something(ser):
    to_printer(ser, b'abc\x0d\x0a\x0c')

#to_printer(ser, b'abc\x0d\x0a\x0c')

rates = [300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200]

for rate in rates:
    print('baud: {:d}'.format(rate))


ROC – Radio Online Control

My orienteering club LOK (Linköpings orienteringsklubb) organized two events called Vårspringet during last weekend and I did among other things help with the online controls. In this blog post I describe the ROC, an online control solution based on a Raspberry Pi that we used for the first time.

Old online control solutions

For many years we have used two different kinds of online control solutions. The first one being concentrator boxes (“samlingsboxar”) with four serial port inputs where Sportident master units plug in. Our concentrator boxes have outputs that can drive at least 2 km of DL-1000 two-wire cable which brings the signals to the arena where they are received by special receiver boxes converting the signals back to proper RS232 serial port signals. This solution is obviously only applicable for online controls relatively close to the arena.

The other online control variant we have used are based on old Sony Ericsson mobile phones like M600i or P1i running custom programs (or apps if you will, but programs were not called apps when these were written by club members many years ago). In this solution, the SI master unit is connected to a serial-to-Bluetooth converter and the mobile phone receives the punch information via Bluetooth and sends it over GPRS to a server on the internet. The event administration program OLA polls the server and retrieves the punch information.

Trying something new – ROC

This year we planned on using a couple of the concentrator boxes, but also to retire the mobile phone solution and try out the Raspberry Pi based ROC “Radio Online Control” developed by Oskar and Erik Berg. This is a neat and pragmatic solution that makes use of several pieces of standard hardware and some not-so-standard software to create an online control that communicates via the 3G or 4G mobile phone network. Below is a photo of my setup where I put the hardware inside a metal cookie box dressed with some OSB board to keep things in place.

The ROC hardware built into a metal cookie box.
The ROC hardware built into a metal cookie box.

The hardware consists of a Raspberry Pi, a USB power bank, a USB-to-serial-port converter, an LED with series resistor, a piezoelectric buzzer, a 3G modem with SIM card, a Sportident master station and a number of USB cables. The ROC blog has recommendations on what and where to buy and how to connect things. In my case I had everything except the USB power bank and  the 3G modem with SIM card. I borrowed the USB power bank from a club mate and bought a new 3G modem as described below.

The software is very kindly provided for free as an SD card image one writes to an SD card and inserts into the Raspberry Pi.

Getting it up and running

At first, one connects the ROC to an Ehternet network so that it can be registered on the website. Configuration is done through the same ROC website and I would recommend a fairly detailed read of the ROC manual (only available in Swedish, use Google translate if you need) to figure out what should to be filled out and how. I failed to read the manual and ran into some trouble because of this later; see below.

A number of different 3G modems are supported as shown on the list on the right hand side of the ROC blog. I bought a Huawei E3351 modem in a package with a SIM card good for one month of data traffic through the operator “3” for 50 SEK at Kjell&Co. A pretty good deal I think.

At first I had trouble using the 3G modem and SIM card. The ROC did seem to connect to the server, but no punches got through and the connection seemed intermittent or flaky. I had the ROC connected to a monitor via an HDMI cable and got printouts every second that did not look right.

The ROC manual suggested that the problem might be that the Raspberry Pi could not supply enough current to the modem via its USB port, so I built a custom Y-shaped USB-cable that took current from the power bank while connecting the signals to the RPi. This did not help and I doubt it was necessary.

SIM card issues

I then tried the modem in a laptop and found an SMS on the SIM card that said that the month of data traffic on the SIM card was used up. Weird, since I bought it less than a day ago and the SIM card should be good for a month. I called the support at 3 and after 10 minutes of waiting for my turn, I talked to a support person who informed me that the SIM card had been used starting in October. Maybe someone at Kjell&Co had pulled the card out of its package and used it several months before it was sold to me? Or perhaps not since I think the PIN code was hidden under a scratch-off layer, so maybe it was 3 that had screwed up somehow? Anyway, the support guy seemed to believe my story and gave me a month of data traffic. After this, I still had some more issues and I suspected that my USB-to-serial converter with a Prolific chip was not supported.

The main problem however turned out to be that I had not read the manual carefully and therefore had failed to set up the APN (should be in my case) and PIN codes in the configuration form. Maybe I also had not configured the correct baud rate of the SI unit.

After some more trials and tribulations, I finally got the ROC to connect to the server via 3G, light up the LED, play a jingle on the buzzer and receive punches from the SI master station! Success!

I proceeded to install the hardware into the cookie box, but while doing so I seem to have zapped the IO pin on the RPi needed for the buzzer, so after this, only the LED indicates that it has managed to connect to the server and received the first punch. Fortunately this is good enough.

The web interface of the server shows time-stamped connections and punches from the ROC. This is extremely helpful when troubleshooting or when verifying that the ROC is up and running. One thing I have learned from working with online controls over many years is that diagnostics and verification tools are enormously important (often sorely missing, though) when debugging the problems one encounter. There always seems to be something that does not work right from the start.

Bluetooth adapters

As an extra convenience, I decided to use two Bluetooth-to-serial adapters (previously used for the phone-based online controls) to eliminate the cable between the Sportident station and the ROC. After some digging, I found the CD with configuration software and was able to pair the two units such that they automatically established a serial link of the proper speed (4800 baud in this case) when powered up in range of each other. This link seemed to work reliably for the remainder of the “project”. The adapter on the control side was powered by an old headlamp battery via a cable with built-in voltage regulator I built many years ago for the phone-based online controls. To power the adapter on the ROC side, I soldered together another cable that took 5 V from the USB power bank and connected it to pin 9 of the 9-pin DSUB connector while routing the RS232-signals to the RS232-to-USB adapter. The bluetooth adapters and associated hardware is not shown in the photo at the beginning of the post since they had not been added when the photo was taken.

A couple of days before the first event, the guy responsible for the event administration software OLA set up OLA to receive punches from the ROC while I hooked up the ROC and punched a few times. This did at first not work, but it was quickly discovered that some setting in OLA was incorrect and after fixing that, everything seemed to work fine.

All of the above took maybe two weeks or so of calendar time, so it was good that I started working on the ROC a couple of weeks before the events.

Success, failure and success during the events

During the Saturday event, the ROC worked brilliantly and without any hitches.

During the Sunday event however we experienced some issues that are hard to understand. When I first started the ROC on Sunday morning, it quickly connected to the 3G network and received punches. Perfect, just like  the day before.

But then we decided to set up a new event ID in the ROC configuration interface instead of continuing on the Saturday event ID. (This was most certainly not necessary.) After doing so and restarting the ROC, it did not react to punches, even though the connection to the 3G network was fine. More restarts did not help and neither did bypassing the Bluetooth adapters.

We then went back to the previous event ID in the configuration interface and after a few restarts the ROC started relaying punches again. Phew. Now we were in a hurry to get the ROC out in the woods to the control where it should do its task. Just like the previous day, we let it stay powered on to make things easy for the people installing it in the woods. When they were done, it did unfortunately refuse to relay punches once again, even though it was solidly connected to 3G.

As a final try to get it working, we sent out another guy to replace the SI station in case it had a broken cable or something. This did not help and the guy had to stay in the woods and report in passing competitors manually via SMS. After maybe 15 minutes something odd happened however. Punches started to stream in from the ROC! This continued to work for the rest of the event.

I still have no idea why the ROC worked intermittently during the Sunday event. It looked so good on Saturday and during the limited tests in the week before the events.


I think the ROC is a pretty neat online control solution, not the least because it is so inexpensive. In my case I spent only 50 SEK since I had the rest of the required hardware already. Pretty hard to beat. The time I had to invest was perhaps not quite as short as I would have liked, but this was partly due to my failure to read documentation and partly due to problems with the SIM card caused by the 3G operator or some other external party. Next time I am sure it will be much quicker.

There are some details that could perhaps be better documented and easier to troubleshoot, but for the cost of free it is hard to complain about the software. The instabilities we experienced during Sunday is a bit troubling and I would like to understand what the problem was.

We will most likely use at least one ROC on our events next year.


Here is a random list of things that might not be too clear from reading the manual:

  • If you want to log into the Raspberry Pi via SSH while it runs the ROC software, you can use the user name “pi” and the password you set in the web configuration interface.
  • It is unclear what serial port adapters are supported, but I would guess that most are supported since I could find no complaints or questions regarding this on the ROC blog.
  • Directly connecting Sportident USB masters to the RPi is also supported, although I have not tried this myself.
  • There are other networking options than using 3G in the case where the ROC is in WiFi- or Ethernet range of the finish. See the manual for details.