Thursday 31 January 2013

Resting after a long trek

Wow, yesterday really took it out of me. I was getting cramp in my feet and legs last night. When I woke up in the morning, I was feeling a lot better, but still a bit broken. So I was taking it a bit easy today.

I did a bit more on the Robotic Arm Two. Where I'd left it, using the relay box over the RS 232 serial port (converted from USB) was crashing the Pi pretty often; maybe one time in a couple of hundred, and that's not reliable enough even for a thing like this. So I decided to change from using the RS 232 relay box, to a relay box that uses USB directly.

I wired up the eight relays so that each robot arm motor could go forward or back, and connected everything up, being careful to connect the relay box to the twelve volt line. Which, of course, is completely wrong, those servos want 5 or 6 volts. I was lucky that I didn't blow any of the motors. Then I connected it up correctly, and it worked. Sort of.

The problem was, switching the motor on and then immediately off, was leaving the motor on for a variable length of time of between 1/10 and 1 second. That's completely useless, of course. And I couldn't see what was causing this variable lag. I tried this, I tried that, and eventually I tried running as root, and for a reason I don't understand, that gave me the desired effect; switching on and immediately off gives a short and pretty stable pulse of electricity which moves the arm a short enough distance for it to be controllable. So I sorted something out using sudo (not a command I'm used to using, when I want to be root, I'm root).

Also, I decided that having to make 20 keystrokes to get the full coords, would start to get tedious. So I've decided to show a few of the numbers after each keystroke.

Also, I've sorted out the problem with the watchdog and I've now got that fully enabled.

Wednesday 30 January 2013

Gypsum Gyratory part two

A two hour drive (several minutes of which was spent sitting in the traffic jam that led to the M25) took me to my starting point at 11:10. At about 18:45, I'd done about 40 caches, and was totally wiped out, plus my back hurt, plus my feet hurt (one of my boots pretty much broke, and that pair of boots is getting the chop), so I decided to cut short and get back to the car. I got there at 19:15, and collapsed into the driving seat. I had lunch (!) and then made the two hour journey home.

The main problem was mud. Mud. mud and more mud, I took quite a lot of it home with me, but I left plenty for then next cacher. It wasn't just the mud, it was the squishy terrain underfoot, which made walking a lot more difficult. And I lost count of the number of times I nearly slipped over. Going uphill was bad, going downhill was worse, but even level terrain could be difficult, as a lot of it was so churned up.

At about 3pm, I got to the village that had a pub, but I was so muddy, I didn't even try to go in. I had my head torch with me, otherwise I'd have been groping in the dark after about 5pm.

One the way round, I did two great caches, one involving water, which I wouldn't have been able to do but for the fact that I carry, as standard equipment, and medium-sized polythene bag.

And I saw my first snowdrop of the year.

Weight report 36

15 stone 4 1/2 pounds

Tuesday 29 January 2013

Pi power again

Today I was going to wire up the relay box so that the Pies could be automatically rebooted if they crashed. Fortuitously, the LM2596 power step down modules arrived today, and they're beautiful! So I used two of those.

They're £3 each, which is really cheap, and they not only step down any voltage (in my case, 12 volts from a PC power supply) to any voltage (you adjust it using the little brass screw, I'm using 5.3 volts); they also have an onboard voltmeter that tells you the input or the output voltage, and they have screw terminals to make connecting them up easy. I'm using two of them now, each one connected to a four-way USB hub, with up to four Pies on the hub. Power from the hub goes via the relay box (I cut the red wire on each of the cables that power the Pies, and connected the ends to the terminals of the relay box), which is set to "Normally Closed", so that when the box is first powered up, all the Pies will be given power.

And the power will be very high quality - I have a UPS that's giving the PC power supply a steady feed, the PC power supply does a lot of smoothing and regulating to give the 12 volts to the LM2596, and the LM2596 is also regulating the output. The onboard voltmeter says 5.3 volts, and I put a multimeter on it, and it really is exactly what it says. Unlike the power supplies that you just plug into the wall.

To connect the LM2596 to the power supply, I needed a Molex connector with two wires on the 12 volt line and neutral. Rather than solder this up, I dived into my box-o-bits and came up with a couple of 8cm fans which had died. I'm a bit of a never-throw-anything-away-that-might-one-day-be-useful fan. I cut the cable off the dead fans, threw away the fans (!) and there's my cable, ready-made.

The relay box is connected via a serial port to a "watchdog" tower computer, and on that tower I've written a graphical user interface for switching the Pies off or on, and a progam to check the Pies once per minute, and if one of them isn't responding, to cycle the power to that one.

So when a Pi crashes in future, it'll be rebooted without me having to do anything, and I'll get an email from the watchdog to tell me it happened.

Also, an HDMI-to-VGA cable arrived today, and it works fine between a Pi and an ancient CRT (cathode ray tube, they're big and heavy, totally obsolete, but I have a few and am I supposed to throw away a working monitor?). I have the Pi set for 720p, which I think equates to about 1280 by 960 pixels, which is all I'd expect from that monitor.

Tomorrow I'm planning to do the second part of the Gypsum Gyratory - 50 caches in about 11 miles with lots and lots of contour lines to cross, and plenty of mud around. I'll be knackered by the time I finish!

Monday 28 January 2013

I've been working on the railway ... and the arm ... and the Pies

 ... because the locomotive kept derailing. I thought, maybe its wheels aren't properly aligned, so I went to Ebay, and discovered that Hornby OO locomotives tend to be a bit expensive! But I found a nice 0-4-0 for £20, and I thought, hey with only four wheels, it's less likely to derail, so I ordered it.

It arrived swiftly, and I tried it out. Right gauge, right voltage. But the loco was too light, and not really strong enough to pull the two passenger cars. I think it's meant to be more of a shunting engine. When I coupled it up, the wheels would spin, and sometimes it was able to get the train going, but sometimes it wasn't. And that's not good for a fully automated railway.

Then I had a flash of inspiratipn - double-header! I coupled the new loco to the passenger cars, then put the original (much larger and heavier) engine in front. It's too soon to say, but this might have done the trick. The load is now being shared between the two engines, and I think that's made them less likely to derail.

On to the Robotic Arm Two. I've got all the software working now, and the cams, and the arm. You can move the arm around, and reach out and type on the keyboard, and I can detect which key you typed. I have a red LED that comes on when you hit the right key, and that's visible in the webcam. So then you swivel the cam around, using servos, to look at the monitor (I've worked out how to squirt a display to the three inch PAL monitor), and up comes the next part of the coords for the cache. That stays displayed for a minute, then you get the clue to tell you what to type next. Swivel back to look at the arm and keyboard, and you can operate the arm to type the next letter. And so on.

The problem is, it's flaky, in two ways. The small way, is that I'm relying on timing to position the arm, which is not a fine control. The big way, is that the USB-to-serial converter, which I'd thought was stable (at least it doesn't crash every time you use it), still occasionally hangs the computer, and when that happens, the last command that went to the arm, stays in place, which means that the electric motors try to drive the arm into an impossible position, and the clutches go "CLACK CLACK CLACK" as they try to break themselves. I've ordered another USB relay box, and I'll use that instead. On the railway, it's been working like a champion.

On the other Pies I'm using, I'm getting the occasional Pi crashing. I don't know how to make that happen less often. I'd estimate that it's happening maybe once per week, over the total of several Pies, so that's about once every couple of Pi-months, not too bad, but it means it can't be trusted to run unattended.

Here's my proposed solution. I'll have a computer that watches all the Pies, and if one of them stops responding, the watchdog computer will cycle power to that Pi. I'll use a relay box to do that. So the power setup will be this:

PC power supply, giving a couple of hundred watts. The 12 volt line of that feeds to a one of the devices that translates 12 volts to five. They can handle 2 to 3 amps, so I'll use two of them.

Each of those will feed a USB hub. A cable will run from each port of the USB hub, to the micro-USB connector of the Pi. So that'll give them all power.

These USB cables have four conductors inside; black, red, green and white. Green and white are data, and are irrelevant for powering the Pi. I've cut the red conductor, and soldered wires to each side of the cut. Those two wires will go to the relay box, connected to the NC (normally closed) terminals. So when everything is started up, power goes to the Pies.

If the watchdog timer finds that it cant get a response from the Pi, and a minute goes by with that problem persisting, then it will cut power to that Pi, wait a few seconds, then restore power. It'll wait a couple of minutes before resuming checking the Pi, to give it time to boot up. And it will email me to tell me about the problem.

It's nice that I'm only switching five volts. I could, in theory, do the same thing with my big computers, but then I'd be switching 250 volts and at least a few amps, and that's do-able, but, well I've never actually even felt a five volt shock, but I've hit myself with 240 volts a few times, and it's not pleasant. And, potentially, lethal. Whereas five volts will never even tickle.

Sunday 27 January 2013

iTuned out by Apple

I've been using iTunes to keep my iPhone up to date - loading new GPX files onto it. Today, when I tried to do what I've done so many times before, iTunes said that it couldn't run., "iTunes has encountered a problem and needs to close", offered to send a report to Apple, and gracefully exited. Huh. It's never done that before. I tried it a few times, same result (and Apple have several bug reports from me now). I tried de-installing and reinstalling, same result. And ... there seems to be no other way to get my files onto my iPhone.  There's a method that involves using Dropbox, but I tried that and it didn't work. Maybe the files did get to the iPhone, but Memory Map wuldn't open them. Why? How do I know? Apple work so hard to hide the technical details from you, it's almost impossible to fix it when it goes wrong. There's supposed to be a method that involves me emailing myself, but I can't believe that, can you?

So I decided that the XP box I use for this is probably  past its sell-by date anyway. I always tell people that with Windows, the buildup of cruft is such that you have to wipe the disk and reinstall Windows and everything else every year or so. But I decided that, instead of doing that, I'll use the Wondows 7 box that I got for playing Civilization on. And after I wrestled iShop into giving me the 64 bit version (it kept giving me the 32 bit version, which won't work on the new system) I eventually got it to work.

Roll on iTunes for Linux, I say.

Caching again!

Now that the snow has melted (well it has around here), I was able to go out again. I went to London, because A) it's Sunday, and I don't like going to London on any other day and B) I'm guessing that the ground is extremely soggy, so I wanted to be on tarmac.

My main objective was the "Lost river Fleet" series, following the Fleet from its source on Hampstead Heath, down to the Thames. I'd already done a few of them, and I was hoping to complete it.

First I did the two on the Heath; I parked nearby and biked around the Heath, picking up the two that were there. Then back in the car, I did a few more on the way to Kings Cross, where I parked, and estabished a base.
I got the bike out, extra batteries in the panniers, a head torch, and off I went. Along the route following the Fleet, I picked up several others. But when I got to the end, I was still missing two letters, so I didn't try for the bonus. But I think I know where it is, so I'll try some other time.

Then, as I was already on the bank of the Thames, I did a virtual that was about a mile away. I had to find an unusual tree. I was looking for a very twisted oak, or something like that - what I found was this!

Also on the bank of the Thames, I saw HMS Belfast.

Coming back over the river, I crossed via Tower Bridge, always a treat. Then a couple of virtuals, then a few trads and solved puzzles. I also tried to complete "Alien Invasion", but I couldn't, alas.

I got back to the car after dark, about 6:30, had lunch and trundled off home. A very good day out, 39 caches done and no DNFs.

Friday 25 January 2013

The Railway stands alone

Up till now, I've had to use a second computer to talk to the relay box that controls the railway, because the USB - RS232 converters I had crashed the Raspberry Pi. Today, I put the new USB relay card on the job. So now I don't need the second computer. One lonely Pi runs the web site, and the webcam that you see the railway with, and it also talks to the relay board over USB, and that controls the power and switches the train on and off.

Next, I need to move the other functions done by that second computer (email stuff and some email processing) on to the PI (which I've mostly done already) and I can power the tower off permanently.


A USB to PS/2 keyboard converter arrived today. Up till now, I've been using flimsy USB keyboards for the Pies, with no real feel to them. What I really like, are the old IBM model M keyboards that are big and heavy, and make a very satisfying click when you type on them. You can get them now for around £50 (compared to £5 for a cheap plastic keyboard that I'm not enjoying typing on).

A few years back, I bought half a dozen genuine IBM "buckling spring" keyboards, because I didn't ever want to be without one. And now I want to use one of them with a Raspberry Pi.

So when the converter arrived, I opened up the packaging, and saw that the USB connector was big and fat and wouldn't fit on the Pi, not if I also wanted a mouse. However, a USB extension cable soon sorted that out, and now I can type on a model M on the Raspberry Pi.

Thursday 24 January 2013

Dropbox on the Pi

The Pi that I gave 12 volts to, looks like it isn't going to recover. Oh well. It's just as well they're so cheap! But then I got to thinking, I wonder if it really was 12 volts? So I put the multimeter on it, and blow my fuses, it was 17 volts. So I did a bit more thinking, and then I measured the voltage of all the various power supply things I've got, and made labels up to label them properly. I've always assumed that five volts means five volts, but it turns out to mean anything from four to seven. That's my asparagus in action - I have a condition that makes me excessively gullible. I believe labels on power supplies, for example, and it had never occurred to me before that they could be wrong.

Most of the rest of the day was spent getting Dropbox working on the Raspberry Pi. You can't just install it as you would on an Intel box - I tried. I got quite far, and then when I tried to download the daemon, I got "Platform not supported". I guess this means no ARM version.

So I can see two ways to do this. The first way would be to put Dropbox on an Intel machine, and use mirror or scp to synchronise the files to that. But that means I'm using a tower for this, plus in my experience a system that depends on two computers to cooperate is always less reliable and more hassle that something that stands along. And what would happen if I decided to change that tower to a Pi?

There's a better way. It's a shell script that uses curl. You can upload, download, list and delete, and I used that, and it works fine. To do that, I have to create a Drobox App, and that would have been easy, except that Dropbox wanted to send me an email and I'd click on a link in the email. I guess that's no big deal for most people, but I don't use a web-based email reader, I take my email as plain text. I can still click on links in emails ... but my email reader is behind a firewall that doesn't allow that unless I open up the firewall just for that ... you can see how this goes. So I told Dropbox that I have a new email address, using gmail (then I can just click on the link), but Dropbox, quite rightly, needed some confirmation that my email address is changed ...

And thus it was that I found a small security hole in Dropbox.

If you're logged in (or find someone else's account logged in), you can change your email address, and all that Dropbox does, is send an email to the old email address to tell them so. And from then on, the Dropbox account is tied to the new email address, and with that, you can change the password. Still, I can't imagine that anyone keeps anything important or of value in what people are calling "the cloud", but which should more accurately be called "someone else's computer".

Anyway, eventually I made Dropbox happy, and the shell script works fine.

I've also started on checking the seven servers I brought back from Cheltenham. I've already found a gigabyte of memory that's faulty, and one 2tb hard drive that will be going back for warranty replacement.

... and USB switching!

I got a USB relay board; 8 relays on the board for £19.99, which looks to me to be a pretty good price. But when it arrived, it came with no documentation. Zero. Not even an invoice! So I went back to the Ebay page, and downloaded the zip file I found there. But that's for Windows, and I want to use it on a Linux Raspberry Pi. So I emailed the vendor, who informed me that it said clearly on the page that it was for VB (Visual Basic) only (I can't see that on the page). And he gave me a URL that he thought might help.

But by then, I'd done a bit of googling, and I found a page that looked relevant. The picture was pretty much what I had, and he had a download on offer. I downloaded, unzipped, did apt-get install compiled his C program and looked at what I had. "hidwrite 0x12bf 0xff03 85" did nothing. Huh.

So I ran lsusb, and the Pi wasn't seeing the device.

So I changed the power supply (in my experience, admittedly only a month or so, nearly all Pi problems turn out to be power). And lsusb showed Bus 001 Device 008: ID 12bf:ff03 which is exactly what I was looking for. So I ran hidwrite again, and this time, I heard the relays clicking, I saw the LEDs light up to show which ones were on, and a multimeter confirmed that it was all worked.


Wednesday 23 January 2013

We have switching!

Yes - one of my purchases worked. This gives me USB-to-serial, without crashing the Raspberry Pi. As a bonus, I get *two* serial lines.

So I've got it running off the Geocaching Robot Arm, and it controls the relay box that switches light and power on and off. The same relay box also controls power and light on the forthcoming Geocaching Robot Arm Two (which was a bit delayed when the circuit board controlling it stopped working, but I'll be able to get round that by using another relay box).

Since there's a second serial port going begging, I'm using that to communicate with the relay box that will be operating the Geocaching Robot Arm Two.

Which leaves the Dr Solomon's Railway still being switched by a Tower PC. It's too far to use the Robot Arm switching Box to switch that; ladysolly wouldn't appreciate me running lines all over the house for everyone to trip over. So I've ordered a couple more of the USB-to-serial thingies that I know know works; one for the Railway, and another one just on general principles that I'm sure to find a use for it. I have a few more relay boxes unused, left over from a previous project.

So next I'm going to have a look at the USB relay board I just got. It comes without doumentation, and the software you get when you download the Zip file is for Windows, but I'm somewhat hopeful.

Up to Cheltenham, and a dead Pi

Today I went out, but not caching. I went to Cheltenham, where I have a bunch of computers. The way I work them, is I have some that are customer facing, two that do backups of those, and serveral that are powered off; they're spares. I replaced one of the backup computers, and six of the spares. It went very well, the only problems were, one of the computers didn't power up (it turned out I'd flicked the power switch to off, quickly fixed) and one wasn't working when I got home, but I made a quick call to Safehosts and they had a look, and noticed that the ethernet cable had come loose, so that was also a very quick fix.

Along the way, I had a good look at the fields. All covered in snow, I don't fancy caching until this thaws a bit.

A few slight modifications to the Pi that I'm using as a terminal server. I changed it from having two desktops to having six, I changed the background to something a lot softer on the eye than a gigantic raspberry and I changed the ssh configuration so that it wouldn't take so long to connect to other servers.

GSSAPIAuthentication no

Unless I do this, it tries to use  GSSAPI Authentication and until that times out, it doesn't go on to the method that I (and I think a lot of other people) use.

I'm really happy with using a Pi this way; I have another terminal server down in the garage (also doubling as my internal DNS server). I'll change that to a Pi also.

While I was out, several parcels arrived. So I got the Pi I'd tried to use as a data server (it was too slow) and powered it up to try out the USB-to-serial thing that arrived, the one that (I hope) won't cause the Pi to hang. Immediately, there was a smell of buring, so I unplugged and looked at why. Oops. I'd set the power supply to 12 volts (for the relay box) and it was still set to 12 volts. I can now tell you that Raspberry Pis don't like 12 volts. It might be permanently dead, but I'll leave it some hours, maybe the fuse protected it. Oh well. Worst case, I've blown up a £21 computer. Ladysolly dropped her mini Ipad a few days ago, and that's going to cost ten times as much. But lesson learned - if I use a PSU at 12 volts, then I won't leave it set to 12, I'll put it back to 5 after use.

Weight report 35

15 stone 4 pounds

Tuesday 22 January 2013

Disaster on Robot Arm Two - and recovery

I was getting Robot Arm Two set up, and then the controller stopped responding to my commands over the USB port. So I connected it to a Windows machine and ran the software that came with it - no response. I'm thinking, something has happened to the hardware that translates the USB commands to motor movements. Or, to put it another way, Robot Arm Two is dead.

My first thought (after a few curses) was, maybe I could make a claim under guarantee? But this was a Christmas present from someone,so I don't have a receipt, and I'm thinking she won't either, and anyway it'll be a big hassle. So maybe I could buy a replacement controller board for it? That surely would only be a few pounds. But where would I get it? I doubt if Maplin would have spare parts for this.

And then I had an inspiration. These aren't servos or stepper motors, they're just plain old electric motors, working via a gearbox. All I need to do is switch power on and off, and I can do that with relays.

And then I thought, hmm, it isn't just on and off, I need to run them forwards and backwards, so I need to be able to reverse the polarity. That doesn't sound too difficult, though.

So I got an old envelope, and drew a rather simple circuit in the back. It uses two relays for each motor, so I can go forward or back. The motors want three volts, the relay box wants twelve, but I can do that with a couple of power supplies. There's eight relays on the relay box, which is enough to control four motors (two relays per motor, one for forward, one for back).

To work! I cut eight of the wires leading to the arm's controller board, connected some standard ethernet cable (they have eight cores, just right) to them, wired up the relay box, connected the Arm to it, gave the relay box power, gave the relays power, and connected the relay box's serial port to a computer. And with the usual software I use (minicom) I could talk to the relay box, and switch the relays. And the arm went up, and the arm went down, and I'm a very happy bunny.

So now all I need to do is modify the software I had written to control the arm over the internet (and that'll be a very easy thing to do, I've done it before this way).

One problem, though. I haven't yet gotten a Raspberry Pi to use a serial port without crashing. I've already ordered a couple of things that might do the trick, but meanwhile, I'll get this working using a tower PC.

Monday 21 January 2013

Substantial progress today

Yesterday, it was two steps forward, two steps back. But today was good.

I set up two Pies as servers, only to find that the Pies were too slow to handle what they needed to do. I think it was the CPU speed that was the problem.

So then I tried to change the "Dr Solomon's Railway" to run on a Pi. That worked OK, until I ran into a problem I've had before. The relays that switch things on and off, are controlled via a serial link. The Pi doesn't have a serial port, so I tried to use a USB-to-serial converter. I have two different types of them, and both of them tend to crash the Pi when used. I tried to get RS 232 from the GPIO pins, amd I sort-of half got it (I was able to see things that I typed on the Pi, come up on another computer) but I couldn't control the relay box that way. After wasting several hours trying to make something work, I gave up, and the serial link is now being controlled by a tower computer, which kind of misses the whole point of moving to a PI.

I haven't given up, though. I looked at the list of "What works with a Pi" and I've ordered a couple more USB-to-serial links, and also a relay box that can be controlled via USB. Surely one of those will work!

Today, I had a lot more success. First, a heavy parcel arrived - it was the four batteries I ordered to re-battery a UPS. That was a fairly easy task, and now I have a good-as-new 2200VA UPS that (unlike the APC Smart-UPSes that I have) aren't too heavy to lift.

Next, I set up Ann's Pi. Ann is a total Luddite, and all she does is use it like a typewriter.  There were two challenges here - first, (unlike all the servers) she needs a monitor. I didn't want to fork out £100 for a new HDMI-capable monitor, so I got a £10 HDMI-VGA converter. At first, I couldn't make it work, but I did a bit of Googling, and changed the config.txt on the Pi to read hdmi_safe=1. That worked! Then it just took a bit of experimentation to see what was the best mode and what overscan was needed.

The second big challenge, was to make it work with the printer, a Brother laser printer. First, I installed CUPS. Then I discovered that, although CUPS knows about a hundred or more Brother printers, it didn't know about this one. I found a driver for it, but I couldn't install it because the driver expected to run on i386, and the Pi is ARM. Eventually, I gave up looking for a driver, and lied to CUPS about what sort of printer it was, and that got it working. The key was to tell it that it was an HP Laserjet clone.

And then I discovered that the Pi doesn't come with a word processor. After a bit of research, I installed focuswriter and abiword. Abiword is very sluggish, so I decided on focuswriter, although it has a very unusual habit of not showing you its button bar and menus unless you mouse to the top of the page, and then they suddenly appear. And I couldn't see a way to tell it to leave them there permanently. Never mind - it looks like a typewriter, so I think she'll be happy.

Since I now know that the VGI-HDMI adaptor works, I ordered three more; about £6 each. I also got three more of the little voltage step-down boards, and half a dozen more of the £2 USB hubs that I'm using as USB hubs and for powering Pies.

Yesterday, I ordered six more Pies from RS-online. Today, I got an email saying that they've been shipped! I wasn't expecting that - previously, there's been a delay of a few weeks, which is why I ordered them now even though I don't need them yet. I guess they've sorted out the production. Or possibly when RS say "shipped" they mean "not shipped yet". I think they're telling the truth, though, they gave me a Parcelforce tracking number. I'll find out tomorrow.

Saturday 19 January 2013

Not much today

Not much happened today. The snow precludes caching.

I bumped into the limitations of the Raspberry Pi today, twice. Once was in moving a forum that uses Yabb from the server it was on, to a Pi. Immediately, it was running like treacle. Yabb is a notorious resource hog. It doesn't use a database, it keeps everything in directories of tens of thousands of little files - not a great idea. After going to the trouble of setting it up, I had to move it back.

The other failure was a database server; again I tried moving it from a conventional computer to a Pi. Again, it ran very very slowly, and here, I think, the problem is that I'm using an encrypted file system, which means that every time I copy a file, it has to go through the encryption process, which uses a lot of CPU. For the data storage device, I used a 2 1/2 inch IDE drive (an old IBM one) and those aren't very quick either. So again, I had to scrap the idea, and go back to the ordinary computer.

Next, I had a look at one of the APC Smart-UPSes like the one I successfully re-batteried. This one still had the old batteries in, and I've learned something. If a UPS needs new batteries, take out the old ones as soon as possible. If you leave them in place, they swell up and you have to use a hammer and crowbar to get them out. I got them out eventually, and I now have a pile of scrap lead for sale.

I'm still dead keen on the Pi - so much so that I went to RS-Online again today and ordered six more. I don't actually know what I'll use them for. Yet.

Friday 18 January 2013

Power for the Pies

Getting good power for a Raspberry Pi is, I believe, the key to successful Piery. Here's my latest effort.

Bottom left, you see a couple of Molex plugs; they came from an old case fan that's no longer working, but the wires come in handy. That's the sort of connector that plugs into a PC power supply, and I've connected up the 12 volts line. You'll see on the right, that is connected to a little PCB. The heart of that PCB is an LM2596, the chip that converts DC voltage from anything down to anything a bit less. So here, I'll be asking it to convert 12 volts to 5. But if you look carefully at the PCB, you can see towards the front, a blue thing. That's a variable resistor, and by twiddling the tiny brass screw on the right of it, I can adjust the output voltage to anything I like from zero up to a couple of volts below the input. So, it the Pi wants a tiddly bit more than 5 volts, I can arrange that. The LM2596 board costs a couple of pounds.

From the LM2596, you can see two wires that go to a USB hub. This hub is sold as an unpowered hub, but actually, the only difference between a powered hub and an unpowered hub, is whether you give it power that doesn't come from being plugged into a computer. So I'm feeding 5 volts into the "unpowered" hub (which cost a couple of pounds), and the USB connector that's on the white wire, plugs into the Pi. That does two things - it give the Pi the power it needs, and it also means I can plug four more power-hungry devices into the hub without the Pi feeling starved of power.

I can also use the four outlets of that hub, to power more Pies. The LM2596 can handle two amps, so it should be able to power four Pies.

The power that feeds all this, comes from a PC power supply. They cost about £7 for a cheapo (and I don't see why you'd need anything better), but I'm getting them for free, because there's something that happens to PC power supplies after a long time - they become weak and feeble, and unable to deliver enough power for a PC. But they'll give more than enough for a Pi, and if the voltage they supply is less than 12 volts, it doesn't matter because the LM2596 takes care of that.

I think this is even better, and cheaper, than the Hobbycraft thing I've been using. So I've ordered three more; these are the de-luxe version, with an LED display that shows how many volts they're outputting.. And they cost £3 each.

UPS rebuilt

I ordered 8 batteries for the APC Smart-UPS from UPS Trader on Ebay, cost £95 (a new UPS would be three or four hundred). They arrived the next day! So I removed the old batteries from one of my dead UPSes (it was quite a battle, they'd swollen up and stuck fast, and needed to be levered out with a makeshift crowbar) and put in the new ones (very easy). I applied power, and bingo! I now have another working APC Smart-UPS!


I've got a couple more that I could re-battery. I hadn't realised it was that easy.

Also, a Wifi repeater arrived. I think it was easy to set up - I'm not sure. I wrestled with it for quite a while, but I think it was working all along. Anyway, the wifi coldspot in our lounge is now a hotspot.

The snow is a few inches deep. No caching until it clears! Last time I went out caching in the snow I got *really* lucky and found 56 out of 56 caches in a circuit, but it was hard work - I was breaking trail in fresh snow the whole time.

Going upstairs

Several years ago, I had some problem with my left knee - at unexpected moments, it would emit a stab of pain, and refuse to do what I asked of it - this usually happened when I was using it to step up, for example, on a stile, or on stairs.

My response was to favour it; I'd lead with my right knee going over stiles, and I'd go upstairs one stair at a time.

But the knee has been fine for quite a while now. I don't know exactly how long, because the pain was only occasional, and I'd learned to avoid it anyhow.

Another important thing is, I've lost nearly 50 pounds in weight.

So, in the last few weeks, I've noticed that, impatient with going upstairs one step at a time, I've been going up two at a time, which is how I always (except when carrying something) used to go upstairs.

It's a small thing, but it pleases me immensely.

Wednesday 16 January 2013

After the power cut.

Power was out from 9am (which was as expected) until 11:30 (which was a lot sooner than I was expecting). Just before the power cut, I went round powering down computers that I felt I could live without, and I strung the power wires from the generator to where power was needed, including up in the attic!

As soon as power was cut, I started up the generator (what a noise!) and plugged things in. Several problems soon became apparent.

The biggest problem was that although some of the UPSes were happy to take power from the generator, others weren't. As a rough rule of thumb, the small cheap UPSes were fine, but the big professional ones weren't. I tried putting an isolating transformer between the generator and the UPS, but that didn't help (I hadn't really though it would, but it was easy to try).

So I googled this problem. I think the issue is that the generator (being a cheap petrol 3000 watt thing) makes very dirty power. The power that comes out of your wall, is a nice clean sine wave, smooth and neat, 240 volts plus or minus a couple, and 50 hertz. But what comes out of the generator isn't 240 volts, it's all over the place, the frequency isn't 50 hertz, it's whatever the generator feels like and far from being a nice smooth sine wave, it's jagged and horrible. And the UPSes didn't like that, and kept switching to battery power, staying there for a minute, tasting the generator power and deciding they didn't like it and going back to the battery. Which meant that the batteries were slowly running down.

The solution is this. On the back of an APC Smart-UPS, there's a button marked "sensitivity" and a green LED. By default, they're on high sensitivity, and the LED is bright. Press the button once, and you get medium sensitivity, and a dim LED. Press it again, and you get low sensitivity and the LED isn't lit. And press it a fourth time and you're back to high sensitivity.

I did some experimenting, and medium sensitivity is probably good enough; you can drop down to low if it isn't. I found that the APC UPSes were happy with the generator at medium sensitivity.

The other UPSes that I have, don't seem to have this facility. Well, that means I'll be leaning more towards APC in future.

I've got two APCs in action, and I've got four more dead ones. I'm pretty sure they're only dead because the batteries are duff, so I've ordered a set of batteries (£95, but a whole new UPS would be three or four times as much) and I'll try to revive at least one of them.

The Raspberry Pies were heroes during the outage - they use so little power, I didn't take any of them off the UPSes. That was nice - it meant that four mail servers, two DNS servers and various other stuff carried on regardless. But I did take down my internal nameserver (oops), which meant that I had to remember IP addresses to access things. I've now configured one of the Pies to act as an internal nameserver using bind9. Also, I took down my DHCP server, which meant that computers couldn't join the network with dynamic addresses, and a few of my computers do exactly that. So I've also set a Pi up to be an extra DHCP server, using DNSMasq.

The UPS protecting my main router and firewall was fine, and was happy with the generator power.

When power came back, one of my servers wouldn't start - the problem turned out to be the power supply in the server; a quick and easy fix. Another server made a dreadful noise when it was starting. I tracked that down to a noisy fan, which I've replaced. A couple of others just wanted to be rebooted again before behaving themselves.

So I survived the power outage with no big problems, and I've learned a few things as a result.

Hurrah for PiWi!

They're shutting off our electricity for most of today, so as part of my preparation for this, I made a Wireless Access Point (hotspot) out of a Raspberry Pi, a random USB wifi dongle and this. To power it, I used an old bike battery, which is nominally 24 volts but actually more like 28, and a Hobbycraft UBEC, which takes in any voltage you like (7 to 26, it says) and puts out 5 volts (or 6, you choose).

Then I went in to our lounge to connect it to the house ethernet, only to discover that in our lounge, there's no internet socket. No phone socket either, which A) surprised both ladysolly and I, and B) didn't matter because in the couple of years we've been here, we never noticed the lack.

So I put the PiWi into the cupboard under the stairs, which is also where I keep my house ethernet wiring cabinet, the ADSL routers and the house sound system. And the vacuum cleaner.

This morning, in preparation for the power-off, I shut down the ADSL routers. And a while later, ladysolly started shouting at me. There was a crucial email she needed to send, and her internet wasn't working. That's because our home Wifi works from an ADSL router.

So I powered up the PiWi, and a minute later, she had Wifi internet connection, courtesy of a hastily put-together bodge done yesterday.

I'll be keeping the Piwi after the power-out ends; it's quite useful to have a portable Wifi hotspot. Actually, all I need to keep is the SD card. One of the nice things about the Raspberry Pi is that you can take any Pi and make it into what you want, just by putting the SD card into it.

Weight report 34

15 stone, 5 pounds

Tuesday 15 January 2013

Three computers, one Raspberry

When I built the latest incarnation of my Secure Server, a few years ago, I made it into a back-end, front-end system. The front end faces customers and gathers the important data, and passes it over to the back-end, which stores it. Customers don't have access to the back-end server. Also, the back-end server uses an encrypted file system. So if the back-end server is (god forbid) stolen, the thieves won't have access to the data. And if the front-end server is stolen, thieves get nothing, because the data is on the back-end.

When I built these, I thought, what if one goes down? So I built twins of the back-end and front-end; if a server goes down, I lose at most an hour's data, and I can get the spare into operation in a few minutes. And there's a fifth server, which audits the whole thing, controls the video camera that works like a CCTV, and is (yet another) backup of the data; in this case, it isn't on an encrypted file system, but it is encryped using triple-DES.

All of this was in order to comply with the PCI DSS (Payment Card Industry Data Security Standard). It's all worked very well for the last three years. And I haven't needed to use the spares.

So recently, I had a think. I don't really need the two spare servers to be powered up all the time. It's good that I have them, so I can bring them into action quickly if need be, but I don't need to keep their data up-to-date. Enter the Pi.

One Raspberry Pi, with a 400 gb hard drive (total overkill in size, it only needs about 40 gb, but you can't really get small drives now) is now being used to back up both the front-end and back-end servers (using an encrypted file system), and it's also doing the auditing and, controlling the video annd doing the (yet another) backup.

The main benefit is the reduced power consumption, but there's also the fact that one Pi with no moving parts, is replacing three computers with various moving parts (fans for example) which can now be left in a powered-off state unless needed.

And that's especially true for tomorrow. Because tomorrow, we're having a power cut. I know this because the electricity company told us.

I have a generator, but that can only supply 3000 watts, enough for maybe a dozen computers. However - the Pi uses so little power (2.5 watts) that I can run any number of them without any noticable load.

And ... today, a 64gb USB stick arrived. It's as tiny as you'd expect, but the big surprise to me was the price. £14.

At the risk of repeating something I've probably said before, my first mass storage thing was a 10 mb (that's mb, not gb) hard drive that cost £1000 and was so heavy, by the time I got it home I couldn't feel my fingers.

Connectivity issues

Today, at about 1am, I lost connectivity on my leased line. I know this, because I have a monitor that checks once per minute.

At 3am, Daisy noticed this problem. So they contacted Cable and Wireless, and got them to check the line. C&W said that the line is OK, so the geniuses at Daisy sent me an email to tell me that I've lost connectivity, and could I check the power supply.

Obviously, without connectivity, I didn't get the email.

So when I got up in the morning, there were thousands of messages from my monitor to tell me that I'd lost connectivity. I quickly narrowed it down to something outside my network, so I phoned Daisy to report it.

The person who took my call said that she'd pass it on the the Network Operations Centre, and that I could expect a response within two hours. The call center person didn't notice that there was already a fault report number outstanding (raised by Daisy at 3am). I guess their computer system doesn't do any kind of matching.

Two hours later, I called again. Nothing.

Two more hours later I called again, and this time, the call center put me through to the NOC. There I spoke to a guy who suggested I power-cycle (switch off and on again, a procedure that fixes computer problems more often than you might expect) the router (I should really have thought of trying that myself). I did that, and a minute or two later (it takes a little while for the router to wake up), connectivity was restored.


So I've asked that Daisy reconsider a procedure that calls for an email to be sent to someone who cannot receive emails. And then their procedure is to shelve the whole matter for twelve hours, before taking it up again. I don't know what they'd have done at that pount, but I kind of suspect they'd have just sent me another email. Which wouldn't have got to me either.

I can sort of understand that they wouldn't want to phone me at 3am. But I don't see why they couldn't have phoned me at 9am, or even a bit earlier.

I had a 14 hour outage. And all it needed was for the router to be power-cycled.

I'm committed to Daisy for a year or so longer, but unless they improve their quality of service, I'm not sure that I'll be renewing with them.

Sunday 13 January 2013

Frozen in London

I knew it was going to be cold today, and ladysolly wisely decided to stay indoors. So I put on six layers of clothing, including two sweaters, and went down to London for a trundle on the bike.

I parked just north of Camden - that far out, parking is free on a Sunday, and got ready. I wore an anti-cold pull-down hat under my crash helmet, I was bundled up, and I wore my sheepskin gloves.

And it was still cold.

I biked around, getting as far south as Soho; I wanted to do the London Invasion multi, with all the aliens, But there were a few I couldn't find, and when it got to 3pm, with my toes and nose protesting about being froze, I decided that I'd rather get back to the car while it's still light, and get back home to where it's warm. Another disadvantage of urban caching in the bitter cold, is the frequent need for toilet stops. It turns out that there are a lot more unofficial toilets in London than you might have thought.

Still, I saw a few interesting things.

At first, I thought he'd just curled up for a snooze in a shopping basket, but when I got closer, I realised that this was a newly dead fox.

At Neal's Yard, there's a plaque.

In an alleyway, I found this.

Here's a closer look at the inscription.

Here's the information about him

And on the way back to the car, I saw this:

I always thought they were called "Christians"? But then I Wikipediad them, and it seems they're aiming to convert jews to christianity. Well, good luck to them, I say, but it's been tried before and it didn't work then.

So I got home just as it was getting dark, and now I'm quite toasty warm.

Friday 11 January 2013

East Sussex - the Gypsum Gyratory

Last night, I had a dream - I went out caching and didn't take my head torch. I think this is your basic insecurity dream.

Two loops of 50 caches each, how could anyone say no? Of course, I only did one of them - 12 miles, and I'm now ready for the breaker's yard. I only just managed to stagger back to the car, after 7 hours of walking; by then it was dark (and I did have my head torch). Today I did a total of 55 caches (three extras en route, and a couple of drive-bys after I was done). So lunch happened at 5:30 today. It's all good for the diet. And tomorrow I'll sleep late and take it easy. Ladysolly has already refused to go out this weekend, she says it's to cold for her. She doesn't agree with my theory that there's no such thing as cold, ther's only insufficient clothing.

Along the route, I saw this.

I got really muddy again - some of the tracks were just slippery quagmires.

And when I got home, there was a nice surprise waiting for me - seven Raspberry Pis (six extras that I'd ordered, and one replacement for a DOA). And they also did a credit note for the other one that was broken on arrival (the capacitor wasn't soldered on, or rather it had come loose in transit). They said I could keep that one, so I'll have a go at repairing it.

Geocaching Robotic Arm Two is coming along nicely. I've got all the parts of it working nicely, now I just have to put it all together and test it carefully. I'm hoping that some of my blog readers will help with the testing. I'll tell you more when it's ready!

Wednesday 9 January 2013


I've done Frinton and Clacton - today I went to Harwich. I parked on the outskirts of the town, near a handy convenience, got the bike out and spent the next five hours touring round the town. A fair few DNFs, but also lots of finds, and I pretty much cleared the area.

Then back to Frinton. First I did a multi I'd been wanting to do - I found the first stage quickly, and when I held a strong magnet up to the box, a voice read out the coords of the final! Most unusual. Then I collected a puzzle I'd solved in anticipation of the trip, and just as I replaced the box, the cache owner came up and introduced himself.

I saw this plaque in Harwich.

Then two hours drive home. I think I'll rest tomorrow, and I think these three trips is all the area will take ... until the locals repopulate the cache numbers.

Weight report 33

15 stone 5 pounds. Christmas is over!

Tuesday 8 January 2013

More Clacton

Back to Clacton to finish what I'd started.

First, I trundled round the town on the bike - I'm especially pleased that I got the Captain Brainstorm cache, I've been there twice before and failed.

Then on to Frniton to do a circuit there, around the sea wall. I nearly ran out of time, but I managed to get them all, and the bonus. Abuot 30 caches done today, and some interesting sights ...

I was doing a cache over the road (DNFing, actually) when I spotted this. I had a chat with the guy who perpetrated it; he seemed quite a nice chap.

A cache brought me here. A historically significant spot.

A small Disneyworld.

It was night time when I took this picture. But I wondered, in what way am I supposed to be cautious?
If a low flying model aircraft hits me on the head, what should I have done differently? Duck?

A good day out.

Monday 7 January 2013


It's a two-hour trip to get to Clacton, but I've been caching there before, and I like it there. There's almost no hills, and I'm biking on a hard surface.

So I went out there today. Just outside, I stopped to do the first cache, but I just couldn't find it. So I carried on down to the sea front, parked, and got on my bike.

I did about 30+ caches today, and at one point, I went back to the first cache that I'd failed on (without realising it was that one) and found it immediately. Huh.

Three multis, and I failed on a puzzle that I thought I had solved, but now I don't think so.

On the Robot Arm mark 2 - I can now pretty reliably detect an event from the Pi, and throw an image onto the 3-inch PAL screen. It's not as easy to do that as I'd thought!

Best offer yet!

The president of Syria has offered me two billion dollars!

I'm going to hold out for three.

Sunday 6 January 2013

Playing with the Pi

We'd planned to go out caching today, but ladysolly's back has been playing up, and we decided not to go. So I spent most of the day playing with the Raspberry Pi.

I got the Pi to switch LEDs on and off, and got it to detect that a switch had been switched. All this is moving towards Robot Arm Version Two.

I also found a bunch of LEDs in a drawer, and some other handy electronics stuff that I'd put away "in case it's useful one day".

I've built a webcam tilt-and-pan device. The shell of an old PC power supply is the base, and two of the stepper motors I got as spares will do the movement. I've ordered another Maestro stepper motor controller from Hobbytronics - the same one that I'm using for Robot Arm One. When I got the first Maestro, I wasn't actually sure that I'd be able to make it control the stepper motors; this time, I'm confident that it will work.

I still can't rotate the new Robot Arm. I can move all the other four movements, but not rotation. I tried a Python program in Magpi 3 (the online magazine for Pi People), and that had exactly the same problem. I'm baffled. I know the motors are working, because I can rotate the arm using the Windows program that Maplin supplied. And I know I have the USB protocols right, because I used a protocol sniffer in the Windows program; also, both the articles I've read about this device agree on what I have to send to make it rotate. And yet it doesn't move. Never mind, I've worked out a nice puzzle mission that doesn't involve rotating the arm.

Tomorrow, I'm planning an outing to Clacton. It's quite a way away, but one of the great things about Essex is that it's very flat - no hills to bike up! And I'll be most of the day on tarmac surface, so no squishy mud to bike over. Although I am planning to get into the countryside also, unless the surface is too soggy.

The worst surfaces for biking:

1. Loose mud that adheres to the wheels, jams into the brakes and you can't even wheel the bike, let along ride it. I'll willing to take the bike a couple of miles the long way round, to avoid a couple of hundred yards of this stuff.

2. Shingle. But you only get that on beaches.

3. Squishy mud that your wheels sink into. But at least you can walk the bike.

The best surfaces:

1. Tarmac, concrete and the like. Whoosh!!!

2. Gravel paths

3. Hard grass.

Saturday 5 January 2013

Fixing things

First, the car, it's a Freelander, and with a modern car, there's nothing that the home repairer can fix. Or so I'm told. So when the tailgate wouldn't open, I guessed it would be a trip to a Landrover dealer (on the web sites, I've noticed they're called stealers, not dealers), a bill somewhere north of £200, and a new fault that I'd notice when it got back that they'd be claiming was there when it came in.

I did a bit of Googling, and it looks like there's a switch in the back that opens the lock so you can lift the tailgate. And I guessed that the switch had stopped working. Then I found that I could open the tailgate if I used the fob; that made it pretty certain that the switch was the problem.

Jason and I did a bit of dismantling, opened the switch, and it looked good inside. And when I put a meter on it, it seemed to work. But I was convinced that the problem was the switch, so I went on Ebay, and bought a replacement, £25 or so. Today it arrived.

So I opened the tailgate (using the fob) and took the switch assembly out. It still looked OK, but I put the new assembly in, closed the tailgate, pressed the switch, and was absolutely delighted when the tailgate opened. So I put everything back properly (except a couple of the bolts securing the switch to the tailgate are broken, and I don't think supergluing them worked, but that means it's held on with four instead of six bolts, so I'm happy).

And now I have a tailgate that works!

The new battery was a good idea, too. Previously in the morning, it sounded a bit sluggish in turning over the engine, and I had the impression that it was on the verge of not starting. Now, the engine turns briskly and catches immediately. That's important these days; in the past, I had a starting handle I could use, but that's no longer an option.

Next, on to the bike. A couple of weeks ago, I treated myself to a new back wheel (the old one had grinding bearings) and a new back brake. I got the bike shop to do it, because I knew that moving the gear assembly to the new wheel was a job that I couldn't do with out the specialised tools; they did it, but then the back brake wasn't working properly, it was binding on the wheel. They diagnosed that the spring that's supposed to keep it open unless you're braking, had gone, and I needed a new back caliper. I kew they were right, because I'd discovered that for myself a few weeks ago, but I managed to jimmy it so it still worked, just about. So I got them to do that too while the bike was there. When I left the bike shop, I was about £80 poorer, but then I thought, that's just one fill-up of petrol.

So yesterday, while I was biking around Didcot, I had a back brake that wasn't working. Today, I had a look - the back brake was fouling the luggage carrier, and couldn't be closed. So I adjusted the rods and bolts of the carrier, and now the back brake works. It's always nice to have two brakes! And I'd rather use the back brake than the front, because it's less likely to induce a skid and crash.

I also pumped up the tyres; the front one had felt a bit soft, and indeed, it was down to about 15 psi (I like to have them both at 45 psi).

So now I've got a working car, a working bike, and I'm ready to go out tomorrow, hopefully with ladysolly.

Friday 4 January 2013

Didcot and Harwell

After my embarrassing run of DNFs yesterday, I decided to go to Didcot for an urban day. I parked in a handy spot, and got my bike out, plus two spare batteries, and cruised around Didcot, visiting every cache there that I hadn't already done. That went well, so I moved on to Harwell and did the same there. I finished with a line of four trads, and then a puzzle I'd solved. But the solved puzzle was 500 yards up a bridleway that had been churned into gooey gloop, so I was reduced to walking the bike ... uphill. Downhill wasn't much better, and when I got home, the bike had to be pressure-cleaned.

At the end of the bridleway, I saw this plaque:

I wonder what "In Ginge" means.

When I got home, I found that the handle/switch for the Freelander has arrived - I'll fit that tomorrow.

42 caches found, two DNFs. That's more like it!

Thursday 3 January 2013

A lot of DNFs at Stanwick Lakes

Today, I decided to go to Stanwick Lakes. I've been caching there before, and the tracks are excellent for biking, so I won't have the "mushy underbike" issue. It turned out to be a good decision for biking, but I accrued a record number of DNFs.

Before I left, I tackled the two puzzles there. I got the wordsearch quite quickly, but the logic puzzle took me four tries before I got an answer I liked. So I gave it to ladysolly, and she had it solved in a trice ... and I'm glad to say our answers agreed.

I decided not to park at the visitor center; it isn't the £3 that concerned me, but the fact that they close at 5pm, and I thought I might still be trundling around by then. So I parked neat the Kettering Town Football Club, got the bike out, and set off.

There were three multis to collect info for, and I didn't do that very well either; I travelled a lot further than I needed to, but as it was on the bike on excellent tracks, that wasn't too bad.

No, the big problem was the dozen DNFs. Twelve caches not found! I don't think I've ever done so badly, although I suspect that some of them, at least, weren't actually there.

Still, the weather stayed fine, and I had a nice day out.

Weight report 32

15 stone 11 pounds. That's the Christmas Bulge.