Monday, 5 June 2017

We Need to Talk About Tolerance

This post has been brewing for a while in my drafts folder, but with the announcement of the General Election, I thought it time to air it. The atrocity in Manchester gave me pause for thought but the [ironic] pronouncements by Theresa May of the last few days cannot be ignored.

The UK has always been thought of as a tolerant society. And we are. Or rather we were. To understand why this has changed, we need to explore why we were regarded as a welcoming haven for citizens of the world.

I have worked in many, many organisations both large and small. Just like countries, the culture of a business is influenced by its history, processes, geography, environment and even its products.

But note what is missing: Employees.

Why? Because most of the people in an organisation are led.  Founders and leaders all too often recruit in their own image, seeking out those with a shared vision to build a company. While the general culture of an organisation is influenced by many things, including the diversity of employees, the ethical culture is driven from the top.

The same is true for countries. The people of many nations have been duped into following despots, collectively convinced they are on the right side of history.

There are many who would not admit it, but we like being led. Its easy, comfortable, secure. We're part of the 'in' crowd if we follow a popular (or populist) leader. We get to slide the blame to those who don't follow. We no longer have to shoulder the responsibility. And yes, there are parallels in religion too.

UK became a tolerant society because of our choice of leaders. Post war, too many had seen the horrors first hand. We chose leaders who offered hope, who had the courage to offer something that would benefit all.

We undertook one of the greatest endeavours in history: the creation of the NHS. We created a safety net for the most vulnerable in society, those who dropped out of the bottom would be caught and helped. Equality for (or rather, fair treatment of) all eventually became enshrined in law.

Immigration helped make the UK a very attractive proposition for external investment. Our economy benefited, our society was enhanced.

As memories faded and a majority become collectively more comfortable, we have started voting for leaders who will benefit us individually, rather than society as a whole.

Political, media and business leaders have been quick to seize on this, setting policies that appeal to the low hanging votes - lower taxes, 'efficiency' savings, out group blaming.

We tolerate the appalling treatment of the vulnerable in society because we're told to by political 'leaders' and media. If policies do not (appear to) directly affect us or our families, it's not 'our problem', because we're told it's someone else's fault.

We're told the NHS is 'over budget' and overwhelmed by an immigrant population but NHS funding has been slashed since 2010 and much has been redirected to private profit. Immigrants make up a huge proportion of NHS staff and make a greater financial contribution to the economy per head than native born.

We tolerate 40,000 deaths from air pollution per year as 'a cost of doing business'. Each and every one of those 40,000 people will have suffered for years, even decades, before succumbing. Transport contributes significantly to air pollution, particularly in urban areas, yet we are told it is 'aspirational' to own a highly polluting futility vehicle.

Yet we can't talk about it because we're told it is 'none of our business' how an individual spends their money. It is.


We tolerate the removal of £135 per household 'renewable subsidy' because we're told it will reduce our bills. Conveniently omitted is the £440 per man, woman and child we each pay to subsidise the fossil fuel industry. Why do we quietly tolerate this?


We tolerate the hatemongering of politicians and media because we're told 'all opinions are equal'. UK tabloid media front pages spew bile daily, but we buy them without shame.

On mainstream radio, LBC promote the poisonous rhetoric of Farage. The BBC's Jeremy Vine provides false 'balance' to life long experts in their field with 'the loud man from the pub' ranting unsubstantiated bile over the phone. Each are given equal air time and equal credence.

The most popular media outlets are those that give voice to those who wish to promote their particular target of intolerance. We have normalised the hatred of others with the repeated lies on every front cover or news bulletin. Traffic reports dare not speak of the nature of a progressive march yet we'll invite hatemongers onto prime time TV and radio.

We are being led away from our culturally progressive international partners toward regressive regimes in vain attempt to mitigate the unfolding disaster of Brexit and the Great Repeal Con.

The irony of holding 'liberal values' (really just being kind to those less fortunate) is that we remain all too silent while those who hate are given every platform to spread their vitriol. We often won't talk about our values for fear of offending our friends and colleagues.

To be able to choose leaders that promote tolerance, not those who seek to gain from division, we need to be unafraid to offend those who vote for or promote regressive policies.

"The only thing I can't tolerate is intolerance" is a great maxim, but useless if we're afraid to talk about the things that harm our society.

If you believe that UK should restore its liberal, open values, we need to talk. To friends, neighbours, colleagues, family and strangers. We have to drown out the torrents of hate that flow from the front pages and mouths of weak politicians.

History has proven silence to be a poor choice.

#BeCarefulWhatYouVoteFor

Monday, 23 January 2017

Define Success

A question posed by Katja Leyendecker (@KatsDekker) this morning:

Serious question.



...to which I replied "8-80".

This may seem like a slightly flippant response to the serious question, but it certainly wasn't intended as such. Follow up replies from Katja quickly clarified this was as much about measuring on-going success as much as outcomes. Hard to grasp and define...

And therein lies the problem. Each cycling advocacy group will have a different measure of success. For example, some of my local group are very proud of the number of children trained. This is a valid measure, but I haven't seen an increase in the number of bicycles chained up at school (anecdote klaxon).

Other than perhaps, cycle counts, we have no national standard that can be used by local advocacy groups to measure their success (or effectiveness of their campaigning) against an objective target.

The measure of the success of any campaign can only really be measured by its outcomes. Objectively measuring ongoing progress towards an outcome is a little more challenging. We have had decades of political 'encouraging' rather than 'enabling', so perhaps it's time to start measuring success by who has been enabled.

8-80 (#8to80) is not a new concept (e.g. this, from David Hembrow (@DavidHembrow) in 2011). It is clearly the standard to aspire to for all urban transport infrastructure but may also be a useful way of consistently measuring effectiveness of campaigning and the implemented schemes.

Towns and cities are ever evolving, but schools, shopping centres, stations and industrial areas tend to remain fairly static. Routes to and from these destinations are like the most trafficked. They are frequently surveyed by LAs for start/destination of motor traffic use, but rarely (I have never been questioned) when walking or cycling. We have some counts of existing cyclists, but have little data on those who are not using these routes.

How onerous would it be to annually count those who are not cycling these routes?

Getting data at the lower end of the 8-80 could be done via (PTAs at) schools - to parents: "Would you (do you) allow your eight-year-old child to cycle from [home|school|town]  to [school|town|home] unaccompanied by an adult".

Data for the upper end could be also gathered in this way ("Would you allow/encourage/discourage your childs grandparent to cycle from home to town?"), as well as for intermediate ages.

The collated data would give a consistent picture across the country. It will allow advocacy groups to compare apples with apples and provide on-going success markers.

TL;DR:
A year on year decrease in those not cycling at the two extremes of the 8-80 range is the surest measure of how successful the advocacy has been.

Of course all this may be already happening... but then why would Katja be asking the question?





Monday, 16 January 2017

Nearmiss-o-meter Build Guide, Part 2

Build Guide, Part 2

This part of the build guide uses the switch PCB design available here on GitHub. As with the main board, it is possible to replicate the circuit design using a pegboard.

The Switch PCB
Clean Up the PCB

When the boards are manufactured, they often have small 'nibs' left on the edges (circled red). Carefully break these off with a small pair of pliers and use a file to remove the remnants. If you're using the 3D printed switch case, make sure all edges are cleaned up.

Click on the picture for an enlarged view.


Molex Connectors and Ribbon Cable
Solder Molex Connectors to Ribbon Cable 

If you've soldering the cable directly to the main board PCB, you can skip this step.

The Molex connectors are designed to be crimped, but the crimping tools are absurdly expensive, so a small dab of solder and manual crimping will have to suffice.

I've temporarily mounted the four individual connectors onto a spare PCB header which helps solder the ribbon cable a little more accurately. Make sure the 'barbs' (arrowed) are all facing up.

The red marking on the ribbon cable I've used denotes the switch wire. The opposite side ins the ground and the centre two are for the LEDs

UPDATE: Thanks to Paul for this crimping tool recommendation - much, much easier (and more secure) than soldering all for less than a tenth of the price (£23) of the official Molex ones.

Molex Plug

Insert Connectors into Molex Plug

Once soldered, crimp the connectors over the cable insulation and then push into the Molex plug casing, ensuring the barbs locate in the square holes (arrowed).


Switch on PCB

Solder the Momentary Switch to PCB

Straighten the switch legs and splay them out slightly. This will allow the switch body to sit directly onto the PCB.

Solder the legs from the back, ensuring the switch doesn't 'pop-up', then cut off any excess.




LEDs on PCB

Solder the LEDs to PCB

Mount the LEDs tight to the PCB. Note the positive tails (arrowed, slightly longer) and both to the inside.

Solder from the back and then cut off the tails.





Ribbon Cable, Switch End

Cut the Ribbon Cable


Cut the ribbon cable to the required length (this will depend where you mount the switch relative to the nearmiss-o-meter on the bike - I've cut to approximately 280mm long).

Leave the switch wire (red stripe on my build) about 10mm longer than the other three.

Solder the Ribbon Cable to Switch PCB

Tin the ends of the wires an push through the PCB from the top. Double check the routing from plug to PCB is as per the photograph, solder from the back and snip off any excess.

That's it!

Next up, the Arduino code and case fitting.

Friday, 13 January 2017

Nearmiss-o-meter, Build Guide, Part 1

Build Guide, Part 1

This part of the build guide uses the PCB design available here on GitHub. It is possible to replicate the circuit design using a pegboard, but I wouldn't recommend it.

The list of parts I have used is available here.


Nib Removal

Clean Up the PCB

When the boards are manufactured, they often have small 'nibs' left on the edges (circled red). Carefully break these off with a small pair of pliers and use a file to remove the remnants.

Click on the picture for an enlarged view.


Sonar Bridging

Solder the Sonar Bridges

There are two bridging pads on the PCB to allow the use of the US-100 or the MaxSonar (not yet tested).

The photograph shows where I have bridged with a short length of wire for the US-100 sonar.





Cut the Header Pins
Female Header Pins Cut Into Groups

We are using round low profile header pins to install the Feather M0, partially because this is an expensive (and reusable) component, but also because we need to remove the Feather to solder other components onto the PCB.

Using a sharp knife, cut both male and female header pins into five pairs and three singles.



Male Header Pins Before Cutting
- Note Orientation

Solder Header Pins into the Feather M0

Note the male header pins have a top and a bottom. The flat face (shown in the top pair in the photograph) seats against the Feather.






Solder Headers Using
A Breadboard
Use a breadboard to hold the sockets and pins vertically as you solder the pins into the Feather.  Note: the photograph shows extra pins (9 and A0) on my board - these are just remnants of previous incarnations.

Solder pins to: BAT, EN, 11, 10, 6 , 5, 3V, GND, A2, A3, A5, RX and TX.





Solder from bottom of PCB

Solder the Header Sockets onto PCB

With the header sockets still attached to the Feather M0, solder them from the bottom of the PCB.

Once soldered, cut the pins back as tightly as possible, particularly the three nearest to the Sonar, the ones in front of the Molex and the one connected to the BAT pin. It may be better to cut these pins flush with the PCB before soldering -they must protrude no more than 0.5mm.

Header Pins for Feather
Note the Feather will be off centre - this is to allow the SD card to project into the case side wall.

Again, ignore the extra pins on my board!

The top of the PCB should now look like this.





Resistors R1 and R2

Solder LED and LDR Resistors/Jumpers

The LDR (R1) and the blue LED (R2) resistors are soldered onto the bottom of the PCB and the red (R3) and green (R4) resistors are soldered to the top.

I am using a 100KOhm resistor for the LDR and insulated jumpers wires for the LEDs as they are rated for 3.3volts.



Resistors R3 and R4
Make sure the tails of R3 and R4 are cut as flush as possible to the PCB so the Molex socket can sit flat. Once cut off, you can push them back with the soldering iron as there is plenty of space above - or as above, cut them flush before soldering.






Molex Socket and Switch

Solder Molex Socket and Toggle Switch

These are soldered onto the bottom of the PCB. Try to ensure they both sit as flat and square as possible.

Note: Both of these need to be tight to the PCB, but make sure there is plenty of clearance between the toggle switch and the 3V header pin before soldering.




Blue LED

Solder the Blue LED to PCB

This is the (optional) indicator of a near miss - also used to sanity check.

Bend the lens to 90°, ensuring the correct orientation of the positive and negative legs. The positive leg (on the right with the lens facing you) need to be covered with a short length of insulation.

Solder to the PCB and cut any excess short as usual.


GPS Module Headers

Solder GPS Headers

Use the breadboard to solder the headers to the GPS PCB with the uBlox module face down. These are standard square headers that are normally supplied with the GPS module.

Try to keep the PCB as square as possible.







GPS Antennae

Attach the GPS Antennae

A small piece of double sided sticky tape, or a very thin blob of bluetac will hold well enough.

Note the routing of the antennae wire.






GPS Soldered to PCB

Solder the GPS to PCB

Solder the PCB module onto the top of the PCB, again ensuring it is as straight as possible.

Cut the header pins as short as possible, either before or after soldering.




US-100 Sonar Position

Solder the US-100 Sonar to the PCB


The sonar mounts on the underside of the PCB. It should align evenly on each side of the PCB (it is slightly narrower).


Make sure the sonar PCB (green) is no more than ~0.5mm from the main PCB (purple).



Sonar Soldered from Top
Solder the pins shown in the top view here (only four of the five pins need to be soldered).

While soldering, make sure the sonar PCB remains perpendicular and parallel (~0.5mm) to the main PCB. Solder a pin at one end, check alignment, then solder the pin at the opposite end and re-check. Do not solder the remaining two pins until you are sure the alignment is spot on.



Battery Fly lead and LDR Position

Solder the LDR and Battery Fly Lead to PCB

If you have already printed a 'snorkel', use this to position the LDR facing the side of the snorkel, otherwise just leave a small gap between the LDR and the sonar. It is a little difficult to see, but the LDR is no the right hand corner of the PCB in the photo.

The battery fly leads only need to be ~25mm long. Once soldered in, use a hot glue gun (on the PCB/wire junction) to provide some support (not shown in photo).


The next post will detail the switch build.

Tuesday, 10 January 2017

Nearmiss-o-meter, Bill of Materials

Bill of Materials (BoM)

Apologies for the delay since the last nearmiss-o-meter post. Sometimes life throws you higher priorities than the side project you happen to be working on...

These are the items I have used to build a near-miss-o-meter (version 04). Prices are approximate and primarily from UK suppliers. You may be able to buy cheaper directly from China/US.

I have not provided direct links for some suppliers (e.g. eBay) because the items seem to change so rapidly. If you search for the title or quoted description it should return the correct items. Where I've used 'standard' components, I've linked to the the appropriate manufacturer or supplier.

I've tried to brush up on my old photographic knowledge, so a click on the images should provide a higher resolution version.


Adafruit Feather M0

Adafruit Feather M0 Adalogger

This Arduino has an on-board Micro SD card plus Lipo battery charging. See Adafruit website for details. Make sure you are buying the M0, not the 32u4.

The Micro SD card is only used to store the configuration file and the near miss log files. The logs are in CSV format, generating less than 1kB of data per hour, so any standard capacity/speed card you happen to have lying around will likely be enough.

Cost: ~£21.00


uBlox Neo 6M Module

GPS Module uBlox Neo M6

The uBlox Neo 6M GPS module seems to give the right compromise of price, accuracy and reliability. Often listed as an 'Aircraft Flight Controller' for Arduino, there are a couple of different form factors - both work, but only the one with the loose antenna will fit the case properly.

Cost: ~£12.00

The Neo 7M has slightly better 'accuracy' (uses GLONASS) but is more expensive and will need a modified case because the antennae is thicker.





US-100 Serial Sonar

US-100 Ultrasonic Sonar

The US-100 does all the range timing 'on-board' and has temperature compensation too. More reliable, consistent & robust than the ultra-cheap (HC-SR04) sensors.

Cost: ~£7.00

An alternative is the MaxSonar (I have tested the MB1010 EZ1 at ~£20.00, but using outdoors voids the warranty. Weatherproof versions are ~£100). The PCB is designed (but not yet tested) to use either US-100 or MaxSonar via solder jumpers.



Round Pin PCB Headers

Low Profile Round Pin PCB Headers

These are fairly unusual (I could only find them in small quantities from Hong Kong), but allow the Feather board to be mounted 'upside down', making it a similar height to the GPS+antennae.

Usually described as 'Male Female Black 40 PCB Single Row Round Pin 2.54mm Pitch Spacing Header'...

You need both male and female.

Cost: ~£1.00.


Molex Connector

Molex Connectors and Terminals

This is a 4 way/pin right angled socket attached to the PCB and a plug attached to the ribbon cable.

Socket: 70553-0003

Plug: 50-57-9204

Crimp Terminals: 16-02-0086 

I chose these because they are the smallest form factor that still has a 2.54mm pin spacing. The specified plug is a friction type which will help protect the unit if the cable is snagged, but the socket will also take a latching type for extra security if desired.

These are sort of optional as you could solder the ribbon cable directly to the PCB.

Cost: ~£2.00 per set, but may need to order multiples.


Toggle Switch

PCB Toggle Switch SPDT

Used to disable the Adafruit Feather by grounding the ENable pin. This does not isolate the battery (so it can be charged).

This is from RS Components: 734-7220

Manufacturers Part Number: 2MS1T2B4M6QNS

If using the PCB, the pin arrangement needs to match (2.54mm spacing).

Cost: £1.00.


Momentary Switch

PCB Momentary Switch

Used to start/stop recording and for tagging. This is a cheap and dirty switch but we do some 'debouncing' in software to overcome its limitations.

If using the switch case, this will need to be the 1.5mm button version (the lowest available).

Cost: ~20p, but may need to order multiples.


Red, Green and Blue LEDs

3mm LEDs

Three 3mm LEDs are used: Red for GPS status, green for record status and (optionally) blue for near miss indication and sanity check.

I have used cheap 3.3 volt versions from eBay but the light output is not consistent across the colours. The PCB design includes provision for resistors, so a lower forward voltage can be used with the appropriate resistor in place.

If you're using 3.3v LEDs, then you'll need some short lengths of insulated wire to use as jumpers in place of the resistors.

The LEDs for the switch PCB need to have 2.54mm spacing on the legs, and if using the switch case sit no higher than 5.5mm when mounted on a PCB.

If using the blue LED, you'll also need a short piece of insulation (shrink wrap or pulled from a piece of wire) as the legs are quite close to metal parts of the sonar.

Cost: ~20p each, but may need to order multiples.


Light Dependent Resistor

LDR [optional]

An optional Light Dependent Resistor is used to dim the GPS and record LEDs according to ambient light level. You'll also need a resistor.

I implemented this because 'superbright' LEDs are needed for daylight but at night (or when testing) you'll end up with spots before your eyes...

I'm using a 100KΩ (Ohm) resistor with a 70-200KΩ LDR from Maplin.

Cost: ~£1.00


Resistors

You will need three resistors (or jumper wires) to match the red, green and blue LEDs and one for the LDR.

There are several online resources to calculate the resistors required for the LEDs. eg: LED Center or LED Calculator.


Evil Mad Scientist has a bit more in-depth information.

Cost: ~£1.00


Ribbon Cable

This is used to connect the remote switch. I have used ribbon cable but any four core cable will do. If you're planning to use the near-miss-o-meter case with the optional cover, then you'll need to use thin flat cable.

Cost: Free if stripped out of an old PC...


Oshpark PCBs (front and back)

PCBs (or Pegboard and Patience)

All of the components have been chosen for 2.54mm (0.10") spacing on the pins. This is, first and foremost, to allow easier soldering, but it also allows the same circuit to be implemented on both a PCB and a pegboard.

I really cannot recommend a pegboard. It's perfectly doable, but tedious and time consuming if your soldering skills are not ninja level.

Cost: The two PCBs (main board and switch board) are approximately £4.00 per pair (ordered in sets of 3 from Oshpark).

The Eagle .brd files are here on GitHub - just upload them to Oshpark or your favourite PCB manufacturer.


500mAh LiPo Battery

LiPo Battery 500mAh

If using the near-miss-o-meter case, this needs to be a 500 mAh measuring approximately 44mm x 25mm x 9mm.

Cost: ~£3.00 each (ordered as a set of 5 with a charging fly lead)

The Adafruit Feather M0 can also be powered from the USB port, but it would be a shame to not use the onboard charging...


Walkerman and JST Fly Leads

Battery Fly Lead

The battery connector on the Adafruit Feather is a 'standard' JST. Most easily available LiPo batteries have a different (Walkerman) connector. You have a number of options:

  1. Use a male Walkerman fly lead (on left in picture above). There are various vendors who sell 5 LiPo batteries with a charging fly lead... This is the route I took.
  2. Swap the female Walkerman connector for a JST connector and connect directly to the Faeather board. This was the first route I took, but BE WARNED! There is no standard for the positive and negative terminals. The leads I obtained (on the right) were opposite the the implementation by Adafruit (centre in photo), so I managed to fry my charging circuit. I notice Adafruit now have a warning notice on their site...
  3. Solder the battery leads directly to the PCB. Not my favourite option as I like the idea of being able to quickly isolate the battery should the need arise.


Case

I've created a case suitable for 3D printing. The parts are on github here. If you don't have a 3D printer (why not?), they can be printed via 3DHubs - just upload the files choose 'PLA' material and search for a suitable printer (often quite local).

You'll also need two 40mm M3 screws and nuts to hold the base and lid together.

The 'case04-cover.stl' is optional - intended to keep the SD card and USB slots clean and a little dryer if it rains (Although I have used this case in the rain, it is not waterproof in any way shape or form. Use at your own risk!)

Cost: ~£12.00


Handlebar Mount

The case has a GoPro mount on the top, so any mount should fit. Search for 'Camera Handlebar Seatpost Clamp Roll Bar Mount for GoPro Hero' and you should find one like this. Be warned: They are useless for cameras (too much wobble).

If you don't already own a GoPro, you'll also have to buy a 'GoPro long thumbscrew' separately to attach it to the mount.

Cost: ~£4.00

Next up: The Build

I have photographed the build and am currently writing it up...