Monday 31 December 2012

New Year's Eve frolics

Up early today - we're going down to London to  see the fireworks from the vantage point of daughter.2's flat.

First, some fun with computers.

I tried to access the URL I always go to, to do some admin. It wouldn't load, and some investigation showed that it thought that the security certificate had expired. A) it hadn't and B) it took me a few minutes to realise that this wouldn't affect customers, as they don't have access to that anyway, so I could stop panicing.

I don't know what the problem really was, or how to fix it, but the problem seems to have disappeared for now. Computers.

Then down to the dentist. A couple of weeks ago a big lump fell out of one of my back teeth; it turned out to be an old filling, from back in the days when they'd drill out most of your tooth before ramming in the Polyfiller. Mr Dentist had a look, and said he could fix it, so I leaned back while he poked around inside. And then I leaped out of the chair when he found something *really* sensitive inside the tooth. After coming down from the ceiling and receiving an apology, I settle back while he used half a bucket of filling to fill the hole, and it feels great now.

Next, I found a program (fim) that lets me, from a remote login, throw up a graphic to the display. I'm planning to use that in the forthcoming "Son of geocaching robotic arm". The idea is that, when you do the necessary thing, the Pi displays on a little 3-inch screen and gives you some information that lets you proceed. But you can't see the screen until you use the interface to pan (and/or tilt) the webcam. I need it to be a graphic, because the webcam isn't high resolution, and a 3 inch PAL-based screen is very low resolution. But if I put a large letter up on that screen, it should be readable.

The other thing I wanted to do, is detect when a button has been pressed. I can do that using the GPIO ports on the Pi, so I've ordered SP Yang's kit for making the Pi do neat things in hardware. I'm primarily a software hacker; messing around with hardware is a bit adventurous for me. But if I can get that working, and using fim, I think I can make a pretty nifty "Son of geocaching robotic arm".

So then down to London on the Railway; cars will be impossible today. First stop (not counting Marylebone) was Selfridges, and specifically the Brass Rail, which does excellent salt beef sandwiches. Then on to daughter.1 so ladysolly can do cookery-stuff before we go on to daughter.2.

Using daughter.1's broadband, courtesy of BT. I find they have a really unpleasant feature - occasionally, when I try to go to, for example, Google, I get diverted to BT Yahoo. Yes, I know that's a rebranded google, but I strongly resent my accesses being redirected. It even decided, for a while, that this blog didn't exist and that what I really wanted to go to was ... BT Yahoo.

Saturday 29 December 2012

To Imber

Up early today, round to SimplyPaul for a trip to Imber. That's a village that was requisitioned in 1943 for the Army to use in training, and never handed back. But a couple of times per year, there's an open day.

So we collected Paul's brother, and drove through the rain for a couple of hours. We found the venue easily, and were able to drive right up to the village. And in the church, there were over 100 geocachers! I had a mince pie and coffee, and talked with loads of people I knew, and some I didn't. Even the dogs were friendly, although one of them made an appalling smell and had to be taken out of the church.

We then went on to do a dozen or so caches; it was still raining at first, but then it cleared up. But I was still wet by the time I got home.

Daughter.2 is back from Australia, and we'll all be getting together for the New Year's fireworks in London.

Friday 28 December 2012

Down to London ... or rather, not.

Ladysolly and I set off yesterday to visit daughter.1 in London. We came the usual way; along the M40, along the A40 ... and then into a horrendous traffic jam.

So we were inching forward with the rest of the traffic, and phoning ahead to say we'd be late, and then I noticed that the engine temperature was climbing. My Freelander 2 (and maybe others like it?) does that; in hot weather I get very nervous in traffic jams, but I thought it would be OK in winter. It wasn't. So the temperature was climbing, and I decided to stop the engine while the traffic jam was stopped, and start it again each time we needed to move a few feet.

You can probably guess what happened next.

Flat battery.

I've been hearing symptoms of weak battery for a while now - in the morning, it seems to have difficulty turnng the engine enough to start it - but I thought it would be OK for a bit.

So there I was, in a traffic jam on the A40, in the middle lane, unable to start the car. It is of such stuff as nightmares are made.

Ladysolly got out and held up the traffic in the inside lane, so I could pull over - except that a Freelander is too heavy to push. So a guy got out of his car and helped me; that got it over to the side of the road, but we were still blocking one of the three lanes. Not that it mattered; there was a much worse blockage up ahead ... somewhere.

And then I had an idea. I have a Halfords battery with jump leads; I got it after I got stuck in the Volvo in the middle of absolutely nowhere, and I've been carrying it in the Freelander ever since, because what's the point of having one of these if you don't carry it? I opened the bonnet, connected it to the Freelander battery, waited a minute, then got in ... and the Freelander started! So I was able to get it off the A40 onto a side road.

Then we drove around for a while, looking to see if there was any other way into London that wasn't totally clogged up, and of course there wasn't. So eventually, we found Harrow-on-the-Hill tube station, I dropped ladysolly off there so she could continue on to London by rail.

And I drove home.

Also, I couldn't open the rear tailgate.

So, today, looking at the car, I found that I could open the tailgate with the fob, just not with the manual method on the back. It looks like the little switch in the back isn't working. So I ordered on on Ebay, £27.
And I now have a new Varta battery, £90.

And the car is telling me that the terrain features aren't working, but I'm going to hope that that just goes away before I start messing with it; that's got to be connected with the battery replacement, it would be too much of a coincidence for it to be a real problem.

An engagement

I've known for a few days, but I my lips were sealed. However, since she's put it on her Facebook page, I can reveal that daughter.2 is now engaged. She'll be back from Australia soon, and we'll have a big celebration.

Wednesday 26 December 2012

Christmas presents ...

An iPad 1 (hand-me-down from ladysolly). I've already installed an ssh program on it.
Four pair of XL trousers (my previous size was XXL) for caching in.
A bathroom scale; I won't have to keep using ladysolly's.
Three rather interesting-looking books.


A USB robotic arm, this is the Maplin's version. I'm not sure yet what I'll do with it, but I'm sure I'll think of something.

Tuesday 25 December 2012

Christmas at the Grove

Chistmas dinner with ladysolly and daughter.1 at The Grove, where they had a full-size gingerbread house, two Christmas Elves, and Santa with his four lady assistants.

And a huge, non-dietary dinner it was too.

Monday 24 December 2012

A tiny monitor for a tiny computer

I have a three inch PAL monitor, left over from another project. So I just connected it to the Pi, made a little change in /boot/config.txt and started it up. When the Pi booting, I could see the boot messages, and when it had finished booting, I ran startx to start up xwindows. And I got the xwindows gui on the three inch monitor. I can even navigate it using the mouse. But I have to admit, it's not easy to read what's there!

Running a Pi on VGA

I tried this before, and the HDMI-VGA cable, being unpowered, was taking too much from the Pi, so it didn't work, it kept crashing.

I woke up this morning with an idea. Suppose I gave the Pi six volts instead of the nominal five? Maybe it would have enough to power the converter cable.

And it did. I'm writing this blog entry on a Raspberry Pi, with an awful keyboard, but running xWindows, using the HDMI-VGA converter, which now seems to be totally stable. My multimeter reports that the Pi is getting 5.7 volts. This means that with a £10 cable, you can run a Pi on a VGA monitor.

I called RS today to find out what's happening to the two Pies they owe me as replacements for faulty Pies. The lady there reminded me that this is a short-staffed day, but went on to tell me that it's been dispatched. Delighted, I asked when was it sent? "January 12", she said; this is obviously the RS-imperfect tense where "has been dispatched" translates to "will be dispatched if we get some on the date suggested".  I didn't even ask about the additional six I ordered. One of them will be going to Ann, who is proudly clueless about computers, isn't really aware that I changed her from Windows 98 to Linux, and won't know, unless I tell her, that she'll be swapping to a Pi.

The good news from RS, though, is that the lady told me that they wouldn't be wanting the faulty Pi back; I guess it would cost them more to process the return than the £20 value of it. So if they stick to that, I'll have a go at repairing it myself; I'm not a perfect solderer, but I can bodge things together sometimes.

Sunday 23 December 2012

A year of blogging

I started this blog exactly a year ago. Much has happened since then.

The big news is that I've gone from 18 stone 5 (257 pounds) on May 2nd to 15 stone 6 (216 pounds). I've lost 41 pounds. 41 pounds is about the weight of an electric bike plus a couple of batteries, and I wouldn't like to lug one of those around with me everywhere. The weight loss will also be good for the hip tendonitis problem I had this time last year, and the foot problem, plantar fascitis, which I've had now and then. I can go upstairs two at a time, and not feel that it's difficult.

Some people have asked me how I did the weight loss. It's simple. I eat less, but still go geocaching, which is lots of exercise. And posting my weight on this blog each week helps me, because it's a public committment.

On the tooth issue; the pin-attached fake front tooth that the dentist made for me after one of my beloved front teeth broke off, came loose three times. After the third time, he said "It's time for plan B". Plan B was, extract the stump of the old tooth (which I was dreading, but turned out to be not too bad) and make a bridge. That has worked very well, and I now have a complete-looking set of front teeth again.  Not such good news on the back teeth, though; small bits break off every now and then. My dentist blames the dentists of my early youth whose answer to any dental problem was drill deep, which badly weakened the teeth..

Overall, healthwise, I'm good. Probably the weight loss helped there.

I've done a lot of geocaching, although I've lost the commanding lead I had at the start of the year over other cachers in the UK, because there was a period of a few months when I did almost nothing, because of the hip problem.

I've discovered the Raspberry Pi, and I've been doing a lot of stuff with that, including getting the Geocaching Robotic Arm working again.

Grandson.1, now aged 1 1/2, is now calling me "Grandpa", or at least that's what daughter.1 and ladysolly tell me. To me, it sounds a bit garbled, but my hearing isn't as good as theirs.

I acquired ladysolly's old iPhone, and I have to agree with everyone who says how great it is, although this particular model (I think it's a 3) is not much use for geocaching. And I've been promised her old iPad; I suspect that's my Christmas present.

I've been doing a lot of biking on the electric bike I acquired last year from Ebay; so much so that I've bought three new batteries, new brake cables, new gear shifters, new brake pads and a new helmet.

So, it's been another good year.

Merry Christmas to both of my readers!

Power for the Pies

My Raspberry Pi power plans have proceeded plumptiously.

Here's what I made. I started off with a standard PC power supply. I have a few of these in my junk pile; some are stone dead, but some are marked as "weak", meaning that they do seem to work but they don't have enough oomph to power a full-sized PC and a handful of hard drives. Sometimes that's because the 12 volt voltage comes out well under 12, sometimes I just don't know why. So I'm using a "weak" power supply - you'll see why that won't matter in a minute. Here's what I started off with.

The first thing to do is to persuade it to run even though there isn't a PC motherboard attached. To do this, I short circuited two of the pins, green and black. There's several how-tos on the internet that explain it in detail, but it's very easy, takes about ten seconds.

Next, I took the UBEC, Universal Battery Eliminator Circuit. My favourite of the two I tried is the Hobbywing, because you can jumper it to 5 or 6 volts (Pies seem to prefer 6) plus it has a LED to tell you it's awake. They come with a pair of wires at each end. I attached the input wires to a Molex connector, the sort of connector that PCs use. That means I can just plug it in to a PC power supply.

If you're familiar with PC power supplies, you'll have noticed that the UBEC is connected to the 12 volt (yellow) line, not the 5 volt (red). That's because the whole point of a UBEC is to take a voltage that's greater than I want, and convert it to the 5 volts (or 6, in my case) that I do want. And that's why it won't matter if the PC power supply that's supposed to put out 12 volts actually puts out 11, or 10, or even less.

This is a close-up of a UBEC. This isn't the one I prefer; the Hobbywing is better for Raspberry Pies.

The output end of the UBEC terminates in the sort of connector that's used in model aircraft. I took that off, and connected a wire that led to the sort of round connector with a tip, that almost everything else uses. I connected two wires, with two different sizes of connector, that's so I can plug it in to either of the powered hubs that I use.

After I soldered the connections, I checked with a multimeter, to make sure that A) the connections worked, and B) I haven't accidentally short-circuited the UBEC output. I think the UBEC will shut down gracefully if that happens, but I'd rather not put it to the test.

So now I can plug the output of the UBEC (6 volts) into a powered USB hub.

And now we're ready to power up the Pies.

I could connect five Pies to this arrangement. The PC power supply gives as much power as the UBEC can take, the UBEC can handle a maximum of 3 amps, that's 3000 milliamps, and a Raspberry Pi wants 500 milliamps. So, powering five Pies works. I'm actually powering four pies from this, and I have the USB-driven hard drive plugged in also. One of the Pies is powered from the connector that the USB hub thinks is its input.

Previously, to power the four Pies and the hard drive, I was using two power bricks and a PC power supply (for the hard drive power). The power bricks felt quite hot when running, which means that they're wasting quite a lot of power in doing the conversion (the wasted power is what makes the heat).

Now, I'm using on PC power supply to power the lot, and it feels cool to the touch. The UBEC feel very warm, but not worryingly hot.

I managed to give myself a 240 volt shock at one point while I was messing around with this; I thnk the power supply I was using at that moment was faulty.

I've ordered three more Hobbywing UBECs, they cost about $7 each.

Here's what it all looks like.

The PC power supply is the big grey box on the left; I can't remember what sort of computer it came out of, but it's a totally non-standard size, and so pretty useless. Except here.

The hard drive is a 400 gb Sata; 400 gb drives are too small in capacity to be usable these days; I'm buying 3000 gb drives as standard. But I have a whole bunch of 400s in a box, and as storage for the Pies, they're fine.

The thing in the front glowing redly is the Hobbywing UBEC. That's the LED glowing, it isn't red-hot!

The blue glow near the middle, is the powered USB hub, getting power from the UBEC. The four Pies can be seen in the boxes that RS ship them in - they make good Pi boxes, after I used a hacksaw to cut holes for the ethernet and power cables.

The black blob between the hard drive and the power supply is the USB-Sata interface thingy.

This little arrangement is replacing four full-sized computers which would have been drawing about a kilowatt between them. I haven't measured, but from previous experiments, I'd say that this is using about a tenth of that power. But I'm not only saving that electricity; it also means that, come summer, I'll have that much less cooling by the aircon, so the saving is probably twice as much.

Saturday 22 December 2012

Pies and hard drives

I did some messing about with a Pi and some hard drives, and it was all good.

First, I attached a dual-Sata HDD docking station to the Pi (via a powered hub). Immediately, I was able to see the two drives on the Pi as sda and sdb.

So then I tried adding a second docking station - this one allows one Pata IDE drive and two Sata drives. That showed up as sdc (for the device itself, which also lets you read all sorts of memory cards, so I'm guessing that sdc was the card. Also, the Pata IDE showed up as sdd, and the two Sata drives were sde and sdf. Notice, I didn't install any software, I just plugged them in and it "just worked". The two-drive device used 17 watts, the three-drive used 28 watts.

A couple of deliveries today - I'd ordered a bunch of USB-hard drive interface cables, which come in at just under £3. There's no power supply, no Sata cable and no Sata power cable, but I knew that. So I fired up an old PC power supply, to give me the power for the hard drives. I wanted to see if I could use both the Pata and the Sata port at once, giving me two drives. Yes - it worked. And the two drives (plus the overhead for the power supply) was 29 watts.

So then I wanted to see if I could add another drive using another interface cable. You guessed it - it "just worked", three drives on the two cables, pulling 36 watts.

Huh. So I added two more interface cables, each with a Sata drive. And they just worked. Five drives pulls 50 watts. It's 7 watts per drive, plus 15 watts overhead for the power supply. That particular power supply is a measly 200 watts, so I could put a couple of dozen drives on it, and I rather think that the Pi will happily handle that.

I also had a look at one of the seven-port USB hubs I got for the Pi Project; I'd plugged it in and it didn't work, so I put it aside for now. On closer inspection, I noticed that the soldered joint to the power wasn't working, so I soldered that, and now the hub works fine. And another of the seven-port hubs had exactly the same problem. I thnik the problem is, that part of it is hald-soldered, and anything done by hand has a higher failure rate than anything machine-made. It's the same problem, I think, as the large smoothing capacitor on the pi.

I've ordered a couple of 10-port powered USB hubs, about £4 each; if I'm going to add a lot of hard drives to a Pi, I'll need those.

Friday 21 December 2012

Leighton Buzzard

Caching today. It's been a bit rainy in the last couple of days, but today was fine, although somewhat soggy underfoot. So I left the bike in the car.

I did two rings, and when I got back to the car after the second one, I decided it was time for home. I was very glad I'd left the bike - I went over some very cloggy ground, which is hell on bikes because the mud jams the wheels.

I crossed one field that had an over-friendly horse; he kept coming up behind me and nudging me with his nose. I had to speak quite sharply to him.

The day out gave me a chance to contemplate a problem I had on a server, and I noted down a few things to try when I got back. I find that a while spent thinking about a problem is usually much better than jumping straight in with the sledgehammer.

I left a 120 ml container totally submerged in water for 24 hours, and it's still completely dry inside, so that went well. I've also just taken delivery of 100 25 ml containers. They're slightly larger than a 35 mm film can, and look nicely watertight. They'd have to be - they're designed for medical use, for specimens. These are unused, though, so no lingering odour!

And the Geocaching Robot Arm is now live.

A new category of spam

I sort my spam carefully into various categories. For example, email that wasn't sent to my email address, gets short shrift.

I've just added a new category - nonroman. This is to collect all the spam that's in Japanese, Chinese or any other character-set that I don't have a hope in hell of reading, so I can just delete it all at once.

I've added this category because of the increasing about of spam I'm getting in Japanese and Chinese.

Much spam

I was doing something fairly routine with one of my servers, and I found that I couldn't do it. A short investigation revealed why - the root volume was full. How come? I looked around, and I soon found a HUGE amount of email in one of my users accounts. But that was a user who lapsed long ago; what's all this email? So I had a look - it was all bounces from Google, Hotmail and so on. So I looked into what was going on.

I'll spare you the detective work, but the sequence of events I've found was this.

Someone got that user's password. Probably, they just gave it away; people are pretty casual about passwords. And about a dozen people (or at least, the logins were coming from a doxen different servers) were logging in to that account using ssh, and running a program that was sending out huge amounts of spam, and it was the sort of spam that sends out a jpg, so it was a couple of hundred kb each time. The receiving servers had noticed that this user was spamming, and was bouncing the messages back.

So, here's what I did about it.

1. Cancelled the password of that user. I don't think it's been used legitimately for many moons.

2. Change my firewall so that the only IP addresses that can log into my colocated servers, are mine. That means I won't be able to log in to them while I'm visiting my daughter (for example), or while on holiday, but I can work out a workaround for that.

3. Delete the retry queue, so that stuff that hasn't been delivered, won't be retried.

And I'll keep a particular eye on this server for a while, to check that this has had the desired effect.

Thursday 20 December 2012

More Piery

More fun with Pies today. I've got 8 doing real work, two that I'm waiting for RS to replace, and six more on order. I've held one back to play with. By "play", I mean, experiment to see what else I can make it do.

Last night, I had a bit of an inspiration, and I've ordered something that I think will let me use three of the GPIO pins on the Pi, as a serial (RS232) port. I'm hoping that this will allow the Robotic Arm Pi to control the power to both the lights and the arm. I tried to use the Pi to do that (a USB port connects to a USB-RS232 converter, which talks to the relay box that switches things on and off). But when it does that, the Pi crashes. I tried with several configurations, no luck. So right now I'm using a different computer to do the switching, which works, but isn't elegant. Here's how I plan to do it.

Another thing arrived today - a UBEC, Universal Battery Elimination Circuit. It is a tiny thing, about one inch by half an inch. You give it any old DC voltage, maybe 5 to 30 volts, and it converts it to a steady, smooth five volts. Five volts is, of course, exactly what the Pi wants. From what I can see, UBECs are mostly used by model airplane fliers.

The UBEC is very efficient, you only lose maybe 10% of power in the conversion. And I'm thinking that I can use it to step down the 9 volts from a cheap-and-cheerful power supply (or 12 volts, or whatever they put out) down to the five volts that we want. They cost about £3 each, and will give you 5 amps at 5 volts, which means that one of them could power several Pies, if it is fed by a sufficiently beefy power supply. I have a *lot* of unused power supplies.

Yesterday, I got a 400 gb SATA hard drive connected to that Pi. And it was jolly easy to do. I just connected the data cable via the gizmo to a USB port, connected the power, and the drive was ready for use. Today, I loaded it with data, and put it in a working environment. I'm using an old PC power supply to power the drive, and there's plenty of oomph left in that to power several more drives.

Next, I tried out a couple of wifi USB dongles. They were really cheap, about £4. Both of the ones I just bought showed up as Ralink, the necessary driver was already on the Pi, and getting it working took just a few minutes. So it had two ethernet connections, one to my main network, and another to my Wifi hotspot, and I was able to log into it via Wifi, so I was happy that was working.

But then, I wanted to make the Pi into a Wifi hotspot. And that turned out to be a bit complex, but very easy. I just followed the recipe here and it worked forst time. I have a little Zyxel hotspot finder, and it found my usual hotspot, then it found the Pi. So that's working.

And then I wondered if that Zyxel (which is also a USB wifi dongle) could also work as a wifi dongle to the pi. And it does, using "apt-get install zd1211-firmware" to get the driver. Although I'm not going to use it for that purpose, it's just too useful as a hotspot finder.

The next thing I want to do with this Pi/dongle combination, is to work out how to use it to give static IP addresses instead of the dynamic (meaning, you never know what device is going to have what address). 

While I was doing all this with the Wifi, I found that I don't actually have to give the Pi any power! I have the Wifi dongle plugged into a powered USB hub, and the Pi also, because if I plug the dongle straight into the Pi, it takes so much power that the Pi crashes. And I discovered that if I unplug the power lead to the Pi, it doesn't seem to care. It's taking power from the powered hub, via the USB port that it's plugged in to. And that's very nice, because it means that whenever I use a Pi with a powered USB hub, I dno't also need to have a power supply and cable for the Pi.

Another thing that arrived today, was a box full of 120 ml plastic screw-top containers. That cost me £28 for 100 on Ebay (search for plastic specimen sample jar). That works out at 28p each, which is a very good price for a small waterproof cache container, several times bigger than a 35mm. I've got one totally submerged in water right now; I'll leave it for a while and see if any water gets in. The people I got them from sell smaller sizes also.

And then I decided that the Geocaching Robot Arm is ready to go public, so I'm in the process of getting that approved. When it's approved, it will be GC41V9Q.

Another way to log caches

Last time I went out, I found a voice recorder, lying on the ground. It had been out in the cold and wet for about a month. I emailed the people who had lost it to ask how to send it to them, but they'd bought a new one, and said I could keep the old one.

So I left it a couple of days to dry out, and when it looked OK, I switched it on, and I was suprised to see that it worked! I can't see how to insert a sound file into this blog. It lets me upload pictures and video, and an MP3 is neither of those.

But there's more than one way to skin a cat, and here's a way that might leave me with usable fur.

  A test file

Let me know if you can play that.

Wednesday 19 December 2012

Yet more fun with software

I have a couple of cameras that sit in the top of the house and watch the road and field opposite. I replaced the server that runs them, with a Raspberry Pi, and that was all working OK. But in the course of replacing the Sonicwall with the Pix, I must have done something silly, and the cam system wasn't working any more. I could use it from inside the house, but not log into it from outside. And the reason it failed, was that I'd done something excessively complicated to reduce the need for external IP addresses; I'd made it so that you accessed it via port 81 on another IP address, then the Pix was supposed to redirect from there, to port 80 (the port used for web service) on the cam.

I struggled mightily to get it working again, to no avail. And then I stopped digging the hole deeper, stepped back and thought about it. I can get the same effect, by keeping the Pi upstairs for controlling the cams, using Samba to allow other computers to share the pictures they take, and having the web server on the other address I'd been using. So I did that.

But that meant sharing across the new firewall. And the Pix has a big flaw. If it blocks an access, it tells you which rule was broken, which computer was the source of the request, and the destination. But it doesn't tell you which port, and I don't see how to make it tell. So I installed tcpdump, which shows you every packet coming into or out of the computer you run it on. To get sense out of it, you have to tell tcpdump not to display all the stuff you already know about, so it's a command like this ...

tcpdump not src computer1 and not dst computer1 and not src computer2 and not dst computer2

... where computer1 and computer2 are computers that are having so much traffic with the computer you're trying to watch that you can't see the info you need.

That told me which port Samba was using, it's port 445. So I told the firewall to allow that. But it still didn't work. I changed the Samba configuration so that it spewed out lots of information into a log file, and looked at that - it said that there was no such user. So I changed the way it recognises users, and then it said there was no such password. So I tried to run smbpasswd, which is how you tell Samba what password to accept, but smbpasswd wasn't on the computer, so I had to get it.

apt-get install samba-common-bin

And after I'd got that, and made a password, I was able to share the files on the Pi that takes the pictures, with the computer that was going to be the web server.

But then Apache wouldn't let anyone see the pictures, and after a bit more research, I discovered that to get Apache to serve up files that are being shared by another computer, you need this:

<Directory "/path-to-nfs-files">
EnableMMAP Off
EnableSendfile Off

So I did that, and it all worked!

And you know what?

They actually pay people to do this sort of thing. Please don't tell them that we'd do it just for fun.

More fun with pies, and other hardware

Mr Postman brought a load of goodies for me today.

The first thing was a replacement ROM for the Hagstrom board. This is a board that is supposed to let you use a vintage IBM PC keyboard  (mine was made on September 30, 1983, so its 29 years old) to a modern computer. I won't go into why you can't just plug it in - it's got a completely different protocol. But when I saw the Hagstrom unit, I was keen to get it.


Because IBM made the best keyboards ever for their PC. I have a few of their IBM AT-style keyboards, and those are nice, but nothing is as perfect as the IBM PC keyboard. It's the feel of it, the solidity of it, and the clickyness of the keys. I just love it.

So when the Hagstrom arrived, and didn't do what it was supposed to, I was very disappointed, especially as it cost me for the unit, then more to get it out of UK Customs, and an extra cost for the delivery. And I contacted Hagstrom, who had actually said that it would work with an IBM PC, and told them. They asked me to test the keyboard, to make sure that worked, which is a reasonable request, so I dug out Dobbin, an ancient 8088 computer that I still have, and which still works, and was able to see that the IBM PC keyboard worked perfectly on that. And so, by the way, did a Hardcard, which is a 10 mb (yes, ten megabytes) hard drive on a card. So I told Hagstrom, and told them the exact details of the IBM PC keyboard (model number etc), and they said they'd look into it. I was sceptical, and I had already written the cost off as a loss.

Today, a replacement ROM arrived from Hagstrom, with a chip puller. I pulled the old chip out (it's a very long time since I've done that sort of thing), put the new one in, and ... it worked! Perfectly. I'm typing this very blog on a 29 year old IBM PC keyboard that is a dream to type on.

The next thing that arrived, was a USB-ethernet adaptor. I haven't tried that yet - now that I've got the Pix 515 operational, the need for a firewall has diminished. I've also bid on Ebay for a pair of Pix 515s, which must have cost a couple of thousand when new, but I've bid a maximum of £5 and have every hope of getting them, because no corporate would buy a second hand Pix (with the password missing, but I know how to deal with that) and home users don't use Pixes. I've also bid for a Pix 501, the bottom end Pix, and also ridiculously cheap now. Cisco don't sell the Pix any more, so it's an obsolete box, another reason why no corporate would want one. But I've loved using them, and they work, they just work.

Another arrival was a HDMI-VGA converter. Only one of my monitors had HDMI (DVI actually, but that's almost the same thing) and I want to be able to plug the Pies into a monitor without having to take it upstairs to where that monitor is. But, it didn't work. Well, it did work, sort of, but I think the problem is, the converter takes too much power from the Pi, which has hardly any to spare. I should have thought of that. So I've ordered a powered converter instead.

And the fourth arrival, was a cable that interfaces SATA or PATA IDE to USB. Modern hard drives are pretty much all SATA, although I (of course) have a pile of PATA hard drives that were retired while still working because they're so small in capacity compared to modern SATA drives; 300 gb compared to 3000 gb. I thought that making that work would be a big job, but no. I connect the hard drive to power, a Sata cable from the hard drive to the gizmo, and the USB cable from the gizmo to the Pi. That was easy. But what about installing software, and drivers, and configuring, and things like that?

No need. As soon as it was plugged in, it was drive sda, and I just formatted it with the usual commands, and it's now sitting connected to the Pi with 400 gb of empty space waiting to be filled. So I've ordered a dozen more of them. At £3 each.

Update ... I'm getting 4mb/second copying files off one hard drive, across the network, and onto this USB drive. I'm very happy with that speed.

Weight report 31

15 stone 7 pounds

Monday 17 December 2012

Configuring the Pix, part 2

My theory was right, and I've got the Pix operational now. I'll try to explain the issue. Hold tight.

A network is a bunch of computers, all sharing a cable. And they need to talk to each other. To do that, each one needs to know where the others are. This is done using ARP, Address Resolution Protocol.

They need to work out which IP address (like corresponds to which hardware address (like B8:27:EB:C3:2A:13). So they're forever exchanging this information, so that everyone knows where everyone else is.

Then I put a bunch of computers behind a firewall. The computers not behind the firewall, are still sending out ARP packets, but what they get back from the computers behind the firewall, is the ip address that the firewall presents to the outside world, and the hardware address of the firewall.

So, what I did, was I took out the Sonicwall, and inserted the Pix. That worked fine for the computers in my network, but ...

I have a second firewall, it stands right in front of my internet connection, filtering everything. And it had the hardware address of the Sonicwall in its ARP memory. When I switched to the Pix, it was still sending packets to the Sonicwall, which was no longer there. So that meant that everyone outside my network wasn't able to contact the computers behind the Pix that replaced the Sonicwall.

You'd think that the second firewall would have asked for new ARP information. But it doesn't, not immediately. Not for four hours, actually - the ARP cache is 14400 seconds on the Pix.

So, how to deal with this? It's very easy. I could have switched the second Pix off and on again, but I don't have to be so drastic. CLEAR ARP does the trick.

Macmillan and Midshires

Out caching today, up North again, to the Macmillan and Midshires way.

40-odd caches done today, all on foot. I left the bike in the car because the ground was so squishy; by the time I got back to the car I was glad I had, the terrain ranged from poor to awful, plus there would have been some terrible stiles to lift over.

Just before I got back to the car, I saw this:

It's a church tower without the church.

I had a *lot* of DNFs today, but in a few of them, the cache had clearly gone, by the number of previous DNFs and the specificity of the hint. So I replaced them. I'm running out of 35mm canisters, so I ordered 100 urine specimen containers from ebay (unused), and 100 120ml containers. They were all very cheap.

It was only seven miles, but it took me 5 hours, and my back hurts from all the walking.

Saturday 15 December 2012

Configuring the pix

I wanted to replace the Sonicwall firewall with a pix.

I actually use three firewalls here; the main one, and two Sonicwalls to give extra walling to particular segments. One problem with the Sonicwalls I use, is that they only allow 20-odd rules, which really isn't much, unless you're a home user. And I have a couple of Pixes that haven't been used for a couple of years, so I thought I'd get those into action.

The Cisco Pix is a Real Firewall, not a puny one like the Sonicwalls I've been using. They're amazingly cheap if you buy them second hand on Ebay, because home users wouldn't want one, and corporates wouldn't buy second hand.

So I started to configure it to do the job I want. it turned out to be far more difficult than I'd thought, involving the use of access-lists. And I didn't press the button on the ethernet switch that crossed the cable, because it's an old switch, modern ones auto-detect, and I'd forgotten about needing to do it.

And after about two solid days of struggle, I've still only got it partially working, but I'm so close now, so close ... just a couple more issues to deal with ...

I've fallen back on the old Sonicwall for now, but I think its days are numbered.

I've also bought a USB ethernet device, so I can have two ethernet ports on a Raspberry Pi. If I have two ethernet ports, then I'm pretty sure I can turn it into a firewall, which (I think) will be a lot easier to configure than a Pix. I've done this before, using three ethernet cards in one computer to make a three-segment firewall (Lan, Wan and DMZ). 

So now it's a race. Will I get the Pix configutred before I make a homebrew firewall?

Thursday 13 December 2012

More on the Robot Arm

After a chat at the recent 12/12/12 event, I became aware that the robot arm wasn't working with iPads. Why? Because iPads don't do java. Who'd have thought it. I wouldn't have. You can, if you're willing to go to some trouble, get java for your iPad, but I'm thinking that most people won't.

So I've had to do two versions of the robot arm.

The page you go to, looks at your computer and decides what it is; iPad (or Mac), or proper computer. If it's a proper computer, then you get automatically sent to the java version, with the smooth camera refresh. But if you've only got an iPad or Mac, then you get sent to the version that refreshes the picture every two seconds by relaoding the jpgs. It's not so nice, but at least the poor iPad users get to play with the robot arm. And if the automatic thing makes the wrong decision, there's a link you can click on to try it the other way.

I tried it out with ladysolly's iPad, and it seems to work.

Email me if you have any problems with it - I want to get the tested before I publish the cache. I know it's not fashionable to actually test software before you send it out, but I'm old-fashioned.

Two more Pies, and six more

Two more Pies have been installed as combination mail/web/name servers, plus they'll proably be doing other stuff; these are for my domain. And that means that I have eight Pies operational, one about to be sent back to RS (faulty), one waiting for an RMA from RS (even more faulty) and one more that I've been holding back to use for experimentation. For example, can I put a wifi USB on it? If so, can I make that into a hotspot? Can I put a wired USB-ethernet on it, and if so, can I make that into a firewall? Can I interface a SATA drive to it via a USB? And other interesting stuff.

So I went onto RS's web site, and ordered six more. It says that they have them in stock, so they should arrive in a couple of days.

Monday 10 December 2012

To Deenethorpe

I went to Deenethorpe today. I parked, got out of the car, and saw that the first cache would be across the sort of clingy mud that makes even pushing a bike almost impossible. So I decided to go on foot today.

I think that actually, I could have gone around the mud, but the whole area was so soggy that I didn't much regret going on foot. Plus I would have had to lift over a number of quite difficult stiles.

After completing the round, when I got back to the road, I looked back and saw this.

Given the history I have with dogs, it would have been nice to have been told this before I entered their area, not just as I was leaving.

I got back to the car just as the sun was setting, ate lunch, then did a few more by night. A good day out, forty+ caches.

RS Components failure

Oh joy, the missing Pi has arrived - RS had delivered 9 instead of the 10 that they should have, and today the additional one arrived.


I opened the box, and without opening the sealed transparent envelope containing the Pi, I could see there was a problem. The large capacitor (the same one that is loose on the faulty Pi that they said they'll replace) was rolling around inside, completely unattached. So I'll have to send this one back also.

Meanwhile, I've got the two Pies that will be acting as twin mailservers ready. You ought to have two mailservers, so that if one of them fails, the other one is still accepting email. I'll be putting them in place tomorrow, replacing the two full-sized computers (one of which had a flaky hard drive).

And next, I'll bring up two more mail servers, plus I'm going to see if I can use a Cisco Pix for the DMZ firewall (I'm currently using a Sonicwall, and the dratted thing only allows 20 firewall rules, which is rather a limitation). I have two Pixes which are currently doing nothing, and anyway I can get a Pix on Ebay for a mere £50 (they're worth £500). The reason they're so cheap on Ebay, is that corporates won't buy second-hand kit, and home users don't use Pixes.

It occurs to me that I could use a Pi as a firewall; all it would need is a second ethernet port (running off a USB port) and some software that I've already written (I was running a homebrew firewall for quite a while).

I've found that an unregulated power supply that will output 1500 ma at 6v, is fine for powering three Pies. I'll try it with four, but I'm planning to use each one to power only two. I found that, with no load,the power supply consumes 5 watts, and each Pi adds another 5 watts to the load. That means, 2.5 watts for the Pi, and 2.5 watts in efficiency losses. but that such a low level of current draw, efficiency losses aren't a big deal.

Saturday 8 December 2012

Compressing raspberries

If you use make an image backup of an 8gb SD card, you get an 8gb file. Which is biggish, especially if you have several of them, on for each Pi.

So I used zip. I don't think the version of zip that I have, likes files over 2gb. Ditto rar. Gunzip worked, but it only reduced the size from 8gb to 5gb. So I tried bzip2, and that worked great - the 8gb files became 0.5 gb, which is more what I'd expect, since most of the SD card is empty, so should compress down a *lot*.

Powering the Pies

I was starting to think that powering the Pies was a very trial-and-error affair, but I just realised something important. They want regulated power supplies, because they like their voltage within narrow limits.

Unregulated power suppies tend to be cheaper, and what they do is chuck out what they hope is five volts (or whatever) and hope for the best. A regulated power supply is constantly measuring its output to ensure that its output is steady.

You can usually see whether a power supply is regulated or not, by reading what's on it carefully. If it doesn't say, then it may well be unregulated.

Friday 7 December 2012

Backing up the Pies

 One of the Pies has failed. It failed when I was trying to load it up, and when I looked at it, I noticed that a capacitor, which I think is C3, it's the big one next to the power socket, is loose. It isn't soldered in. I could probably fix that myself, but I think I'll send it back to RS for a replacement. The Pi foundation will probably want to know about such problems; they seem to be very keen on quality.

If something goes wrong with a Pi, all I have to do is take the SD card out of the Pi, and put it in another Pi. But what if the SD card goes bad? I've had that happen with a couple of SD cards. I'll be backing up the data, of course, but I'd still have to reload and reconfigure the replacement card, which can take hours, and involves remembering what I have to do.

So I'm doing a backup of each pi. I'm doing an image backup of the 8gb card, referred to as /dev/mmcblk0, to a file on another server. So first, I share a directory on that server which I'm calling "pibackups", then I mount it on the Pi at /root/backup. Then I do

dd if=/dev/mmcblk0 of=/root/backup/robotarm.img

That should make me an 8gb image of the SD card, onto the other server, ready for imaging back if necessary.

To Brigstock

Up north again. I like this area, there's very few stiles.

When I set off, there was a snowstorm going on, but I had faith, and by the time I got on target, the weather had cleared up, so no rain or snow. But it was very cold, so cold that for part of the route, I was worried about skidding on the icy track.

I warmed up after an hour or so, and was fairly warm as I rode along, but round about 4pm, the sun had gone down and it turned really cold.

I started this series in the middle, because that was in the town, which gave me a good place to park and a good base for after the series. The series went well; at one site I found two caches, and at the next I found none. I thought at first that maybe someone had carried the cache to the one with two, but then I spotted the cache, it had fallen to the ground.

I also tried to do a series with a bonus, but the way the cache setter had done this, you had to get all the individual caches or you stood no chance at the bonus. And one of the cache, I just couldn't find. Maybe it's missing?

This was an interesting sight.

One river, running red water, joins another river, running clear, and the result is a river that's stripey.

Reverse DNS

Computers identify themselves with numbers called IP addresses. so, for example, an IP address would look like this:

Actually, you won't see an IP address that starts with 10, because all the 10 addresses are reserved. Anyone can use them for their network, but you can't use them externally. I make considerable use of 10 addresses, and my firewall translates them to the addresses that you access.

But you don't type in numbers to access a computer, you use names, because people find it easier to remember names. Like So something has to translate the names to the numbers, and that's called DNS, Domain Name Services.

But for some purposes you need to be able to translate the other way round. Given an IP addreess, you want to know what name corresponds to that, and that's called Reverse Domain Name Services, rDNS.

If you want to send email to someone signed up with AOL's email service, you have to get rDNS working; ditto Comcast, and there might be others. If you don't have rDNS, then AOL won't deliver the email, on account of it's probably spam. But getting it working isn't easy.

First, I had to get my ISP to delegate the rDNS to me; their default is that they do it, but they don't do it quite right, they translate every IP address to something a bit silly. That's OK for AOL - AOL don't care what it translates to, as long as it's something.

Then I had to tell my name servers to do the rDNS. For that, I had to set up data files with the reverse translation. To do that, you have to give each IP address a name, so would be Notice that the numbers are backwards, and you have to add the magic incantation "", and then you put in the file the name that this corresponds to.

Already you can see it's a nightmare.

Here's some help.

Those will tell you when you have it wrong. But they can't tell you how to put it right. And it's worse - when you make a change, it takes a while, maybe an hour or more, for it to get noticed around the internet, so if you make a change, you can't really test it immediately.


I had it *almost* right, and I've had it *almost* right for some years. But the AOL tester was only working about half the time. Half the time it told me my rDNS was working, half the time it told me it wasn't. Not too big a deal, because my email to AOL were getting through. But it bothered me.

I finally worked out what was wrong. To use rDNS, you have to have name servers, of course. And to use DNS you have to use name servers. But how do you know where my name server is? How do you know the IP address of my name server, because if you don't, you can't ask my name server any questions.

The answer is, root name servers. Your computer asks the root name servers, which I imagine are big boxes in stainless steel cases, with armed guards all round. The root name servers don't know the answer, but they know which server you can ask. Except that server don't know the answer, but it knows a server that does. And the question gets delegated down until eventually, an answer is supplied, now you know the IP address of my name server, and now you can ask it for the IP address of any of my servers.

So, the IP address of my name servers wasn't in my data file. No point. You already know the IP address of my name server if you're asking it questions.

But it turns out that for rDNS, you *do* have to have the IP address of your name server, and if I'd thought about it, I'd have realised why.

When you try to resolve to a name, you don't know where my name server is, and you can't ask the root name servers to find out for you. So my file that contains the IP addresses of all my servers, also has to have the IP address of my name servers.

I added that, and bingo! My rDNS now works perfectly.

And I now understand the internet a little bit more. Maybe.

Thursday 6 December 2012

Another pi goes into action

This one is to replace the server that gathers my email from the umpteen addresses I've accumulated over the last 25 years, despams it and arranges it nicely for me to read ... or delete.

I used one of the 8gb Sandisk cards, and after several different atttempts at powering it, I eventually found something that works. Yes, the Pi is a bit fussy about its power. I give it 5 volts, and 4.25 appears on the voltage measuring points. Right now, I'm giving it 6 volts, and it says it's getting 5.5, wihch it seems happy with.

In the course of setting this up, I discovered that one of my mail servers has an umpty drive, which has been giving problems over the last three weeks, without me noticing. As a result, there was a huge buildup on email on one of my other servers (they send each other email all the time, don't ask).

So I rebooted the server with the disk problem the disk problem went away, and a flood of pent-up email descended (mostly, trying to tell me about various problems that I'd dealt with already in the last three weeks). Eventually, I cleared it all, and now the email-gatherer seems to be working fine. I had lots of fun trying to ensure that reverse DNS works - wiothout that, AOL and Comcast won't accept email from me. I have it partially working, I'm not sure what the remaining problem is, but AOL seems happy.

More hardware arrived today; a USB device that you can put a couple of hard drives in.m Now I need to work out who to use it. Also, some more powered USB hubs arrived; these come with a power supply. They'll be useful for powering Pies and for those Pies that beed to connect to a lot of USB things.

I think the next server for replacement will be the one with the umpty drive. You know it makes sense.

Wednesday 5 December 2012


The big news today, is that ladysolly's iPad mini arrived. She hasn't looked at it yet.

And in the morning, bits for Pies arrived; the 8gb SD cards, and the USB-to-microUSB cables, which I need to power the pies. The unpowered powered hubs already arrived (they're powered hubs, but don't come with a power supply). So I converted a couple of power supplies I had that were doing nothing; 5.15 volts and 2 amps, ideal for Pies. And when I plug them into the powered hub, a little blue light comes on, and there's a little switch for each port that has a blue light when you power it on. Very pretty. I should be able to power up to four pies from each one.

I took the photo above with my iPhone. And then to get it onto the computer is a whole performance; I have to connect it to the USB, tell iTunes to go away, tell it "Yes I know I don't have audio on this computer", find the picture and copy it. So I had an idea, and I emailed it to myself instead. Much quicker, and it doesn't actually go across the internet and back, because my mail server is right here.

After power-washing the bike yesterday, I went to oil the chain, because powewr-washing seems to drive all the oil off and it starts going rusty. As I was doing it, I found that the freewheel was a bit too free. The pawl wasn't engaging on the ratchet at all, wihch meant I could pedal till my legs turned blue, but no power would be transmitted to the wheels. I took the rear wheel off, and had a look. I oiled it, in case that helped, which it did, but only slightly. I was still only getting the pawl engaging intermittently.

When you're in the middle of a muddy field, six miles from the car, you don't want that sort of failure. So I decided that this wasn't anything I could fix, and took it down to the bike shop. The man there saw the problem at once. "New gears", he said; the freewheel and gears are all part of a single unit. £25 and ten seconds later, he'd fitted the replacement, and it was looking good. But he also told me that the bearings were going on the wheel, and that would need replacing in the not too distant future. But OK for now.

And while I was replacing the wheel, I noticed that the back brakes were very worn. Probably good for a little bit longer, but since I had everything in bits, I decided to replace those too.

Weight report 29

15 stone 8 pounds

The stork cometh

I have strict instructions from ladysolly to be alert all day tomorrow - she's expecting her mini iPad. I must admit, it looks like it will be a very nice thing to use.

Oundle and back

The forecast for today was cold but dry, so I went out to do 50-plus caches near Oundle. They got the cold bit right, but it wasn't quite dry.

I arrived at the parking place to find it occupied by several horses. Also horse boxes, and people dressed in a rather odd way. Later on, I heard the horns; I guess it was the unspeakable in pursuit of the inedible. Well, none of my business; I mounted my own trusty steed and pedalled away.

After a couple of miles, I encountered a guy who might have been my own age; he wanted to know if the track we were on led to Oundle, so I got my mapping out and had a look, and was able to tell him that it didn't. Unfortunately, that encounter confused me sufficiently that I missed the next cache, and, worse, used the hint for that cache on the one after it. As a result, I spent a long time looking for the wrong sort of cache in the wrong sort of place. It was only after I eventually gave up, that I realised that the next cache along wasn't actually the next one. I went back to where that cache actually was, and found it immediately, so the end result was that I still found the caches, but wasted about 20 minutes, and that was 20 minutes I could have made good use of at the end of the day; I would have finished while it was still light. Oh well.

I started at about 10:45, and it was just as well I took a head torch, because it was about 5pm by the time I got back to the car. Most of the trail was good, or at least good enough, but early on I had to push the bike across a field that was the claggy mud that stops a bike completely. After I winkled most of the mud out ... several times ... I made it across the field. Later on there was another field that looked ten times worse; I wimped out of that and walked the 200 yards to the cache, then went around via a byway to the other end of that section, and again walked 200 yards to get another cache.

Soon after that, I was on tarmac - blessed tarmac. And that took me back to the car, and by that time, the horses had all gone home, so I could find cache number 1 in peace.

While I was out, stuff for the Raspberry Pies started arriving. I now have five 4-way USB hubs, each port has an on-off switch. And there's a hole in one end where you can put in power. But it didn't come with power lumps. Never mind, I have several 5 volt power lumps, and I'll adapt those for the purpose on some of them; on others, I'll use a PC power supply and get the 5 volts off that (the red and black wires).

I also found out how to mount a samba share without putting the username and password on the command line, which is slightly insecure. You use a "credentials" file.

So far, I've got three pies up and working for their living, and the fourth is currently being set up.

Monday 3 December 2012

Pies in action

I've got three Raspberry Pies running now, doing useful work.

The first is running the Geocaching Robot Arm. The second one is watching my front garden; that replaces a full-size server that ran with an annoying high-pitched whistle, which mattered less because it was a long way away from where we usually are. But by replacing it, I reduce the noise and the power consumption.

While I was getting that up and running, I accidentally discovered gphoto. That lets you control a camera via the USB port. I have a Canon Powershot A620 that I used before mobile phone cameras got so good, and it's just been sitting around doing nothing. So I connected it up, and fumbled around for ages before I finally worked out that to put it in "PTP mode" (Picture Transfer Protocol) you press the button with the printer icon (I'd been guessing that it would be somewhere on the menus, and the manual is upstairs with my collection of manuals). Then it was easy - I can tell it to take a picture and download it to the computer, and the pictures are absolutely beautiful, massively better than the webcams I'm using for the Robot Arm. Which isn't a surprise. So all I need to do now, is dream up some use for this.

I'll think of something.

The third one, just installed, is very minimalist.

It's getting power from the USB port of another server, over a cable that came with my Nokia mobile phone, now no longer in use since I inherited ladysolly's iPhone. The SD card is just 2 gb, wihch is less than the recommended 4gb because A) I wanted to see if I could, and B) there's still 1/2 gb of spare space, and C) I had a couple of 2gb cards lying around doing nothing, and D) all the files it uses are stored on another server, which is a big brute with lots of disk space and E) all the stuff that I ordered to support the pies (USB hubs, cables, power supplies, SD cards) is somewhere between here and China, because I didn't think I'd be wanting them until the end of December. But RS components delivered early, which is nice.

I phoned them up about the missing Pi; I thouht I'd have quite a struggle with them, because how can I prove that it wasn't there? But they were nice as pie about it (couldn't resist that) and they'll be sending one along as soon as they have stock. So I'm happy about that.

I also discovered that the packaging that RS put round the pies, works well as a case; I used a hacksaw to make a small hole for the power lead and another hole for the ethernet cable, an elastic band to secure it colsed and a label on the outside to say which computer it is, and that's it; I don't need to use the USB ports, the video or the audio, for most of what I have in mind.

I plan to go out caching tomorrow; I haven't decided where yet, but the weather looks to be good.

Sunday 2 December 2012

More work on the robot arm

Today, I implemented arm locking. It's like file locking, but for arms. I'll explain.

Obviously I can't have two people trying to use the robot arm at once. One will move it up while the other moves it sideways, and so on, it'll be a mess, and no-one will get anywhere.

So I've made it so that only one person at a time can use it. Each time you make a move, a file stores
the time, and your computer's IP address. And each time you make a move, it checks to see; if it's been five minutes since the last move, then anyone can use it. But if it's less than five minutes, only the person who last moved it, can make a move.

I also changed the view-from-above. Previously, I taped the cam upside down on the shelf above the arm, and used software to invert the picture, which would have been upside-down. I've changed it; the cam is now suspended the right way up, so I don't need to invert the picture.

I've also created a kibitzer's page, so that people can look but not control the arm.

And the web server logs grow *very* fast. There's limited space on the SD card that the Pi uses, so I've used space on a disk on another computer for the logs. That is a slightly flaky thing to so, because if the other computer is down, even temporarily, the files aren't accessible. But for web logs, which i won't usually read, but will just delete, it's fine.

I think I'm nearly ready for it to go public.

Friday 30 November 2012

Alconbury again

It was very cold today; the frost on the car was thick, and so I wore a t-shirt, three sweaters and my coat. That turned out to be enough; the only part of me that got cold was my fingers when I had to take my cloves off to sign logs. Oh, and two pair of trousers, and two pair of socks. There's no such thing as "too cold", at least, not in England, there's only "not enough clothing".

North to Alconbury. First the new Coppingford circuit by Poshrule; entirely on bridleways, byways and roads, so I went round on the bike. And then Alconbury Amble - I've already done most of these, so I was just going to get some more.

Part-way round, I met Sscafe walking the other way round, the UK's number two cacher (and at the rate she's going, soon to be number one). At first, neither of us recognised the other - that was partly because we were both bundled up against the cold, and partly because I was biking along the bridleway, she was walking across the field, so she was a few dozen yards away. but when I got to the next cache, I saw that she'd signed the log today (and she saw the same at her next cache), so I phoned her, and we agreed to meet up after we'd both done our circuits.

So we sat in the relative warmth of my car and talked caching, and batteries, and more caching, and we did a couple of caches together, and then went our separate ways. I wanted to finish off "A dozen Dashes".

So I drove around for a bit, and picked up more of that series, and although there was one I couldn't find, I decided I had enough to go for the final.

My first attempt was clearly to completely the wrong place. But then I tried again, and this time I went along an excellent track, and when I got to the place I'd marked, there was a one-plank footbridge (and the hint was "troll"). But although I looked under the bridge really hard, I couldn't see anything. So I gave up and went home.

A good day out, although cold. And the Raspberry Pies had arrived in the morning, so I had that to look forward to.

Nine Pies

This morning, as I was about to leave for a day's caching, a Parcelforce van pulled up, and I was asked to sign for a parcel. On the outside of the parcel, it said "RS". That's Radiospares, or at least that what they used to be called, I think they call themselves RS Components these days.

Anyway, there's only one thing I've ordered from them recently - ten Raspberry Pies! So I signed, took them indoors, and then went out caching.

When I got back, I opened the envelope (they were each in a nice plastic case, and the whole lot in a flimsy Tyvek envelope, lined with bubblewrap. And I counted them. Nine. Oh. The delivery note inside said ten.

I think I know what happened. here's a picture of the package.

The blue splodge is me not wanting to put my address on the internet.

As you can see, it's been opened, and then closed again with a couple of strips of sticky tape. Either this happened by accident, and Parcelforce resealed it (but surely they'd have done it rather better?) Or else someone opened it on purpose and stole one of the Pies.

I'll call RS as soon as possible to tell them about this, and ask what they plan to do (although, since I signed for it, the answer is probably "nothing"). Should I have opened the package and counted the contents, given the state it was in? Probably. But I doubt if I would have, and anyhow, I'm usually not there and someone else would sign for things, and they certainly wouldn't have counted them.

Oh well. It's not that big a deal. One Pi is £20-worth, and it's not like I bought ten because that's exactly how many I needed, it was just a round number.

What is excellent, is that the delivery date was supposed to be December 18, so they're a couple of weeks early, and I was expecting them to be somewhat late, because things often are.

Of course, all the bits and bobs (SD cards, cables etc) aren't here yet - I wasn't in a hurry to get those because I wasn't expecting the Pies just yet. But I'll be able to get at least a few of them into action.

Thursday 29 November 2012

Rebooting the pi

Hmm. Is this pi stable? It's crashed a couple of times, which I don't like, I'm used to computers that keep running for years at a time.

So I've done the following.

1. I have three webcams and the Maestro servo controller all taking power from the pi. I've changed that so they connect to a powered hub, lessening the load on the pi.

2. I've made a power cycler for it. My first thought was to run the pi off the USB of another computer, and tell the other computer to cut and restore power. But it turns out that USB ports can tell devices to power off, but they can't actually cut the power. So instead, I'm using a relay, controlled by another computer (actually, I'm using the same relay box that controls the power to the lights and the servos), and I've made a little web interface for it, so from anywhere in the world I can reboot the pi. No, I'm not telling you the URL. And that works great.

3. All the things that need to start up when the pi starts, I've made happen automatically. You do that by putting commands in /etc/rc/local

I've also been having other hardware problems. A computer I use purely for multiple terminals, was singing. Actually, it was a two tone sound like emergency sirens use, only quieter. But still annoying. So I powered it off, and had a look. It turned out, there's three fans inside. The CPU fan had stuck, one case fan had stuck, and the third case fan was running, but very noisy. So I replaced all three fans.

On another computer,  the hard drive was getting a rapidly increasing number of bad sectors, so that's been swapped out. And on a third, the hard drive dropped out, so that got swapped too. What those two have in commopn, is that they're both certified Seagate repaired drives, sent to me in replacement for drives that had failed.

More bike maintenance. Battery 8 wouldn't fit on the carrier. I phoned Alien, and they suggested filing it down. So I did that; it's in a plastic molded case, and there's line standing out where the mold was. So I've filed it all flat, and sanded it, and not it fits on, albeit with quite a lot of force.

While I had the bike out, I had a look at the back brake, which had suddenly become almost useless. The cable had loosened, but when I tried to tighten it, I found that the frayed end had slipped through the holding nut, and I didn't fancy coaxing it back. So I replaced the whole brake cable, which turned out to be pretty easy to do. I put a few drops of oil inside the cable outer first, on general principles, and then the inner just slid in easily. I also adjusted the saddlebags so they fit slightly better. I'm taking the bike out again tomorrow, to Huntingdonshire.


I accidentally deleted the robot arm software on the pi. It's an easy accident to have; I typed


which will display the software on the screen.

But I'd already typed rm on the line, so the line was

rm cat

which tried to delete cat (which wasn't there), then did delete


Some days ago, when I started doing more than just a bit of tinkering on the pi, I set up a backup system. Each day, all the files on the pi are copied to another computer. So all I had to do was go to that computer and copy the file back to the pi.


A lot of people don't have backups. Or they think they do, but have no idea whatsoever how they might get back a file they've accidentally deleted.

Are you one of those people?

Wednesday 28 November 2012

The Woolley Mammoth

I noticed this one - 60 caches in ten miles, and decided to have a go.

I parked near number 48 - my plan was to do the lower section (in reverse order) because that looked mostly bikeable, and I'd be able to zoom back to the car after doing about three dozen caches; I'd also have the option of leaving the bike and doing the rest on foot, then driving to pick up the bike. So I set off.

The caches were all pretty easy, although some of them have become very wet. And the track to the second and third was over loose soil, which is the worst - the bike gets clogged up and I can't even wheel it. But I managed to get across, and then I was on bridleway, on grass. The ground was very wet and soggy, but bikeable. And after that, the terrain stayed good for almost the whole trip. And I didn't have to do any heavy lifting.

I got to Spaldwich at about 2pm; that was the point at which I had a decision to make about how to proceed. I decided to continue on the bike, which turned out to be a good choice. There was one more loose-earch stretch, but I'd picked up a useful stick to unclog with, and I promised the bike a thorough wash-down with the pressure washer (now that the terrible drought has ended etc etc) when we got home. The bike did its part well; I got through 2 1/2 batteries (I'd taken three with me, on the grounds that I'd probably need them). I did the last dozen or so in the gathering dark (using my head torch), and it was full dark by the time I got back to the car, at about 5pm. So the route, advertised as five hours, took me seven - I'm pretty slow at caching. I find that going slower means I fall over less. But it did mean a very late lunch.

And I'm very glad I didn't use that big main road on the bike - it's the A14(T) and the traffic is fierce, and there's no bike lane.

Round about number 55, I started hearing a high pitched beep, coming from the front. At first I thought, is this an error message from the bike motor I didn't know about? Or is it my phone doing something it hasn't done before. Then I came up to the source of the sound.

The vertical line you can see towards the left is an antenna. The grey thing in the foreground was what was doing the beeping. The notice says "Danger high noise levels", so I guess when it gets angry it does a bit more than the pathetic little beeps I was hearing.

A total of 67 caches today, and because I was mostly on the bike, I'm not excessively exhausted. An excellent day out.

Weight report 28

15 stone, 9 pounds

Monday 26 November 2012

Working on the robot arm

I decided to add another webcam, this one giving the view from above. So I've put a webcam upside down, sellotaped to the underside of the shelf above the arm. This, of course, means that the picture is upside down. No problem.

apt-get install imagemagick

That gives you a command line group of programs to do any image manipulation I can think it; inverting an image is easy. But it only partially installed. never mind; apt-get update, followed by apt-get install imagemagick did it. and then the image inversion is done by

mogrify  -rotate 180  -format jpg -quality 80 temp3.jpeg

And then some small mods to the page that displays the pictures, so I can get all three on.

I also noticed that the Creative cams were a *lot* more stable than the W300A cams. The images are captures better, and the images don't break up. I don't know if it's the cam itself, or the software, but I kind of don't care. I replaced the W300s with Creatives (I had a few in a box, left over from another project).

It really is good having loads of bits and bobs lying around!

I also did a bit of research following something I was talking about at the Raspberry Jam. I had a look, and it is possible to turn a Pi into a wifi hotspot. I've ordered a couple of insanely cheap wifi USB dongles, and when the rest of the pies arrive, I'll try that. Under £5 each, including postage. Cheap as chips.

But, some bad news. When I tried changing the power cable for the stepper motors to something that I thought wuold be more stable, there was blue smoke coming out of the motor that rotates the whole arm. And, sure enough ... it's blown. Bah. I'll have to replace it.

   ..... later ...

OK, I replaced it. But the replacement suffered from severe judder, so I replaced that, and now it all seems to be OK. I've ordered three more stepper motors; I'm guessing that I might have to do more replacing in future. So this time, I've got servos that are more powerful and durable, I hope.

The Pi seems to be happy with all this. It's now running three webcams and the Maestro servo controller off its USB, using an unpowered hub, so all four devices are taking their power from the Pi, without (I think) problems.

Sunday 25 November 2012

Raspberry pi jam, and a day out caching

I attended the fourth meeting of the Milton Keynes Raspberry Jam, held in Bletchley Park. It was a good meeting to go to; I had a look at projects that other people were doing, helped out slightly with a bit of linux knowledge, got a few free stepper motors and batteries, gave out a couple of free hard drives, found someone who could supply pies at the drop of a hat, with a very slim markup on the usual price (as well as lots of other very interesting bits and pieces,, told people about my own pi project, the Geocaching Robotic Arm and hooked up with smstext for the afternoons caching.

After the meeting, I toddled along to the National Museum of Computing to see the Witch, the oldest working digital computer in the world. It uses a mixture of decatrons and relays, and can multiply two numbers in only 17 seconds.

It makes a lovely whirring and clicking noise as it operates. It's wonderful that this grand old lady has been brought back into use.

Then we saw several other computers, including the Elliot 803 and 905 that I used 42 years ago, and finally on to Colossus.

Colossus wasn't what I'd call a computer, it didn't have the ability to change execution on conditions. But it's certainly a very significant ancestor of the digital electronic computer, and it's great that they've resurrected one.

Then on to caching. Since I'd hooked up with smstext, I thought we could do the MKBW Grey series, by leaving a car at each end, then walking the route. That worked well, and I was very glad I hadn't gone by bike, because at one point we had to go through water six inches deep, and at another point we had to improvise a bridge using a plank, over water that was at least 18 inches deep.

After walking that route, we then went on to do Norfolk12's new night cache, and finished with the MKBW Golden Bonus.

An excellent day out!

Saturday 24 November 2012

The return of the Geocaching Robot Arm!

I had a five-degrees-of-freedom robotic arm; you could control it over the internet, and see what you were doing via a webcam.

But the tiny PCB that interfaced it to the PC stopped working, and I couldn't find a replacement. So I archived the cache. But now!

I've found a different PCB to control it, the Pololu Micro Maestro, which I got from Hobbytronics for £15.76. It's a tiny little thing, an inch or so, but it's very nice. It will take USB (and is powered from the USB), but I can use a separate power supply for the stepper motors that power the arm.

I connected it to my desktop computer, and then started installing stuff; I think I installed .NET. I'm not sure because modern practice is to hide all the technical stuff behind a barrage of marketing-speak. I connected the Maestro to a stepper motor. I installed a USB library. And then I messed about with it a bit until suddenly, the stepper motor buzzed; it was working!

So, I powered up the computer that used to control the arm. It was a *very* old version of Linux (Red Hat 8); several years old, and it didn't use Yum. Yum is that way you install Fedora Linux software; you type "yum install whatever", and it goes and gets it and installs it for you. Payment? This is open Source; you don't pay for it, it's free.

After a while spent installing software the way we used to way back then (10 years ago), I decided, blow this for a game of soldiers, and brought another computer out, this one running Fedora 6, vintage 2006. This had yum, and was looking OK, but I couldn't make the web cam work, and some of what I wanted to use wasn't yum-installable. Then, in a flash of inspiration, I thought "Raspberry". So I powered up the Raspberry Pi. That uses apt-get to get software (this is Debian Linux) which is really just yum but a bit different. And that turned out to work like a charm. I just apt-getted (apt-got?) a few things, and the webcam worked, the Pololu Maestro worked, and the external relay box worked. And at that point, ladysolly stuck her head in and said "I hope you're not going to be running a load of noisy computers all night?" No, I'm not; the Raspberry has no fan, and it's totally silent.

You can see my thumb; that shows you how tiny the Pi is.

So, here's the way it works. The Raspberry is at the core of it all, and I'm using a USB hub to plug in two webcams and the Maestro. The Raspberry sends commands to the Maestro like "UscCmd --servo 1,6000" which tells the Maestro to move servo 1 to position 6000, and the Maestro controls the six servos that power the arm. The electrical power for the arm comes from an old PC power supply; that gives me a very steady and reliable five volts which is what the servos want.

There's two webcams, because with only one, you only get one point of view, and you're trying to position the arm in three dimensions. The second webcam helps a lot. The webcams are different; one is a very, very old cam I've been using for this sort of thing for maybe 10 years, it's a Creative webcam. The other is a Mustek Wcam 300A, a mere 7 years old, and was part of a project I did back then. You can see that the colour balances are quite different; the smaller cam is closer to reality. The interesting thing about this, though, was that both of them worked straight away, as soon as I connected them to the cam and ran the software (called 'streamer', a very simple program, which seems to work where others make me struggle to get them going).

In this picture, you can see the Maestro. It's the tiny PCB with the green and yellow LEDs.

And there's a relay box, so that the power to the arm, and the lighting, can be switched off when the arm isn't being used. I'd run that off the Raspberry too, but when I try, the power draw is to great that it crashes the Raspberry. So I've got that controlled by a different computer, and the Raspberry sends it a message when it wants to turn off the power. I've ordered a powered hub, though, and I'm hoping that if I use that, I'll be able to run the relay box off the Pi.

Still to do. I have to create a puzzle that needs to be solved in order to get access to the robot arm; that's necessary because if multiple people use it at the same time, they'll trip over each other's feet. So I need a way to thin out the access a bit. And I need to hide a cache that this will give you the coordinates for.

So, until I get the cache in place and the puzzle ready, you can play with the Geocaching Robotic Arm

Let me know if there's any problems.

Friday 23 November 2012

Water, water, everywhere

Up to Milton Keynes again - if I can get the Green bonus, then I'll have all I need for the Golden Bonus. I already have some of the Greens, so there's another 16 I can get.

First, get the bike together, and that's when I discover that my new battery, B8, can't interface with the bike. I had a similar problem with B7, I have to push it *really* hard to get it in place. With B8, it just won't go. I might have to file something down a bit.

So, on the road ... or rather, on the bridleway. The next thing I discovered is that all the rain in the last few days has made the ground really, really soft, and so biking is difficult. I started at Green 10, and worked my way along. I did Green 3, and then looked over the style. And this is what I saw.

The track goes along the hedge, straight through the flood. I decided that there was no way of knowing how deep it would get. This is the first time I've actually turned back and abandoned a planned route. I also decided that there was no way around it. And furthermore, I also felt that it would be pointless to try to approach these caches from the other end.

So, back to the car to complete what I could of the series. I also had one DNF, so that's three of the Greens not done. But I got the bonus, that's the main thing.

Where did this flood come from? It's the river Tove, which is a triburary of the Ouse. Here's what the Ouse looks like:

And to give you some idea of the depth:

That's a dog poo bin; I'm guessing that it's on the footpath along the river. It's up to its chin in water.

And here's the view on the other side:

Water as far as you can see.

So I gave up after I'd done the Greens, and went shopping in MK at Evans Cycles for knee protectors.

Wednesday 21 November 2012

Rain rain rain

I had hoped to go out today to finish the Green section of the MKBW, get the Green Bonus, and therefore the info for the Golden bonus. But the forecast was for heavy rain, and I sit here now watching the heavy rain falling, and being glad that I'm not out in it. But the sunset is in a clear sky, so I'm optimistic about tomorrow.

The bad weather means I've had a chance to think more about Raspberry Pies.

I've ordered a couple of dual-drive Sata USB docks. It occured to me that I could probably use two of them with a Pi, to get a four-drive computer; since drives are 3TB these days, that's 12TB. The power draw will be pretty low, I think. Experiments will tell me if this is practical.

I calculated my cost of electricity - it's horrendous! I'm paying something like £6000 per year to power all these computers, including the air conditioning which is needed (I know it's needed, because I left it off overnight, and the temperature climbed to 34 degrees C). So it's well worth looking at how I can get that down.

I've got 45 computers running here, each drawing about 1/2 amp at 240 volts = 120 watts. My Really Big servers, with up to 16 drives, take more like 300 watts. A Pi draws 2.5 watts. A hard drive draws about 8 watts, so a Pi plus three drives (which is about my average) would be 26 watts. But the power supply chews up some power itself, my tests indicated about 10-50 watts (quite a range). But one PC power supply can drive a lot of pies.

I looked at a 500 watt power supply. That draws 16 watts for itself and its fans. And it will supply 33 amps at 5 volts, enough for 66 pies. And 18 amps at 12 volts, enough for 27 hard drives. A 550 watt power supply takes 22 watts for itself and its fans, and supplies 45 amps at 5 volts (90 pies) and 25 amps at 12 volts (37 hard drives). Which means that I can ignore the amount that the power supply draws for itself, because it averages out at a fraction of a watt per device it's powering. And it means that another good idea will be to use two power supplies in parallel to power a batch of pies and drives; that way, if one of them fails, the systems keep running, and I can change the failing power supply without switching everything off.

So it sounds like I could cut electricity consumption by up to 75%. Maybe.

One of the things I've been doing, is combining functions. It's a rule I've often heard, one role per computer. But then you wind up running a lot of computers, all slurping down the electricity. I've eliminated three computers completely, by giving their functions to other computers that weren't doing a lot, and I'll be looking for more savings in this way, even before the pies arrive.

I've also been looking into how to back up the pies. I've done a full file-by-file backup of the SD card as it was yesterday, and I've done an image of the card (I can use that to do a very quick install of the other Pies, when they arrive). but for routine use, I want something that happens automatically.

So I've written a program that accesses the root directory of the card across the network, and backs up each directory tree from the root, looking for files that have changed (excluding /dev and .proc, of course). I'm using the program, available here - I've been using it for 15 years, and it's great. I keep three generations of backup, one that's taken on the 1st to 10th of the month, one taken on the 11th to 20th, and the third on the remaining days. That way, if something dreadful happens and the backup is corrupted, if I find out within a month, I can go back to a good copy.

Also, I had a chat with Jason - he's buying a Maplin's robot arm for his boy. That made me think of the Geocaching Robot Arm, which was very popular until the controller board died, and I couldn't find a replacement.

I had already looked into the Maplin thing, and I decided that it wouldn't be what I wanted, as it uses ordinary electric motors, not stepper motors. You can't control the arm as accurately as you can with stepper motors, and since people will be using this across the internet, with a long lag between them giving a command and seeing the result, I do need accuracy.

But it got me thinking again, and I had another look for the controller board - I still couldn't find one the same. But I did find something similar - the Pololu six-channel Micro Maestro USB servo controller,
which can control up to six channels (I need five) via USB, and it's not expensive, so I've ordered one. The Geocaching Robot Arm might get to live again!