Here is an update on how I am getting on with my automation project...
Like with most things in life I haven't had the chance to focus all my efforts on one thing and finish it. Over the last few months I have dug a 6ft trench round the back of my house to repoint the walls below ground and install a vertical dpc. I have also tried my hand further at ground work replacing most of the drains and getting the pro's in to install land drains and a soak away. All resulting in a much nicer drier cellar
I have learnt more than I ever wanted to know about boilers, hot water stores and plumbing in general as my plumber insisted I buy everything myself, with little guidance. Thankfully 99% of the plumbing is done bar the shower and checking the toilet and sink I plumbed in aren't going to flood my house.
I have also been very busy helping rewire my house, a larger task than anticipated due to the age of my house, thickness of walls, convenient positioning of joist (always impossible to catch cables) and my insistence to preserve original features and floor boards.
So a quick recap...
This idea was to have a centralised wiring structure in order to have the main switching control centralised. This approach allows for mains control to be contained, in my case in 2 locations, not only for safety, but also for ease if anything goes wrong. It also allows me to distribute or centralise my intelligence, such as senor arrays and controls, as I wish.
Every light, socket and appliance in essence has its own circuit and all (99%) of wiring is now in place. The way I have structured my mains wiring is to try to keep things modular; so I have 2 distribution boards (one in the loft/ one in the cellar) and 2 consumer units (CUs).
Each distribution board has a consumer unit above it, this contains the standard RCDs and MCBs you would expect to see in a normal domestic CU. Typically you have 2 RCDs and this splits your mains supply in to 2 circuits. RCDs are basically a current sensing device that are super sensitive whereas MCBs (breakers) are less sensitive. These 2 devices protect against different things, so an RCD will protect against any current leaking on to the neutral (N) and an MCB will protect against any current leaking on to the earth (E). RCDs deal with residual current which deals with over current situations, whereas MCBs take care of overload or short circuits.
RCDs will "trip" much quicker than an MCB and their purposes is to prevent electrical fires and shocks resulting in death. Things like a light bulb blowing can trip your RCD, so to avoid total darkness most modern CUs are configured in 2 circuits. The idea being that lights from the ground floor and sockets from the first floor go to MCBs on 1 RCD and lights from the first floor and sockets from the ground floor on the other RCD. This means if your lights go on one floor you can still use a socket to plug a light in.
In my configuration this is taken a step further, as my house has 4 floors I have 2 CUs. Each RCD has a number of circuits coming off it facilitated by an MCB, for example lights for the cellar, sockets for the ground floor, boiler, security lights etc. From each MCB I take a feed (Live) down to the distribution board below.
My distribution boards are made from IP rated steel enclosures with back plates, to which I have mounted din rails. The din rails will hold all my switch gear which will be a selection of SSRs, mechanical relays and contactors. I also have some proper din mount automation kit I am trying to hack the protocol for, but more on that later.
Here is a little tour of what I have done starting at the meter...
I got my energy provider to upgrade my meter tails between the main fuse on the left and meter with 25mm and I also got them to install an isolation switch for free :)
What this allows me to do is switch off the mains without pulling the main fuse myself (which you're not supposed to do). At the bottom you can see an adaptable box, this is where I split my meter tails after the isolation switch to 2x 16mm SWA cables. In the adaptable box is a 2x 5way Henley block which splits the live and neutral, there is also an earth block. A tip here is to make sure you get a big enough adaptable box, else you will waste hours like I did trying to bend and connect 16mm cable (not easy). This way you get a little extra room and slack to work.
The 2 armoured cables then go off to my 2 CUs (via a couple more adaptable boxes).
This is my main CU which will control the cellar, ground floor, central heating and garden.
The black box on the right is again another adaptable box, with SWA (armoured cable) you can't just stick it in to a plastic box like a consumer unit, instead you have to use a metal box so you don't crack what ever it is you are connecting it to. SWA is connected using a gland which is a bit like a hose pipe connector, it tightens on to the cable and allows you to connect the cable to something (in this case the adaptable box).
This then goes to the main switch on the CU which is spilt out to 2 RCDs which are the large modules you can see and they further split out to MCBs, which are the smaller modules you can see.
Evidently this doesn't look so neat at the moment and this is because it is still in a temporary layout whilst we test the connections throughout the house and whilst I get the distribution boards properly laid out.
As an example of how much I have going to this board, the mass of cables in the bottom right are the majority of the cables just for the cellar and ground floor. A tip here is make sure you mark your cables at both ends, else the connection process will become a nightmare!
There are a few cables which you might be able to see coming out of the MCBs and going down to the distribution board. These are my functional circuits such as ground floor lights, kitchen sockets, boiler, cooker, etc.
The distribution board is a little sparse and very messy at the moment, at the top you can see the earth commoned together. Below this is some 60A choc block which is currently connecting the kitchen sockets up. In the top right behind the mass of wires is the ground floor lights. The bottom left is a 24v PSU and a 40A relay I have been testing with above it. The white bar is some cable management trunking which will be present throughout once I finish. Finally the 2 MCBs at the bottom right are just being used temporarily to connect the ground floor sockets up.
This is by no way adhering to any electrical standards currently and is only in a format that should be used temporarily for testing.
Once finished I will have a rail that will distribute earth and neutral, the live will go to the supply side for each relay and each relay will have a live feed coming from the supply from the corresponding MCB and daisy chained between the relays.
It is important to physically isolate mains and low voltage, so all mains will run down the right hand side of the enclosure and the low voltage control signal will run down the left and no switching will leave the enclosure. This is really important because if anything went wrong you could end up with mains running through what you think is low voltage control gear. To enable this I will be using a netduino housed in the enclosure with a control board that will switch the relays using 24v. The netduino will be controlled wirelessly using a gainspan module and will be in a plastic box to physically isolate it. You could also use IR as an alternative, but the idea is to keep everything contained within the enclosure.
The control protocol is something I am still deciding on, whether I go the message based route using MQTT or if I implement RESTful services or standard GET POST methods.
I have been working on my database architecture quite intensively and have chosen a layered approach.
I wanted to have 2 separate databases to separate concerns such as audit/security and application data but be able to interface with the databases seamlessly using the same pattern.
My data layer is split in to:
- Data and helpers
Data contains the database definitions, UnitOfWork and Repositories. Within helpers I have RepositoryFactories, RepositoryProvider and IRepositoryProvider
Contracts contain IRepository and IUnitOfWork.
Ninject contains the IoC for my DAL.
I keep my models and enums separate so I can use them throughout all layers.
I then have a BusinessLogicLayer which contain all my application logic and I working on implementing workflows here.
Finally I am working on a service layer which will provide a point where all my applications can interface with my database.
My next task is to finalise my control boards for switching my relays. I have some ULN2008 which allow 24v to be controlled directly by a netduino.
Once this is in place I will be working on some netduino code to control these boards.