2021-11-28

More on Highway Code (Abergavenny)

I had a very interesting debate on FaceBook over this. So I thought it worthy of a blog post.

[Update: Whilst I don't think this is in any way a grey area, the new Highway Code rules from Jan 2022 make this way more clear with rules about giving way entering or leaving a side road when someone is crossing, or waiting to cross]

This is a junction in Abergavenny that I walk across every day on my way to town. I walk both ways, but frequently (maybe once a week) someone turning in to the side road will drive at me whilst I am crossing. They are usually not in sight when I started to cross, sometimes they are and waiting on traffic when I start to cross. But the rules are really clear, if I have started to cross then they have to give way to me. Oddly, even though I have no trouble with zebra crossings (everyone is really polite and stops even if I have not started to cross), they get annoyed that they have to stop for me, for some reason. Some very annoyed, stopping, getting out of the car, shouting, etc. It is crazy!

Just to be clear, I also have a lot of cases of drivers being sensible, waiting for me to cross, no annoyance, very civil and safe. Thank you - most of the people of Abergavenny are very civil and polite.

The debate came up because of the "island" in the road. This was not something I had considered an issue. Walking in direction shown, I am crossing a road, and get to the island in the "middle", and a car approaching expects me to stop for some reason. The question being should I stop? or should I expect them to give way as I started to cross the road some time before and am still crossing, so I have priority. To be clear, I always try to make eye contact and try to avoid getting run over (so far with success) - I even wear hi-vis on many occasions.

What are the rules?

The rules are all in the Highway Code, and even though many of these are just advice, and recommendations, and even some that are clear rules are not "laws", they do define how we all use the road together and if followed they help ensure things work smoothly. At the end of the day, the rules can say which of us was right and which was wrong in a case such as this where the car driver has to stop for a pedestrian that is crossing.

  • Rule 170: "watch out for pedestrians crossing a road into which you are turning. If they have started to cross they have priority, so give way"
  • Rule 8: "At a junction. When crossing the road, look out for traffic turning into the road, especially from behind you. If you have started crossing and traffic wants to turn into the road, you have priority and they should give way (see Rule 170)."

So that is pretty clear, both for a driver and a pedestrian, if you have started to cross (just like a zebra crossing) cars have to give way.

So where does the island come in?

The confusion comes about because of rule 20: "Where there is an island in the middle of a zebra crossing, wait on the island and follow Rule 19 before you cross the second half of the road – it is a separate crossing."

This makes it clear that where there is an island in a zebra crossing, each half of the road is a "separate crossing". So "starting to cross" the crossing (not the road) is not automatically priority over cars for the other "crossing" on the other half of the road.

However, rule 30 is not the same: "Where there are no controlled crossing points available it is advisable to cross where there is an island in the middle of the road. Use the Green Cross Code (see Rule 7) to cross to the island and then stop and use it again to cross the second half of the road."

Both rules make it clear that the road may have two halves, but unlike rule 20, this rule does not say that makes it two separate "crossings" or "roads". Rules 8 and 170 talk of having priority once you have started to cross "the road" or "a road", not "a half of a road" or "a part of a road" or even a "crossing".

So, to me, rule 30 actually clarifies the this is not like a zebra crossing, it is one road, and starting to cross it at all gives the pedestrian priority. As such, when getting to the middle of the road, island or not, they still have priority, and so can reasonably expect the cars turning in to the road to give way as required by rule 170.

The island makes no difference in a side road, even though it does for a zebra crossing. Otherwise the rules are almost the same. Notably a zebra crossing would have a much more serious "island" with the orange globe lights in the middle of the road. For a side road it can be little more that something to support a keep left sign, such as the above. So sort of makes sense.

Just to be clear, the same problem happens when going the other way, where the island is not relevant, and on side roads with no island, but they are not used as much and hence it is much rarer.

Why are people even mentioning the island?

I was also surprised that the whole issue of the island came up. I think people are reading rule 30 and saying that because the pedestrian crosses to the island, stops, and then crosses to the other side of the road, the stopping means they have stopped crossing the road, and start again afterwards, so while stopped they don't have priority. I think that is what people are saying. That may have some validity.

But even if that is how rule 30 can be read, the second someone takes a step from the island they have priority anyway, so in practice cars have to expect to have to give way.

Also, rule 30 is "advice" to pedestrians only. If a pedestrian does not take the advice and crosses where there is no island, and so does not "stop", then the priority clearly starts when they start crossing (the first half of) the road all the way to the other side. Again, cars have to expect to give way to the pedestrian.

Similarly if they decide to only take part of the "advice", cross where there is an island, but do not choose to do the "stop" part. Rule 30 is only advice.

This particular crossing has two small "islands", one in front of the other, holding street furniture, and a gap between them. The gap actually looks placed for pedestrians crossing, and as the islands have no dropped kerb, the gap is the route anyone with any sort of biggie would take, so in practice I am never crossing to the island and stopping.

Does any of this matter?

Drivers and pedestrians have to be careful, and the rules help them know what to expect. If they reach a different conclusion then that can, obviously, lead to an incident. So it is important that they both come to the same conclusion, that is why it matters. It also helps resolve who was "wrong" if there is an incident (which is no consolation if the pedestrian is squished). Both have to be very careful to avoid any squishing being involved. Understanding the rules clearly helps with that.

The good news is that the Highway Code is being changed to make it so you have to give way to someone "about to cross" the road (side road or zebra crossing). Once that change is in place the whole question of the island is moot, as someone on the island in the middle of a side road is clearly about to cross the "second half of the road" and so a car has to give way anyway, even if they consider somehow each side of the road to be a separate road for the purposes of rule 8 and 170.

Conclusion?

I had no idea that there would be a debate over the "island", or that there was any ambiguity or confusion over this. As above, it seemed clear to me, so interesting. This makes the changes that are coming to the rules a welcome clarification as it will cover giving way to someone waiting to cross even if they are on an island in the middle of the road.

Even now, before the change, motorists need to basically give way to anyone crossing a side road as if a zebra crossing was there - they already cope if crossing cars coming the other way - but the rules are changing to make this even clearer. Pedestrians are king when crossing a side road...

P.S. given the confusion caused by the "island", which is all pretty irrelevant, I wish I had started with this image, which also is a cause of problems on that junction.

2021-11-20

ESP8266 vs ESP32

When I started using the Espressif processors I started with the ESP8266 and Arduino development platform. It is all C++ based (which is not really my favourite). But it is a really good starting point for anyone wanting to play around with microcontrollers.

One of the key things here is the available hardware. A "programming" lead is just a USB serial which is available for a few pounds, The Arduino development platform is free to download. But most importantly there are thousands of very cheap ESP8266 based devices on the market, easy to use, and many easy to access programming pins. The ESP8266 is possibly the most popular basis for IoT (Internet of Things) devices like smart light switches and the like.

However, having managed to make some PCBs (milled from copper boards) for ESP8266 based modules, I eventually decided to move on to using the ESP32. It had a number of advantages as a processor itself, but also the ESP IDF which works on linux and MacOS making it easy for me to code in C, which I prefer. The ESP IDF and various libraries are still a work in progress and far from perfect, but generally work well. I have made a load of projects based on ESP32.

But being ESP32 means I lack the thousands of ready made modules that I can use. I have designed and made loads of circuit boards myself, including a complete access control and alarm system.

What is now nice to see if that there are finally some ESP32 IoT devices coming out. Manufacturers are moving to ESP32 based boards. One of the most useful I have found is the Shelly 1. What is especially nice is it has direct pins for programming access - without even taking apart. It is simple, just a switch input and a relay output, but runs of mains, or 12V DC (do not use the GPIO pins when running on mains as they are live).

Shelly have just launched the Shelly plus 1, which is basically the same as the ESP8266 based Shelly 1 device, but ESP32 based. It also has programming pins easily accessible (though smaller), a relay and switch input. In this case the 12V is a screw terminal rather than a link you have to change.

The good news though is I can load my own code, ESP IDF based, on to this. It means I can use these modules directly on, say, my access control and alarm system. I had found I needed various simple 12V single input modules for the likes of a door contact or fire alarm input and previous used boards I made. But at this low price the Shelly plus 1 is a no brainer, as they say. Using my code I can set secure boot, and encrypted communications as part of the alarm system. Even something simple like an alarm bell could use one (single output for bell and single input for tamper).

My first actual project with one of these is for a servant bell system. I have an actual bell, which I want to "ding". I am using 12V DC, but the bell really only "rings" using AC. Using DC you need a small pulse to do a clean "ding". Too short and the clanger does not hit the bell. Too long and it hits it and holds, making more of a "clunk" than a "ding. Get it right and you get a nice clean "ding".

I was using tasmota32 code for this, but that is designed to do pulses of 200ms at least and not that consistent - perfect for blinking lights and the like, but no good for what I need.

So, back to my own code, ESP IDF based, using my existing libraries, and I am now starting something a bit like my own tasmota in a way - programmable inputs and outputs. Expect the outputs (which is all I have coded so far) are configurable to the millisecond.

I have found 15ms seems to be the sweet spot to make the bell ding...

2021-11-18

No, we don't have servants

But if we did, we'd need one of these beauties.

Well, the plan is to make this work for a friend of mine.

Believe it or not, it is "electric". With bare wires nailed to a board, and coils! With a bit of cleaning up and soldering, I have all the coils working.

With a bit of experimentation I could see how to drive this. I think I can even use what remains of the original wires which go round the back where they were just cut off. Basically the coils pull the swinging indicator, and on release it is left swinging back and forth. Oddly there is no sort of sounder, so I wonder how it worked to get people's attention. I'm planning an additional bell.

So, how to drive it - well it looks like a suitable resistor will allow it to work quite easily on a 12V supply, with a back EMF diode.

Relay board

One simple solution is an off the shelf relay board. Like I used for my DEFCON lights. One small snag is that they come with 8 relays and this needs 9 (10 if you include the bell).

Definitely a possibility though.

Custom board

Another simple enough idea is I make a relay board with 10 outputs. PCBTrain can turn these around in a day, and it may be a nice useful board design. I'm in two minds whether to use a relay, a solid state relay, or a driver (that drives 0V/12V). All could handle the approx 1A needed, especially as it would be a short pulse. I need to think about the other uses of these as part of the design, obviously.

The drivers are nice in that they take a lot less space, but are not as flexible as they drive the output rather than simply being an effective relay contact.

I also have to think how I make one of these - as almost all the chips I would use are on something like a year lead time! Thankfully I have several solid state relays and several driver chips in stock, and enough power supplies.

I could, of course, take the opportunity to consider using the newer ESP32-S2 modules, which seem to be available. This would all make this more of an R&D project, which is not a bad idea.

It would all take time though, and I am quite keen to have this ready for Christmas.

Shelly

There is, of course, a simple answer, and ironically likely to be the cheapest, and that is just use a Shelly1 relay module. Even needing 10 of them is not expensive, and there is space on the back of this thing. They are available and in stock for next day.

This does feel like cheating somewhat but may be the best option. Certainly worth prototyping with one of them to start with.

Then what?

One way or another I'll end up with WiFi connected indicators. So we need a way for that to work from places around the house. Buttons, or a pull cord, etc.

For this, by far the simplest is the Shelly option, as a light switch, sending an MQTT message when pressed.

P.S. Blogger is broken again, even with clearing caches, and so I cannot actually reply to comments!

P.P.S. I went with Shelly Plus 1, but my own code...

2021-11-14

Carbon cycle

I am pretty sure I did cover this in school, but I did not quite appreciate how significant it is.

One if the things that always gets me is the EXACT amount of CO₂ pulled from the atmosphere by a plant for it to grow, that I then eat, is the exact amount of CO₂ I then breath out from burning it (unless I use some of that carbon to get fatter, then that is released when one day I am cremated or eaten by bacteria). And the O₂ that is made by the plant growing is also the EXACT amount I need to use to breath to burn that plant and consume it. OK some of that goes in to poop that is used (O₂) and released (CO₂) when that is digested by bacteria. But the CO₂ is the same. It goes around in circles. The circle is complete. It works.

The carbon cycle is all about how carbon moves around in the world. Wikipedia has this the cool image.

So how to stop climate change? - it is so so simple - stop burning old carbon (i.e. fossil fuels).

It is fine to grow trees, make wood, and burn that, the carbon goes round and round.

It is fine to grow food, eat it, and breath out, the carbon goes round and round.

AFAIK cows farting is an issue, as that carbon ends up as methane with has a bigger impact, but AFAIK for less time, and apparently the answer there is feeding the cows seaweed! But generally using carbon to grow food to feed and animal that we then eat and breath out is again OK, carbon goes round and round.

Don't get me wrong, loads of other issues, too many cars and not enough walking and cycling, all sorts, but just looking at climate change, it is all down to the carbon. We'll improve a lot of other stuff by fixing the climate change issues as a side effect!

Almost anything we do with "recently" captured carbon then going to the atmosphere matters not a jot. Pull carbon from atmosphere and release it a year later - not problem. What matters is all that old carbon in fossil fuels being burned. Unless we want an atmosphere that was around a few million years ago, we need to stop.

Even all the "indirect" stuff, like carbon cost of manufacturing and transport, only matter when those processes use fossil fuels directly or indirectly. Make those processes use electricity or hydrogen from green supplies (not from fossil fuels) and they all end up carbon neutral.

The one thing, and this really is the one thing, that matters, is burning old carbon. Stuff pulled from the atmosphere millions of years ago and stuffed in the ground. Burning fossil fuels. That is what matters. That is what needs to stop. It really is as simple as that!

Heck, even making fossil fuels in to plastic which we don't burn, is not an issue! What matters is old carbon going to the atmosphere - STOP IT!

Blockchain is not the answer

Often people come up with some idea and think "blockchain" is the way to do it.

In pretty much all cases the answer is "NO!", or more often "Hell, NO", seriously. In a lot of cases the thing people are doing is something which can be, or already is, done by a central authority registry. Don't get me wrong, even a central registry may "sign" things digitally, and have signatures or signatures in a block chain style, but that is not what people mean when they talk of putting things on "blockchain".

Blockchain, as most people mean it, has some serious disadvantages too - and I mean using blockchain like the way crypto currencies are used - it means explicitly removing any central "authority". It means if you lose keys to your wallet you have lost what you "own" and no way to recover that ever. E.g. people have somehow suggested this should work for domain ownership, which is batshit insane IMHO - far better as a central authority (per top level domain), and allows the authority to resolve disputes even, and recover "lost" creds, and so on.

But hear my out - I have an idea - a sort of "ownership" which could maybe benefit from not having a central authority.

Buying a movie!

One of the things one can "buy" which is a tad on the intangible side is "a single copy of some copyright work". E.g. if I buy a movie. Once upon a time that meant I buy a physical media copy of it. You can still do this even. And you can give or sell that copy to someone else even. That instance of a copy of the movie is something that can be moved between owners as the physical object that it is.

The whole of copyright law is around the notion of "copying" a thing, so the physical copy is the key aspect here. That is all rather outdated now as copying is so basic and simple and free for data. The right more rightly exists for something like a movie in a right for me to watch that movie, not any sort of "copy" process.

However, we now live in a world where I "buy" a movie on something like Apple TV. Now this is a lot less tangible, and is more of a "licence" to "play out that movie" from "Apple TV" data storage via any of my many Apple devices.

That does not feel as useful as holding a DVD in my hand which I own. If Apple TV stopped, I could lose tens of thousands of pounds worth of video library that, in theory, I "own".

Obviously there could be some digitally signed licence of ownership of a copy, signed by the copyright holder's published public key, and identifying me. But identifying me is tricky in itself - email address? name? what? What if that ID changes?

I'm thinking this is where blockchain comes in. If a licence to own and instance of a copyright work can be created on the blockchain as owned by my digital wallet, and signed by copyright holder, then I can present that as proof to AppleTV or someone else, that has streaming services. That would provide proof that they are allowed to stream that copyright media to me. I'd have to use my wallet to sign in somehow to prove it is me, which adds to the complexity, but it identifies "me" in this context.

But it would also allow me to sell my copy to someone else if I wanted to.

It would allow for a provider that sold me the copies in the first place to go bust and I would still hold my digital wallet proving these copies are mine and I could take that to some other streamer service, even if for a nominal fee to load them on to their system.

Any such system would have to be wrapped in consumer friendly UI. It could even be a bit "behind the scenes", in that Apple could effectively manage my wallet of things purchased via them - as long as I can always obtain, and take over that wallet and legally I own it - maybe it could "live" in my apple devices that I own as a fallback, locked with my AppleID passphrase. But it could work

It would almost certainly be impossible as it would require co-operation of copyright holders, and streaming services, and the like, and possibly even legal backing. It may mean streaming services separately "sell" copyright works, and provide streaming of them for some ongoing subscription so if you come to them with your "owned" works they are not losing out.

But I think as a commercial and legal model it could, in theory, work.

I also think there is no chance of it happening :-)

FB9000

I know techies follow this, so I thought it was worth posting and explaining... The FB9000 is the latest FireBrick. It is the "ISP...