Blog

After sinking so much time and effort into ‘pimping’ up my venerable 2001 P38 Range Rover the list of faults on it finally tipped me over the edge from ‘it’s a beautiful car with a few issues’ to “it’s a complete POS on 4 wheels” so I decided to upgrade to…. another Range Rover! A 2007 MK3 (L322) this time

For early (2002 to 2005ish) L322 Range Rover’s it’s pretty straight forward, you can get an android head unit and stick it in with very few issues. Unfortunately the later cars use a fancy media bus that is nigh impossible to integrate with, and if you remove the stock head unit you lose access to some of its functionality such as setting the time for the analog clock on the instrument panel, and some of the terrain response options…. so swapping out the head unit was a no-go.

One option I did consider was removing the CD changer, which lives in the glove box, putting the stock head unit in there and putting a swanky new android unit where the stock one was. Sounds good right? However, in typical Land Rover fashion getting the CD changer out requires removing 2 screws. Getting to those 2 screws requires removing most of the dashboard and lots of time, neither of which I was happy about.

So, I needed something that wouldn’t require removal of the existing head unit, but would give me more up to date media (spotify) and navigation (google maps) options. After some fiddling about with Android Auto options on the raspberry pi, I eventually settled on this:

That’s v1, which is a bit chunky but in essence it’s a nexus 9 that I picked up cheap off ebay, in a 3d printed case that slots in down the side of the stock head unit and is held by friction. You can find the files for the case here: There’s a v2 in the works that removes some of the plastic from the sides etc.

Unfortunately, going with a standard android tablet left me with one annoyance…. since the cigarette lighters in my car are only live when the ignition is on, if I didn’t drive over the weekend the tablet was invariably dead when it came to monday morning. I could have just wired a 5v converter in and charged the tablet from the battery…. but Range Rovers have a habit of complaining if the battery voltage drops, so I didn’t want to risk not being able to start the car just to satisfy my desire for music on the go……which lead to this:

Nestled away in my glove box is now a crduely soldered circuit with an arduino (this one in fact) a voltage sensor, a 5v converter and a relay. When the battery voltage drops below a preset level the relay trips off and the 5v converter turns off. This drives the tablet and my wifi access point, so if I ever have to leave the car stood for a while those won’t drain the battery below a certain level. Also, because I’m a mega-nerd, this setup uses an MQTT queue to keep me notified what the current (ha) coltage is in the car. Which is incredibly useful. For reasons.

My circuit design skills lie at the ‘trial and error’ end of the spectrum, so I don’t have schematics or anything like that for the board itself, but it’s not difficult if you know a little about electronics.

Next piece of the puzzle is to connect to the CAN Bus in the car so that I can use the media controls on the steering wheel to control spotify…. that’s for another post though.

I think the face is supposed to light up at night, but mine never has, hence the complete lack of timekeeping once it’s dark.

I could have just fixed the light, but where would the fun be in that? I decided, instead, to design and build an arduino powered LCD Clock that can also (at some point in the future) display other things like…. temperature, car suspension height, anything else I can tap into.

I had a spare NodeMcu board lying around and debated whether to rely on my car’s internet connection to get the time from an NTP client. In the end I decided to use an RTC module, this one in fact.

For the screen, I needed something that would fit nicely into the space available (60mm by 55mm) and, after trying a 1.5″ OLED display eventually settled on a 1.8″ LCD. Getting that working was a bit of a pain initially, but after finding this incredibly helpful comment on amazon I got it going with no further problems.

The actual code was surprisingly straightforward. Using the Examples from the adafruit RTC library it was pretty straightforward to set / get the time from the RTC chip (see bottom of this post for the full code)

To display the time I played around with a few different formats but eventually settled on a simple 24 hour digital display and the current date, with an analog face just for added niceness. The analog code was blatantly ripped off from here and mangled to make something that works (that’s how I roll) and the final display looks something like this:

the circle on the bottom left is a light sensor, the display goes brighter in direct sunlight and dims when it’s dark, to avoid being dazzled at night.

On the left of the display are the outputs from a nifty 12v to usb board I found on ebay, by soldering some wires to the back of the USB ports I also pull 5v from this to power the board and LCD.

The enclosure went through several revisions, but now has an outer ‘shell’ and an interior panel that fits tightly into it, holding the LCD panel and light sensor in place. I’m quite pleased with this, no glue is required to assemble it and everything stays in place pretty well!

You can find the arduino code for this project here and the 3d printing files for the enclosure here

One thing that always made me want a range rover when I was younger, was the screens in the rear headrests. The thought of having the option of watching videos (yes, actual VHS videos!) while stuck in the back of a car on a road trip was just mind blowing to my teenage self. On buying my very own V8 powered beast, rear screens were one of the first things I wanted to add (since mine originally didn’t have them fitted).

After having my range rover for a couple of months, a few things have started to annoy me, notably having to push the wing mirrors in when I park up on my (narrow, typically British) front street. Because the car is so wide, if I park with the nearside next to the kerb I have to walk round the car to reach the mirror on that side. Clearly this is unacceptable, so I sought a solution.

I’ve had limited success doing multi-part posts in the past, but for this little ongoing project I thought I’d give it another go….

At the ripe old age of 38, in April 2018 I passed my driving test (4 minors, all to do with use of mirrors!) and decided to buy my first car. Rather than go for something boring, that just…worked, I thought I’d go for possibly the most troublesome, unreliable and badly engineered car I could find which led to me spending in the region of £2000 on this beautiful boxy vision of british engineering:

If you need to connect from a docker container to something running on your local host, it can be a bit of a pain on Linux. On windows & Mac, there’s a special DNS entry ‘host.docker.internal’ which always points to the host machine. However that isn’t available on Linux (here’s a bug open for this as of May 2018: https://github.com/docker/for-linux/issues/264)

That bug report also contains a pretty good solution for this problem, so to save you wading through, simply add the following line to your docker file:

I’ve been working in e-commerce for a good few years now, for very similar companies (early stage, fast fashion focussed) and there’s always the same sorts of problems to solve. Here’s a very basic, very generic guide to the things you need to get up and running. Each bit has a ‘too long / didn’t read’ summary at the end, so you can just look for those if you don’t like reading. Please note that this is entirely my opinion, I don’t get paid by any of the companies I mention (although I am totally open to bribery. Seriously guys, hit me up.)

Just a quick snippet of code today, it grabs all the products in a certain category (given in category_id), sorts them by age and stock availability (you can adjust the relative weighting of these using $stock_weight) and then updates the category. The end result is a nice mix of newer products, and products with loads of stock towards the top of the category, older / lower stocked products further down.

Just a quick note, sometimes you need to access the magento database from a script, but don’t want the overhead of loading the whole magento framework….. Here’s a little snippet of code that grabs the database details from the magento xml config, so you don’t have to store them in your script: