Nissan Leaf 2.Zero

I bought myself a new car this year and after two years of looking at electric cars, I’ve finally bought one! As of Tuesday, I now own a Nissan Leaf 2.Zero in black.

Car Front

Why did I buy an electric car?

I’m a fan of green tech, so at some point I had to put my money where my mouth was and purchase a car that was significantly cleaner than my petrol car.  My previous car was 10 years old and the brakes aren’t quite what they used to be… so I was contemplating fixing the vehicle or passing it on to family and getting a new one.

My commute to work is 40 miles each way and it costs me about £50 a week to run my petrol car. At work, we have free charging points (enough for 8 cars and increasing) – so the temptation to save some money on fuel finally got too great. Plus the new leaf that came out early this year had enough range for me charge the car to 100% at work, then drive home and back to work, using works free charger again 🙂

So what’s it like?

Well like I said above, I’ve only had it since Tuesday, but at first it was really odd… My previous KIA cee’d, I could feel the road through the steering weel and pedals – I almost felt connected to the road. This new car is “fly by wire” as in, the steering wheel isn’t connected directly to the wheels, so there’s no feeling in the steering wheel or pedals. The first day I took it to work, I must admit it made me quite anxious. Luckily I spoke to someone who told me this was quite natural to feel anxious and that it’d take time, but I’d get over it! The second day I took it to work was a lot better – I’d taken the drive assist off (that helped a lot!) and it just felt more natural.

Teething problems

The first day I took it to work the tyre pressure warning came on half way to work and then on the way back. Not sure if it’s a faulty sensor, but it didn’t reappear on Thursday… This weekend I’ll take it to the petrol station (haha) to check the tyre pressures.

Nissan EV Connect – can’t get it to work at all… Reading the http://www.speakev.com/ forum, it requires a TCU reset because the car has a greyed out car icon with a red cross through it.  So if you’ve bought this car and see this (below in the red box)… you’ll have to go back to a dealer to get it fixed.

I got in the back of the car on Wednesday at work, closed the door and then found that both doors had the child-lock on!! Haha!

The Handbrake is nifty. During the test drive, Derek (sales guy from Cambridge) mentioned that it was possible to put the handbrake on and then drive off with it on. This does work and is one of the reasons I decided to purchase the car, but the manual says not to do it… He’s hopefully going to find out for me why the manual says you shouldn’t do it.

Things I’ve found out

Don’t put the handbrake on if the car is moving (even at 5mph which is the speed I tested it at)!! It makes a hell of a noise!

I can drive from work to home doing 70mph (where possible) with the heater set to 23.5C and back again to work and still have 50 miles on the guess-o-meter (GOM)!  Cool!

(Picture above shows battery percentage after the test run)

The blind spot warning is really useful!

What’s next?

Well I have to get a home charger at some point – just trying to get a device that I’m happy at the moment, so will write another post when I’ve got it 🙂

Other than that – just keep driving it as much as possible to find out all the new features and get used to the ride.

Home Monitoring Upgrade (Part 2) – HSQLDB to MySQL

As mentioned in my previous post (see http://blog.v-s-f.co.uk/2017/04/home-monitoring-upgrade/), the first task I have is to migrate from HSQLDB to MySQL.

Because the system logs data every minute while I have power in the house and I want to minimise downtime when I actually have a fully working upgrade, I’ve experimented with a copy of the live HSQL database.

Once I’d copied it from my server to my laptop I then attempted to view the data in notepad++ – yeah, not a particularly smart move! NP++ cannot handle files over about 100M. It also turns out (having more’d the .data file) that the data is not in a readable state. I had a performance issue with a select query a long time back and changed the table to cached.

So, luckily at work a colleague had introduced us all to a great database tool called SQL Workbench. It can work with most databases and unlike SQuirreL, it doesn’t crash when looking at the work DB2 database.

Using SQL Workbench, I’ve then created a script file which creates the new consolidated table and loads data from the old tables in to the new + drops the old tables. The end result is a 122,398KB HSQLDB script file which is human readable.

Next step was to get MySQL running on my server. Instead of installing it directly though, there’s a Docker image available.

My first few attempts at inserting the data from the HSQLDB file in to the MySQL database were less than impressive! One of the attempts had the server running flat out (100% cpu) for over an hour when I finally decided that it was probably not going to complete the import this year and nuked it!

So having learnt a few lessons about not using single row inserts(!), but batching them in to multi-row inserts of 100,000 and a few MySQL deafult parameter increases (although I’m not sure if these are necessary as the batch inserts seemed to make most difference), I was finally able to import the data. It still took a few minutes from running the MySQL container to it being available – but that’s significantly better than running for hours importing the data!!

Now that I have the necessary scripts and knowledge to migrate the data, the next part is re-writing the application that receives the Arduino data, uploads to PVOutput and serves the hot water display Arduino.

Home Monitoring Upgrade

I’ve been monitoring stats from my meter, weather and hotwater tank for over two years now (see http://blog.v-s-f.co.uk/2015/04/home-monitoring-home-made-reborn/) and the application now needs an upgrade.

I now want to log more data from the weather station (temperature and humidity). This should be as simple as adding two new columns to the HSQLDB, changing the application to write in to the two new fields and adding two new fields to the service definition, but it’s not quite that straight forward…

The old app uses an out dated version of Mule on Tomcat in Docker and it’s far too heavy weight for what it needs to be. Therefore it’s time to give it a revamp.

It’s also occured to me recently that instead of storing the data in five separate tables (one for generation, upload info, hotwater, meter and weather data), why not store it in one table. This saves a significant amount of space as there are four less records per minute and it makes adding new columns for additional data sources relatively quick. The HSQLDB that I’ve been using for a while now is over 400M!

So the first task, which is possibly the biggest, is to migrate the data from the five tables in HSQLDB to a single table and then stop using HSQLDB and migrate to MySQL. Why MySQL – it’s actually quite a performant database, it’s free and easy to get running.