Thursday, 24 August 2017

Electric Vehicles

There's been a lot of press recently, created by the UK government's policy to prohibit the sale of new petrol and diesel cars from 2040, about the inability of the country's power infrastructure to support a nation's worth of electric cars. Putting aside for one moment that it will likely be sometime between 2050 and 2060 before the last of the new petrol or diesel cars sold in 2040 are no longer in regular use, we still have at least 23 years to come up with a reliable power infrastructure to support widespread EV adoption. Personally I don't think this is a major issue, especially when there's a deadline to galvanise efforts. Also, given that we already have the solutions, in my opinion it is just a case of implementing them at scale.

The first thing to consider is the generation of sufficient electricity for all these additional EVs. Some analysts have calculated that there is a need for handful of new nuclear power stations to cope with the extra demand for electricity. This is based on an assumption of a high peak load when everyone tries to charge their cars simultaneously. Whereas, if every car had a sibling storage battery from which the car was charged, the challenge becomes charging the storage batteries rather than the cars. This is significantly easier, as the storage batteries are always connected, and a simple load balancing algorithm would spread the load on the grid. Ensure that the storage battery has twice the capacity of the EV battery, and you can charge the storage battery at any time of the day or night. This technology already exists, under the banner of Demand Side Management, so if every household across the country had a storage battery tomorrow, the grid would continue to work just fine.

For sure millions of EVs will require more electrical power than is currently generated. And localised micro power generation is a potential solution for this additional power. Even in the northern latitudes of the UK during winter there is solar energy to be obtained from roof top PV panels. When the likes of Ikea can sell you PV panels and a storage battery for a few thousand pounds, you can be sure this is a mature, proven technology. There is still a major need for a country-wide power grid though, as solar and other renewable energies are not evenly distributed. But considering the vast storage battery capacity now available from the paragraph above, the contribution of renewable energy can now be significantly higher than fossil or nuclear. In theory, with sufficient storage capacity, there is no reason why all the country's energy cannot come from renewable sources.

But where are all these batteries going to come from? Are there sufficient rare-earth metals to produce them. This is another bit of scare mongering that has made the mainstream media, perpetuated by journalists that can't even fact check on Wikipedia. For starters rare-earth metals are not rare, as in scarce, but are rare, as in not found conveniently in seams of ore. This does make them more expensive to extract, but also makes them easier to find, because they are pretty much everywhere. Secondly, rare-earth metals aren't widely used in batteries, so there's no need to extract large quantities of these plentiful metals to build batteries. Rare-earth metals are used in electric motors though. But the good thing about that is that electric motors are about the simplest mechanical system you can build, and are extremely reliable. Essentially the electric motor in today's EV is maintenance free for life.

So far my thoughts have been based on the state of current technology. Imagine the world 23 years ago, and now think forward 23 years, noting that the rate of technological development is accelerating. Electric motors and EVs will be more efficient, requiring less energy. Batteries will have higher energy density and charge faster. Micro generation of solar energy will be widespread, as will macro generation from wind, wave and tidal sources. If anything, having stored energy distributed widely around the country will given us a more resilient and robust power infrastructure, not the frail brown-out prone grid the mainstream media portrays.

Tuesday, 22 August 2017

Broadband - Will fibre ever arrive?

Back in January I noticed that our local broadband was being upgraded to fibre. When I checked on the Openreach website the status was listed as in Build, where the fibres are laid under the street from exchange to cabinet. This is noted as taking around 5 months to complete. Checking again this evening, the status is still in Build. Given that the fibres still need to be connected to the cabinet, and the exchange activated, I suspect it is going to be a long, long time before we reach the promised land of superfast broadband.



(Edit on 5-Sep-2017: I've been checking other cabinets in Ironbridge, and discovered that cabinets 1, 3, 5, 7 and 8, which cover Coalbrookdale and the centre of Ironbridge up to Hodge Bower, are already hooked up and people can place orders for fibre broadband. Also the Broseley exchange, just the other side of the river, is fibre enabled and cabinet 3 serving Coalford is active. Looks like Ironbridge's cabinet 2 is last on their list.)

(Edit on 5-Oct-2017: Whilst walking near the Ironbridge I chatted to two Openreach technicians working on cabinet 7, and asked if the recent roadworks near cabinet 2 were to do with the fibre upgrade, which they confirmed they were. So a search on the Openreach postcode checker reveals that cabinet 2 is now in the Activate stage. Only a month (or so) to go until they start taking orders!)


Friday, 20 January 2017

What's talking to what?

The recent broadband issues we've been having exposed me to some of the network diagnostic capabilities of our router. One of which is a table of sessions the router is managing between devices in our home and the big wide internet. I made the mistake of delving into this a little deeper, with the result that I'm now paranoid about what servers on the internet my smart home systems are talking to on a regular basis.


Unfortunately the router's sessions table lists only which internal IP addresses are talking with which external IP addresses. Converting the internal addresses is relatively straight forward, as I've set up the router to bind all of the expected devices on the network to specific IP addresses. For the external IP addresses a reverse DNS is required to find out who owns them and where they are. I used www.ipinfo.io manually for several reverse DNS enquiries, until I noticed that it offers an API to process IP addresses, at which point I decided to write a Python script to automate the whole analysis.

The code is fairly straight forward. First read in the IP binding list from file and build a dictionary with the device names and internal IP addresses. Then read in the sessions, again from file, and parse each line to extract the internal IP address and external IP address into a list. Converting this list to a set effectively eliminates any duplicates. Then send a call off to ipinfo.io with each external IP address from the set to get a JSON response, from which the organisation and location of each IP address can be extracted. And finally create a CSV file to dump out the resultant list of internal device names and external organisations. The results look something like this:


All of this looks pretty much okay. Our HP printer talks to HP servers (and only HP's servers, it is nice to see) as we've got cloud printing turned on. It is slightly interesting to see that Philips are using Rackspace to host their Hue system back-end, but not totally surprising. I'd not come across Google's use of the 1e100.net domain name, but a quick search reveals that Google consolidated their back-end systems under a single domain back in 2009. 1e100 is the scientific notation for 1 googol. And the various devices talking to BT is also expected, as BT provide our broadband (sometimes).

The stuff I'm not so happy about is my IP cameras. They're chatting away with a whole range of people which don't immediately seem relevant. One of the IP cameras is even talking to NIST in Boulder, Colorado. Another appears to have ambitions of becoming an autonomous car when it grows up, as it is connecting to www.quickdrivingtestcancellations.net to arrange a driving test. The only two things outside my network I want my IP camera talking to are an NTP time server, and an email server. So I think I might enable these on my NAS to send all that traffic through one pipe, and block all other traffic using the router's firewall.

Saturday, 7 January 2017

Broadband issues

Every so often our broadband connection, provided by BT, has a bit of a wobble. Yesterday was one of those days, and after it was down for a couple of hours I gave BT a call to see if there were any problems at their end. One long call later on a Friday lunchtime, and the customer service rep had booked a technician to go out to the exchange and take a look... on Monday afternoon. As he explained, the technicians don't work on the weekend, but if the system sorted itself out he would be happy for me to phone back and cancel the booking. (As it happened, the broadband came back at 5.30pm, and has been up ever since.)

Working from home is a regular thing for us, and a day without broadband is a major headache. So I looked at options for increasing the resiliency of our internet connection, and decided to add a cellular modem as a backup to our ADSL modem. On the opposite side of the gorge from our house is the cell base station for the town, which was upgraded to 4G last year. So there should be plenty of bandwidth available from the cellular connection, if the landline connection goes down.

As we've been having broadband issues for a while, we've long since ditched the BT-supplied Home Hub 4 and have been using a DrayTek Vigor 2860ac ADSL2+ router. This has enabled us to get the maximum speed from our connection, and has plenty of manual configuration for other services such as VPN, IP binding, QoS, etc.


The Vigor 2860 also has load balancing and auto-failover for multiple WANs. By adding a USB cellular modem, it is possible to configure the Vigor 2860 to switch over to that when it detects the ADSL has gone down. So I bought a ZTE MF823 and EE PAYG data SIM, and hooked them up to the Vigor 2860.


Within the Vigor 2860 administrative interface (firmware 3.8.4.2_BT from 7-Dec-2016) the USB modem needs to be enabled.


The Active Mode is set to 'Failover' and Load Balance in unchecked, as I only want the cellular connection used when there's a WAN failure, specifically when WAN1 (BT Broadband) goes down.


The next thing is to set up the USB cellular modem itself.


The Vigor 2860 supports the MF823 when in DHCP mode, as opposed to PPP mode.


The only configuration information the MF823 needs is the APN for the EE network, which is 'everywhere'. With the MF823 configured, the Vigor 2860 reports that it has a potential 42Mbps symmetric internet connection.


Which rather puts our ADSL2+ speeds of 20Mbps/1Mbps to shame.


So the final step is to test that the Vigor 2860 switches over from the ADSL connection to the cellular connection, and back again, when the BT landline goes down. Disconnecting the RJ11 modem cable from the BT master socket triggers the failover behaviour in the Vigor 2860, and after a short delay as the MF823 connects to the network the internet is restored.


There is a break in the internet connection, so this isn't a seamless failover setup. The Vigor 2860 could be setup with the MF823 always on, but with load balancing rules sending all the traffic down the ADSL connection. When the ADSL goes down there wouldn't be the delay while the MF823 connects to the network. However it would still confuse the hell out of any VoIP and streaming connections as the packet routing transitioned from ADSL to cellular, and keeping the MF823 permanently connected would slowly eat through its data allowance. So on balance, I'm happy with the small disruption in connection with the current setup.

(I also note that Openreach is now accepting orders for fibre connections from the Ironbridge WNIB exchange! We're connected to 'cabinet 2', which is currently is in the Build phase, and the guidance is that connections to homes should be available within 5 months.)

Friday, 30 December 2016

Home Automation - Installation

An Amazon Echo Dot has arrived in the house. We're still in the find-out-if-it-is-useful period, but to help us through that there's plenty of party tricks to keep us entertained.


After we'd played with asking Alexa trivia questions, and to play specific music or radio stations, it was time to hook it up to our Philips Hue lighting and Honeywell Evohome heating systems.

First step is to download the Alexa app, and go to the Smart Home menu option. Amazon calls the integrations into Alexa 'skills', presumably for trademark reasons. The Hue skill is called Hue, but the Evohome skill is called Honeywell Total Connect Comfort, and both require linking to your cloud accounts for those systems. Once the skills are enabled I hit the 'Discover devices' button, and the Evohome devices were found straight away. For the Hue devices I need to press the button on the Hue hub first, but then Alexa was able to find them.

Alexa enables you to control your Evohome system through both activating modes ("Alexa, turn on Economy mode") and through setting individual zones ("Alexa, set Kitchen to 21 degrees"). You can also nudge a zone up or down ("Alexa, raise Lounge by 2 degrees"), and turn the hot water on and off ("Alexa, turn off hot water"). The zones and modes you've set up in Evohome are automatically brought into Alexa as groups.

What you can't do with Alexa and Evohome is monitor the current status of the system. For example you can't ask what temperature a zone is currently, and you can't ask if a mode is activated or not.

Alexa enables you to control your Hue system through both activating scenes ("Alexa turn on scene Movies") and through setting individual lights or rooms ("Alexa, turn Dining light on"). Any collections of lights that you've put into a Room in your Hue system are automatically brought into Alexa as groups.

What you can't do with Alexa and Hue is set lights to specific colours. For example you can't tell Alexa to turn a light to Red, you can to pre-set a scene with that light as Red and activate that scene.


Sunday, 20 November 2016

Smart Lighting - Wall plate

I'm really happy with the Philips Hue smart lighting system in general, and I think that the dimmer switches are an essential component. For all our desire for automation, we're still programmed to reach for a wall switch to turn lights on and off. The downside to the Hue dimmer switches is that the existing wall switch is still there, which creates the opportunity for someone to turn the light off accidentally. It also looks ugly, in my opinion.


So I decided to make a new wall plate which would do away with the existing wall switch. So the first thing I did was remove the switch and replace it with a 13A connector. The bulb is now powered up all the time.


Then I designed a new wall plate that picked up the mounting points in the wall box, and mimic-ed the shape of the Philips wall plate. For initial testing I had this 3D printed in ABS.


The final touch was to add some disc magnets to the new wall plate, so that the dimmer switch remains in place.



The end result is certainly more aesthetically pleasing than before, although printing ABS at 200 microns doesn't give a smooth enough finish. I'll have to look at acetone smoothing, or experiment with other materials, to see if I can improve the looks.


Sunday, 30 October 2016

Smart Lighting - Motion Sensor

Philips recently released a motion detector for their Hue smart lighting system. Now that there's a few Hue bulbs in various rooms of the house, I thought I'd try a motion sensor out to see if there's an actual use case that makes sense in reality.


The motion sensor itself is pretty small (5x5cm) and some thought has been put into the mount to make it pretty flexible. You can freestand it, or screw the supplied 'mount' to something like a wall. The mount is magnetic, so you can re-position or remove the sensor at will.

Finding and configuring the sensor is pretty much the same process as for a new bulb. There are 3 main configurable parameters for the sensor; how sensitive it is to motion; how dark it needs to get before the sensor becomes active; and what times separate 'night' from 'day'. This final parameter lets you split the day into two, and assign different lighting schemes to each. For example, a basic Hue White bulb supports schemes for fully on, dimmed, and nightlight, so you could go for fully on during the day, and dimmed during the night.

As a home worker the first use case we tried was in our home office. We stood the sensor on the desktop, and linked it to the desktop lamp and ceiling light. We configured both night and day to turn these lights fully on, and turn both off after 5 minutes of no motion detected. So whenever someone comes into the room the lights come on, and then they go off again when the room is unoccupied.

This use case almost works. I go into the office in the morning while it is still dark outside, and the lights come on. I work there all day, and a few minutes after I leave in the evening the lights go off again. The problem is, when I leave the room to go and have lunch, the lights stay on. This is because the ambient lighting has increased, and that deactivates the motion sensor. You can configure the sensor so that even on the brightest of days it will never deactivate, but that misses out on an opportunity.

What would be fantastic, certainly at this time of year, is to be able to trigger a scheme as the ambient lighting conditions pass the on/off threshold. We could then turn the ceiling light off as the dark morning transitioned into full daylight, and back on again in the afternoon as the night draws in. On a positive note, this is only a software update, so maybe in time it will come.

The second use case we've tried is in the hallway. I mounted the sensor above the front door, and tied the sensor into the hallway lights. We've set a far shorter period for no motion, and the hallway is a more transitory space in the house than the office, so the chances of the lights being on just as the sensor is deactivated by ambient light is very slim. This use case works very well. No need to fumble for the light switch when coming downstairs half asleep in the morning, and when returning from an evening out it is nice to be welcomed home automatically.

Currently the motion sensors are £35 from Amazon, so certainly not cheap enough to blitz the house with them. But we'll probably get a second sensor for use in the kitchen, as the use case there is the same as the hallway. Hopefully there'll be a software update from Philips at some point, and it'll be worth putting one back in the office.