Insurance comparison sites don’t show my current insurer… WHY?

Insurance comparison sites don’t show my current insurer… WHY?

So this was strange and irritating, to say the least. I did a prelim quote comparison, with everyones favourite meerkat, a few weeks back to see what my renewal was likely to come out at. I had to put in a birthday 1 week before my actual birthday as I wasn’t currently old enough for the quote to be representative of my years of holding a license. The quotes came out positively cheap with my current insurer. On entering my real details today, my current insurer (Elephant), nor any of their sister companies, showed up. I changed my birthday to 1 day either way and, as if by magic, my insurer and its sister companies showed up with the same reasonable quotes I got some weeks earlier.

I called Elephant and was given a renewal quote £226.84 above the online quote for someone just like me, except born one day before or after. I queried this and they confirmed that the online quote was indeed exactly what my quote was and agreed to lower the price whilst changing the birthday to my real birthday. Cheeky bastards.

Coincidentally, there’s a lot of job titles that I could fit into and I chop and change them every year to get the best quote. I’ve changed from a Computer Programmer to a Development Manager to a Software Engineer in 3 years. Software Engineer has a ring to it… perhaps I need a hard hat now. I may try to get the word “architect” in there next year… they’re a responsible bunch.

 

How to detect Sonos devices on your network

How to detect Sonos devices on your network

A potential project requires me to detect Sonos devices on a network and find their IP addresses. Since Sonos only has 2 Mac Address OUIs an ARP scanner seemed the best way to do this. As such, I rightfully reinvented the wheel and wrote a slightly glorified ARP scanner with detection for Sonos OUIs. Sadly, PHP wasn’t quite suitable for this due to it’s lack of AF_PACKET sockets so it’s in C.

It’ll run on Linux and scan a network when given an interface name. Tweaks more than welcome as GitHub Pull Requests.

Code’s on my GitHub at https://github.com/phil-lavin/sonos-detector.

How to use Kernel GPIO interrupts on the Raspberry Pi

How to use Kernel GPIO interrupts on the Raspberry Pi

Presumably everyone knows what the Raspberry Pi is, by now, so I’ll not start there. You may or may not know that the RasPi has General Purpose Input/Output (GPIO) pins as standard. Some of these provide 3.3v power, some provide 5v power, some are grounded and the others can be used for input and output. Pins will output 3.3v when connected to ground and will be ‘raised’ as ‘on’ when 3.3v is supplied to them. You change, in software, whether a pin is input or output. Simplez.

The Raspbian distribution has, since around mid 2012, had a kernel which includes support for Kernel GPIO interrupts. The advantages of using these over a traditional poll loop are that response times are faster and CPU is not consumed whilst idle. To test this, I rigged up a small switch circuit on a breadboard. A diagram is as follows:

Raspberry Pi Switch Circuit Diagram

Raspberry Pi Switch Circuit Diagram

Details on the pinout of the RasPi’s GPIO can be found here. This should give you an idea on where to connect the circuit. The code described below uses GPIO 21 (GPIO 27 on rev 2 devices). This is mapped to GPIO 2 in the WiringPi library.

The C code to handle this can be found on my GitHub account under the Raspberry Pi GPIO Interrupt repo. Compilation instructions are in the readme. It’s designed to act as an example though should work out the box. Be sure to tweak the PIN and IGNORE_CHANGE_BELOW_USEC constants to suit your hardware. 10000 micro seconds worked well for my “switch” which was rather just 2 bits of wire touched together. Better switches may cause less jitter.