All posts by Per Magnusson

How to upgrade a secondary disk in Windows

The 1 TB D-drive on my desktop Windows 10 computer was starting to get full, so I bought a new 3 TB drive to replace it with. After some googling, it seemed like the free version of AOMEI partition assistant would be a good program to copy/clone the contents of the old disk onto the new one. I let it run overnight and in the morning it was done. I then removed the old disk and only kept the new one plugged in.

This is where my trouble began. I had intended to just change the drive letter (if necessary) so that the new disk would also have the drive letter D, just like the old disk. This can normally be done by opening Administrative tools/Computer Management/Disk management (Administrationsverktyg/Datorhantering/Diskhantering in Swedish), right clicking on a drive and selecting “Change drive letter”. After doing this, I got an entirely unhelpful error message saying “Incorrect parameter” (Felaktig parameter in Swedish).

After some googling, it seemed like it might work in safe mode (felsäkert läge), so I managed to get the computer into this mode by holding down shift while clicking restart and navigating through the various menus that ensued. This however did not help. Still I got “Incorrect parameter”.

While in safe mode, I tried another tip I read during the googling, namely to make changes to the registry. This turned out to be successful. Here is what I did:

  1. Open the registry editor by pressing Win+R and typing regedit.
  2. Click to HKEY_LOCAL_MACHINE\System\MountedDevices.
  3. Scroll down in the right pane to entries starting with \DosDevices.
  4. Select all the \DosDevices entries and save them (Archive/Export) to a .reg file on the desktop in case things get messed up and have to be restored.
  5. If there is an entry for the drive letter you want to use (\DosDevices\D: in this case), delete it. (Do not delete the entry for C:!)
  6. Change the name of the entry for the new disk so that it becomes \DosDevices\D:
  7. Reboot

After this the new drive with all the contents from the old D:\ showed up as D:\!

I am not sure it was necessary to be in safe mode while doing this, but maybe it was. I now realize that a reason changing drive letters was so complicated might be that I had the swap file pagefile.sys on the drive I wanted to change letters for. Maybe it would have also worked if I had moved the page file to C:\ before trying to change letters for the secondary disk. Or maybe this had nothing to do with the issue.

There are very many posts on the internet about upgrading the system disk C:\ (which should be harder I guess), but it was a bit more difficult to find this information about how to get the upgrade of the secondary disk to work. I hope I will remember that I wrote this the next time I need to upgrade a disk…

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 roc.olresultat.se 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 data.tre.se 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 roc.olresultat.se 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.

Conclusions

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.

Hints

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.

WordPress gives 403 (forbidden) error for a post with “phpmyadmin” in the title

When I try to access a post with “phpmyadmin” in the title on my WordPress site, I get a 403 (forbidden) error. After digging around for a bit, I realized that the issue was in the permalink and that replacing “phpmyadmin” with “phpmyadm” made the post accessible again.

After some more thinking I figured out that the reason was that I had set up a rule in apache\conf\httpd.conf to deny access to phpmyadmin from most IP-addresses. The rule looks like this:

<Files "*phpmyadmin*">
  order deny,allow
  deny from all
  allow from 192.168.0.50
  allow from 127.0.0.1
</Files>

So, this rule inadvertently triggered on the permalink and denied access to the post.

Maybe someone else stumbles upon this problem and is able to google up this explanation and solution.