Author Archives: Emrys

A Camera for Walking Around

I’m lucky enough to own a Nikon D7000 camera with a number of very good lenses. I use either a 20mm or 50mm lens for photographing documents with a complicated setup, mostly for family and local history projects. However, it’s not very practical for just walking-around pictures, because carrying all those lenses, and picking the right one, is just too tedious if photography is not the prime purpose of the trip.

Until now, that is.

I very much desired to solve this problem. I have an old Fuji camera which will do for walking around, but the photos are nothing like those that the D7000 can produce. And there is a fine walking-around opportunity in our near future, of which more later. So I read what everyone else has written, and bought a used Nikon AF-S DX Nikkor 18-200mm f:3.5-5.6G ED VR II Lens on eBay.

That’s a DX lens designed for a 2/3-size sensor, which the D700 has. That means it might produce better results for less money than a lens designed for a full 35mm frame, and might be lighter. It does not have the wide aperture of fixed-focal-length lenses, which means that exposure must be longer in low light. However, it does have vibration reduction, which means that longer exposure produces less motion blur. And it has a fast autofocus mechanism, great for snap shots on the street. And it has a very versatile zoom range. So the omens were good.

The lens arrived less than 24 hours after I clicked ‘pay now’. We had a trip to London planned for that afternoon, so the camera and lens came too for some first-class walking around.

We went to the British Museum. I took many pictures, but two stand out for me.

_DSC4778

 

That chap is on a very beautiful urn in the Enlightenment Room. The image processing in WordPress does not do it justice. Click on the picture for the 7Mbyte original unretouched jpeg straight from the camera. That was hand-held with available light through a glass case.

The phrase “available light” is an oxymoron when it comes to the deeper recesses of the Enlightenment Room. There isn’t any. Many of the exhibits are behind glass in unlit bookcases, very hard to make out with the naked eye. Like this exhibit:

_DSC4815cropped

Again, click the image for a better look. That one has been cropped in Photoshop and saved at a lower jpeg quality, so is only 1.8Mbytes, but otherwise it is as it came from the camera. Again, that is hand-held, available-light, though glass. The difference this time is that it was very dark, so dark that I didn’t even realise there was writing engraved until I saw the photo. The exposure was 1/10 of a second. That vibration reduction really works!

So, I am very pleased with my new lens for walking around. So much so, I had to tell you about it. For want of writing about anything useful.

 

 

What happens when a fault first appears.

Let’s consider a system – say, my car – that works perfectly when it is new. It has no design flaws. It goes on working for some considerable time, and then some part breaks. The car now has a problem, a fault, that should be repaired by replacing the broken part. But, I don’t yet know there is a fault.

firstError

In the chart, the part breaks at time A. But I don’t recognise there is a problem, because I’ve not yet noticed anything wrong. As far as I am concerned, the car is still working fine. The blue line on the chart represents this period. Eventually, though, the broken part causes an error that I can detect. In my case, the engine stopped when I expected it to be rotating. The red line represents this event, which occurred at time B, some time after time A.

I then realise that the car has a fault. However, I don’t get it fixed straight away, so the car goes on being faulty for some while – the horizontal part of the red line. I can still get the car to start, and drive it around – carefully – but I know it is broken.

In order to know that there is a fault, I need to be able to detect an error, and I won’t be able to do that until the fault is exercised to produce an error I can notice. A fault which isn’t exercised doesn’t produce any errors.

A car headlamp bulb is a good example of a fault that’s not detected until it’s exercised. The bulb can break any time, when the lamp is on or off. When the headlights are switched off, even if there is a broken bulb, there is no error. I’ll not know until I switch on the lights – of course, when it’s dark and I really need it. That’s when I exercise the fault to produce an error, the lamp not producing light when I expect it to.

Using the right words.

Problem – Error – Report

The field broken things is fully of confusing terminology. When I say something, it means precisely what I mean it to say, so here are some definitions of terms. Keep these straight and you’ll be half-way there.

I use the word problem here to mean, “The cause that made the system produce errors.”

A Problem could be

  • A Fault
    Something that is broken or worn out, that is repaired by replacing the broken part
  • An out-of-calibration event
    Something that is repaired by making an adjustment (like putting more air in a tyre if the pressure is low)
  • A design flaw
    Something that is fixed by changing the design
  • An upset
    Something that goes wrong, but isn’t evidence that the system is breaking down. The cosmic-ray-induced soft errors in computer memory are an example of an upset. Provided they don’t happen too often, we just learn to live with them.
  • and other stuff

so ‘problem’ covers all sorts of causes. We tend to give different names to the causes depending on what action we need to take to make the system work properly. But, all these different sorts of problem share the fact that they cause the system to produce errors rather than working properly.

I use the word error here very carefully, too.

An Error is

  • A signal or datum that is wrong.
    For example, low air pressure in the tyres, high temperature in the engine, zero RPM when the engine is supposed to be running.

An error is internal to the system. It might propagate within the system and cause more errors. For example, low tyre pressure might cause tyre overheating. However, we won’t notice anything is wrong (we’ll be under the misapprehension that the system is working properly) until the error is detected by some error detector and produces a report.

A Report is

  • The output of an error detector that says “There’s an error!”
    For example, the warning light that tells that the engine is overheating
  • The result of a specific test
    For example, when you measure the tyre pressure and find it is low
  • Some human error detector
    For example, you notice the smell of burning rubber.
  • Anything else that causes the procedure of diagnosis and repair to start.

Is It Fixed Yet?

This is the first in a series of posts about a calculation that worried me for years – about fifteen years. The question occurred to me when my car, a newish company car, broke. It stopped going along. Eventually it started again and I took it to the garage. They changed some parts, presented a big bill, and I drove away. Next week, the car stopped again. After a few minutes, it started. I took it back to the garage, they changed some more parts, and I paid another big bill. Next week… you get the idea. It was driving away from the garage for the third time that I wondered, “How do I work out whether the car is really repaired?” How much testing do I have to do before I trust the car again?

It took me 15 years to work out the answer. I tried collaborating with four different people, and couldn’t solve it. Then, one day, Eureka.

This all happened when I was working for Sun Microsystems, so if there is any intellectual property in the idea, it belongs to them, or now to Oracle. I don’t think a patent was ever applied for – it was in a chaotic time close to when I left Sun, and it’s not in this list. But, it’s old enough now that I don’t think anyone will mind if I publish it. I’ve never seen the result anywhere else, although I’m a bit out of touch with the field now.

The eventual result is applicable to things that break, and also new products with design flaws. It seems quite general.

Future posts here will explain the idea and (if I get my act together) present an online calculator for working out the chance that a problem has been fixed by a repair, given a pattern of test failures and passes both before and after the repair. But I haven’t written that yet.

What a wonderful thing is the mind

Our grandchildren came to stay, which was a delight. They overflowed with new toys at Christmas.

Around new year, I sat and watched Gabe, aged three, complete a jigsaw puzzle. He needed no help and finished it, to his obvious satisfaction, in about 5 minutes. It was quite a complicated little puzzle, this one from Melissa And Doug:

Melissa & Doug Farm Cube Puzzle
That picture must be copyright of their site, but since I’m being nice about the puzzle and linking to their buy-it-now page, I hope they won’t mind!

The puzzle has 16 cubes arranged as a 4 by 4 grid. Arranging the blocks correctly gives one of 6 different pictures to complete. Every block has a unique image on every face.

While Gabe was doing the puzzle, I was doing some mental arithmetic.

There are 16 cubes. Starting in the top right and moving across and down the grid, one can choose the first cube in 16 ways, the second in 15, the third in 14, … giving a total of 16 * 15 *14 * … *1, or 16! ways to arrange the cubes in the grid. That’s 20,922,789,888,000 ways! ((No, I’m not that good at mental arithmetic. Wolfram Alpha has a fine calculator for large numbers.)) 2.1*1016.

Each cube has 6 faces, and once the face is chosen, there are 4 orientations for the image, so there are 24 ways of arranging each cube in its position. So, once the cubes are positioned in the grid, there are 24 * 24 * … * 24 ways of arranging the faces without rearranging the cubes. That’s 2416 ways, 1.2*1022, or 12,116,574,790,945,106,558,976 ways.

That makes a total of 2416 * 16! ways of arranging the cubes and faces, every one of which will produce a unique total picture. There are 6 “correct” total pictures, and each of those can be presented in 4 orientations, making 24 “correct” ways of completing the puzzle. (I later watched Gabe complete the puzzle upside-down, apparently because that was more fun!)

2416 * 16! is 2.54*1035 different solutions, 253512548513181989475225528434688000.

Just 24 of those are “correct”, and 253512548513181989475225528434687976 are wrong. Just one in 10563022854715916228134397018112000, 1.06*1034 of the possible solutions is the one Gabe was looking for.

Gabe, aged three, discarded all those wrong answers and found the one he was looking for in 5 minutes.

Isn’t that wonderful?

How to hang a rising gate – in 3D!

I was looking for a way to put a true, opening gate on the web as a 3D model – I was thinking about fancy SVG. But, poking around, I tripped over Sketchfab. They provide a free service (with paid-for upgrades) to upload a 3D model and host a version of it that can be seen on a 2D browser. It took just a few minutes to sign up and upload the Sketchup gate model. I love the modern web, it provides free and easy technology that once would have been so hard. Thank you, Sketchlab!

The rising gate model can be seen, using a modern desktop browser, here. You can move around it and zoom in. In that model, there are two gates, one in the closed position, one in the fully open. I’ve actually forgotten quite what dimensions that model was designed to model, but it looks OK to me.

I’m still looking for a way of putting a real working 3D opening gate on the web, so please let me know if you find one.

Better help info

I added some 2D pictures of Sketchup models, with annotation, to try to explain how the calculator worked more clearly. It was a difficult day waiting for downloads and phone calls, so I filled in the time adding a random-woodworking-aphorism feature to the rising gate calculator. Some of the sayings are my own, and some are from here and here and here.

The source for the Rising Gate Calculator is released under an MIT licence at Github. I may be foolish for releasing it without trying to make any money, since I can’t see it anywhere else. However, I can’t imagine this technique hasn’t been familiar to every carpenter since the time of Pythagoras, so, for better or worse, it’s out there as free source, in all senses.

How to Hang a Rising Gate: the Calculator

Having struggled all day with dying laptops, dying software, a complete inability to understand VAT rules on intra-EU software downloads (except Ireland), and Adobe Creative Cloud (about which my opinions had better remain unexpressed), I have given up trying to do work and present…

The Rising Gate Calculator.

That’s a page that allows you to put in the gate dimensions and get out the required hinge offsets and angles to make the gate sit neatly, so it is vertical both when closed and when fully open.

That page still needs some extra help-features to explain just how it works, but it seems OK as far as it goes. It was vastly less work than the birthdate calculator!

Rising Gate Geometry 2 (Wonkish)

The previous post demonstrated that gate hinges should lie in a vertical plane normal to the bisector of the open and closed gate positions. Here’s the plan view of the hinges in the open position: (click for a bigger version)

gate5-1

Plan view of hinges, gate fully open

Triangles BFG and BFK, lying in the horizontal plane, are mirror images. So, length FK must be ONS

gate7-1

 

The points labelled here are exactly the same as the ones in the previous diagram. Length FK in the horizontal BFK plane is ONS, because triangle BFK and BFG are mirror images. Length KM is also ONS, because that’s how we made the spacer for the gate. Triangles AFK and AMK are therefore mirror images, because they are both right triangles, they share a hypotenuse and have side KM equal to side KF. So, angle KAF is equal to angle KAM. Let’s call this angle θ. And, call distance AF, the vertical distance between the hinges, OUD.

tan θ = KF / AF = ONS / OUD

θ = tan-1 (ONS / OUD)

Here’s how the gate looks when fully open.

gate8

 

The gate rises up at an angle 2θ from the horizontal. The effective length of the gate, JK, is OGATE + ONS.

JN / JK = sin (2θ)

Rise = JN = (OGATE + ONS) * sin (2θ)

Rise = (OGATE + ONS) * sin(2 * tan-1 (ONS / OUD))   ♦ Equation 2
Oddly, this doesn’t depend on β. Is that right?

So now I have some equations for the variables ONS and OWE. Here are the parameters fixed by the requirements of the gate design:

Symbol Meaning
OUD Vertical pitch between gate hinges
OGATE Width of gate when closed, measured from centre of top hinge pin to outside edge of gate
Rise Required Rise of gate when fully open
β Angle between gate open and gate closed

Here are the parameters I’m trying to determine:

Symbol Meaning
ONS Offset of bottom hinge parallel to the gate
OWE Outset of bottom hinge at right angles to the gate

And here are my equations:

OWE = ONS * tan (90° – β/2)                                       ♦ Equation 1, from previous post

Rise = (OGATE + ONS) * sin(2 * tan-1 (ONS / OUD))     ♦ Equation 2

I don’t actually know of a symbolic solution of (2) for ONS. Fortunately, that doesn’t stop me solving it numerically, which will come in a post real soon now.

 

Rising Gate Geometry (Wonkish)

This post is a geometry exercise to work out the hinge offsets needed to make a gate rise from its closed to open position, but sit vertical at both closed and open positions. Between closed and open, it won’t be vertical.

You shouldn’t need to understand all this post just to hang a gate. I’ll be posting a calculator for this later. Click any of these diagrams for a bigger version.

gate1

Plan view of hinges, gate fully closed.

The diagram above shows a view looking down on the top of the gatepost when the gate is closed. Point A is the top hinge pin and point B is the bottom hinge pin. The gate is exactly vertical, although B is not directly below A, because the bottom hinge includes spacers to offset the hinge. The spacers offset the Hinge ONS in the north-south direction (parallel to the gate) and OWE in the east-west direction (perpendicular to the gate).

gate2

Plan view of hinges, gate half-open

This diagram shows the gate partially open, neither open nor closed, looking from above. The bottom bar of the gate, where the bottom hinge sits, is no longer directly underneath the top bar. The gate does not sit in a vertical plane. That’s OK. Only when the gate is fully open will it lie in a vertical plane again.

gate5-1

Plan view of hinges, gate fully open

The above diagram shows the gate fully open. This gate has been designed to be fully open at an angle β to its closed position. The diagram is confusing (sorry) because it’s a vertical plan view, and the gate has risen out of a 2D plane. Points B, K and F all lie in the horizontal plane through the lower hinge pin. Points M and H are in a horizontal plane raised above the plane BKF. It’s clear that M and H lie in a horizontal plane because

  • The hinge offset MH is normal to the gate plane, and
  • The gate plane is now vertical, because we’ve designed the gate plane to be vertical when the gate is open to an angle β

The line MH has a length OWE when the gate is closed and MH is horizontal in the same plane as hinge pin B. MH is again horizontal with the gate open to angle β, so again the projection of line MH on the horizontal plane containing points BKF still has length OWE.

The projection of the line MH in the plane BKF is at right angles to the intersection of the vertical gate plane and BKF. This is true however much the gate rotates in the vertical plane containing F and J, because MH is normal to the gate plane. So, line KB, parallel to MH but in the horizontal plane BKF, is at right angles to line FK, and also has length OWE.

Triangles BFG and BFK are mirror images, because are both right triangles, they share a hypotenuse and side BG is the same length as BK. So, angle BFK is the same as angle BFG – let’s call this α.

Point G, F and L lie on a straight line:

βαα = 180°

α = 90° – β/2

or, in other words, the vertical plane containing the hinges must lie at a right angle to the vertical plane containing the bisector of the angle between the open and closed gate positions.

Or, in yet other words:

  • Draw a line midway between the open and closed position of the gate
  • Draw a line through the top hinge, at right angles to that line
  • The bottom hinge must lie somewhere on that line
  • and the further you move it out from under the top hinge, the more the gate will rise
    but the gate will always be in a vertical plane when full open.

And, equivalently,

OWE / ONS = tan α

OWE = ONS * tan (90° – β/2)   ♦ Equation 1

 

How to hang a rising gate: 2

This is the sort of gate I usually think about, although the same method applies to any sort of hinged mechanism.

5 bar field gate 3a

That’s a picture of a Sketchup model made from a hinge by Matthew Miller and a gate by Adam J. Having fooled around with Sketchup for a couple of hours, I did wonder if it would have been easier to go outside and find a real gate. But, I got there in the end.

With the gate in its closed and latched position, everything is true and square. Here’s a picture of the hinged end of the gate, without its gatepost. The top hinge is directly above the bottom one, so this gate will open level, not rising.

5 bar field gate 3d

The surfaces marked “horizontal” and “vertical” in the picture are, not surprisingly, vertical and horizontal. This is true for ordinary gates and for rising gates too.

Here is the gate modified to make it rising.

5 bar field gate 4bclick the picture to enlarge

The gate hasn’t moved 1mm from the previous picture. Only the bottom hinge has moved. I added the white spacer screwed to the gate, and I drilled a different hole in the gatepost to match. The whole bottom hinge has moved out and left compared to the previous picture. But the gatepost is still vertical and the gate is still all vertical. Because of the slight offset of the hinges, they should be twisted a little so pins of the two hinges line up exactly straight (but tilted). However, this sort of gate hinge is usually made very loose, and the hinges work fine with the hinges out of line. If I’m being very pedantic, I twist everything to line up precisely. I find that easier to do with a power drill in my hand than I do with Sketchup 🙁

As a reminder from the previous blog post, what I’m trying to avoid with this design is this:

5 bar field gate 4d

 

This picture shows how the gate skews as it opens and doesn’t sit vertical. I want the gate to be vertical both in the closed position and the open position.

Now, the real trick is to understand how much the bottom hinge has to move out and move left for any particular gate. That will be the subject of the next post.