 Welcome. This is the world premiere of the heating pie. Nobody has seen this apart from you. So, I thought nest great, hive great, looks lovely, but it has the same concerns that I know the OpenTRV guys are looking at. It is essentially one sensor, probably in a really awful place in your house that just, you know, doesn't work. You might, if you're lucky, have a two zone system if you're really posh, but really that's about as far as it goes. So then, yep, your entire house fires up, but I don't live my life in my entire house at one time. So, I go to bed, I want to be warm at night, I get up, I have my breakfast, then I go out to work and then I come home and I might want my dinner and then maybe I'll spend some time in the living room. So I'm moving around my house and I know roughly where I'm going to be and when I'm going to be there. So, a sensor in the hall that turns on the whole damn house at once when there's really just me, the lodger and the cat is not terribly effective. So, I thought, you know, carbon guilt, maybe I can reduce things a bit. I wasn't really doing this to save any money. I just thought it'd be nice to burn less carbon and maybe eventually it'll pay for itself as well. So, the other major problem you've got with certainly dumb timers is that at best you've got a two day weekend. But I know lots of people and I used to be one of them where maybe you get Saturday off and then maybe you get Wednesday off. So your standard five day, two day set up, no bleeding use whatsoever. You end up turning it on and off manually again at which point, what's the point in having a timer? So, this is the heating pie. Now, I know, it's an exciting box. So, that's the heating pie. There you go. So, the major driver of this as well is I wanted to do this totally off the shelf. I wanted to do it cheap. I wanted to do it easily replaceable by anybody, i.e. the main brain of the computer which is always the expensive bit. I didn't want that to be in any way proprietary. I wanted you to basically be able to buy or implement this bit and then if this bit goes wrong, which is normally the expensive bit, you just buy another one and shove it in there. And that's why I went for the pie. Everybody can get hold of a pie. You just buy a pie, shove in your SD card. The rest of it, you can indeed bolt together yourself as did I. Or maybe I'm thinking for heating pie 2.0. It might be nice to make all of this and then just plug your pie in if maybe you're not keen on doing all this soldering and wiring and all this malarkey. But the whole point was the expensive bit normally is the computer. Pies are not at all expensive and you can get them anywhere. So, okay. So, this bit standard. This bit, about 8 quid on eBay. That's a load of relays that are switching, in my case, 240 volts out to the radiator valves. And then the only slightly unusual tricky bit is the middle board here, which I made my very self. It was very exciting. You've got a bridge across from the pie. You've got hidden under there, but we'll see it in a minute. There's a couple of pin headers that go out to this lot. And then you've got a load of diodes and a load of ribbons to control this bit. So, I needed the diodes because I found out that if you turn on two of these channels at once they start backfeeding into all the other ones and then all these little LEDs on the relay boards start lighting when they shouldn't do. So, the reason for that is because all of these diodes connect to one central rail here would then also turn on relay 8. And that's the one that controls the boiler. So, in other words, if any one of these radiator valves are switched then the boiler also comes on because you need the boiler to work. That's quite important otherwise you don't get any heat at all. So, okay. So that's the point at which you could be easily pairing two pins together, backfeeding, blow your pie. Well, I didn't. I got away with it. So, okay. Now, the only bit of this that doesn't run 240V is the boiler connector because all you're doing is you're closing a switch as far as I'm aware, the majority of boilers. It might be worth checking if you are installing your own system whether that's actually the case. But, yeah. Now, I know the OpenTRV guys said a couple of years ago they might actually blow up a boiler. So, I was quite keen not to do that. But having already installed my own boiler at the time I knew it was just a question of closing a switch. So, that's easy. So, all of that switch in 240V that's just closing a switch on the boiler. That's one wire goes down, closes the switch, boiler fires up whilst you're opening your valve. The other parts of this that's 240V live. I couldn't get a red one. That's 240V neutral. So, the relays are basically interrupting live there and the common neutral goes onto these what you call them, chocolate blocks, terminal blocks. So, I've realised in doing this, this is very much a prototype stage as I'm sure is very obvious that you could probably make it hell of a lot smaller. You don't need this at all. You can just daisy chain your negative across all of these three so you can get rid of that. That saves you about eight quid right away. I think for development purposes this could maybe developed as a pie hat. So, it will just chuck straight on and then you just pin out to the relay and then version three might be to say okay, maybe incorporate all of this bit into one actual board then just connects into the pie hat and what you end up with is something about the size of a domestic router. So, rather smaller than this lot but hey, this works and I made it, which is great. So, that's your middle board. In comes your pie header. There's your three pinouts for your thermo sensors. They need a 4K7 resistor. So, put that on the board and in workouts as well turns out I did a couple of bits wrong, whatever. This is your 5V out which runs the relay board because that needs 5V power supply and the pie will give it one so that's great and then you've got all your connectors out to your relay and there's your diodes out to your common rail which then switches out for the heating sorry, for the boiler itself, right? So, any time you bring these live your diodes come out bring live this common rail which switches your boiler, is that clear? Good. So, okay. I looked at wireless heating valves and they were either very expensive or they were proprietary or they weren't ready yet or I didn't understand them or I thought well I'm going to have to put batteries all around the house and I don't like batteries because they're not very green and I thought I don't have a wife so I don't have to worry about cables I can just, you know, and boxes on walls I don't have to worry about anybody's aesthetic sense I just want somebody to turn me heating on and off so, no problem I just bought 25 quid each some heating valves and they run on 240 volts they do do a version that's 24 volts and I think if I were commercialising this in any way and sticking with the wired approach I'd probably go 24 volts because I don't like being sued if anybody zaps themselves so, whatever it basically just daisy chains across into this very neat and tidy wiring system here which is just a replica really of what was in the other end, boxes in the other end so it just keeps daisy chaining round so, what you've got I've gone for seven core because it was available and cheap you've got three sets here which is you've got grounds, you've got live and you've got data probably got the wrong wiring but those three basically are dealing with this sensor here you've got your common 240 volt negative and then one, two, three channels of 240 volt live so, in this particular instance I've got this controller wired into channel one so in the other two rooms you've got channel common negative channel two channel two, common negative channel three there's no reason why you couldn't go for ten core mains if you wanted to it's just that seven core was cheap and where I've got my box I can go one way I can go the other way seven core meets my needs but you can do what you want it doesn't matter so, there is another resistor in here because I was playing with it but I hope they'll out later this, by the way is a Dallas Systems DS1820 which you can get Chinese copies of this is a Chinese copy for about a pound on eBay you can buy them in batches of ten they're stupid cheap so, the nice thing about this is you can have as many sensors as you like all on these three lines the other sensor I was using was very nice because it measured humidity as well but you would need one set of lines per unit so you've got a 40 pin header on your pie suddenly you're out of pins if you have any size house whereas this, you're only going to use three headers on the pie so that's why I moved to this particular sensor it's also quite nice so that's a close up exactly the same photograph I've just cropped it down three data lines, common negative one, two, three, 240 volt dead easy there you go I'm sure you can all read yep, basically everything I've just said I've preempted myself no problem so, it cost me about 400 notes to pull all this lot together now, I am actually very interested in talking to the OpenTRV guys because I've read their website and apparently you can get an OpenTRV for about a tenner so, if they can bring their cost down to that point that's a hell of a lot less than the 25 quid I paid to the Danfos Randall guys so that really brings your prices down straight away and equally, you can do things with the control box and the enclosed parts and whatever but wires I'm afraid cost you money no matter what you do, you run wires it costs you cash because cop is pricey not so much as it was the other thing I've found, and this is quite interesting if you turn on your entire house at the same time the entire house heats the entire house you snatch heat from each room or you leave a couple of doors open and you get a bit of circulation, whatever I get cold at night and I was finding that with this system with my existing radiator I was freezing because I was only heating my bedroom and not the rest of the house so I don't get to steel heat from anywhere else from below, from besides, whatever so I had to spend a little bit more money putting bigger radiators in my room and in my lodger's room so that was an expert expense that not everybody would face basically I had my heating system originally fitted on the cheap and so I've had to spend a bit more money later so key lesson, big radiators everywhere because you're only running that one radiator at a time and the other thing I found was that I listened to my boiler and I can hear the pump constantly circulating but the boiler isn't firing because the water temperature has not yet dropped enough because you have not yet lost enough heat from the circuit so if you're only firing one radiator at a time you can't dump that heat quick enough so bigger radiators dump the heat and the boiler will thank you and you'll actually get some heat which is always an advantage in a heating system so the only other radiator you're going to need in common with any system that's got thermostatic radiator valves you will have to have one radiator that's open circuit I chose the one that's in my, what you call it, hallway because, well, it's only small and it's fine so that's quite a common way to do it so the other thing I wanted to do I hear what the OpenTRV guys are saying about not wanting loads of apps and web pages and none of that I like web pages so here's mine, there you are so when you log on to the eating pie this is the first page you see there is also a clock in the top right corner that I haven't screenshoted that was important because I did have a failure where I couldn't work out why all the timings were off and it turns out that the clock was wrong so now I just print the time on the page so you can look at it and know instantaneously that your time is right I also run a cron job every hour to just ask for the time just to make sure we have actually got the right time so it's fairly clearly laid out you can label these anything you like these are the temperatures you want this is obviously bollocks, nobody wants 10 Celsius this is the temperatures you actually got at this actual moment now this is quite clever because bash doesn't do decimals but it turns out that the Dallas systems themselves do they do decimals as to the power of a thousand so you get five numbers so you can just grab the first two, print a dot then grab the next character, print that to me text file which I come to in a minute so even though bash doesn't do decimals you can do decimals you just got to script it, no worries and then just for the sake of I know what's going on have I actually got any radiators on or off at this present moment just as I can see it as a snapshot so this is my bathroom again this is not live obviously so temperature I've got, temperature I want I can select a new temperature at any time and it will maintain that temperature until the next change point so if I set it now then at 6.30 tonight it'll change to the next selected temperature so if I change it now I've got that temperature for right through till 6.30 so this bit comes back to scheduling some people have crazy lifestyles you notice I've got a different pattern to weekend to weekday but again I might be off on Wednesday so I might have a different pattern there ok the other cool thing from my bathrooms point of view 11 o'clock in the morning 25 Celsius my tower radiator comes on yeah ok why not you can do this I'm not turning on the whole house this is my bathroom it is a tower radiator let's dry my towels for half an hour why not bit of code this is run as a cron job so the first thing I found is you need to actually change into your working directory the next thing you do and this took me some sorting out the thermostats themselves if you leave them running all day they break so what I've done I turn them on I wait 15 seconds for them all to settle in pole I use them and I turn them off and then they don't break which is always a plus so the other important safety concern once you've turned them all on and waited for 15 seconds you've got to check that they actually work because if you don't do that the entire house turns on for hours so have I got any output from room 1 radiator if I have great if I haven't this circuit turns off every radiator in the house so the failsafe is that if it doesn't work everything goes off a rather cold house than an expensive hot house on balance so we've got a nice little script here I haven't screen shot it but it grabs the current time and then rounds it down to the last quarter hour because my schedule is on a quarter hour basis that's how granular we go which comes back to this one see, quarter hour points so the next thing it does is it works out what day it is that's important because you have to know which column of my schedule you're looking at so all it does is it sets a character offset I know I'm looking at column 6 that's fine this is the actual schedule so here's your quarter hour segments here's your columns for the different days of the week so that previous bit just says yeah fine I'll have this column at that time okay so I don't know what I'm doing this was a project I know how I'm going to do heating by 2.0 for now this works so what we do is we say yeah okay what's all the temperatures of all the rooms at the moment write them out to text files it turns out that four loops are really handy because what I was doing was just repeating this text seven times and changing one value each time which is stupid so yeah and it also sends them out to the log so I've got logs of every day for the last several months if I want it then okay we say what temperature do we want what temperature do we have shall we turn on a radiator the next part of the code for all every single room what temperature do we want what temperature do we have shall we turn off a radiator now this is really important to do it this way around I don't know for sure but I'm fairly sure that if I told my radiator to turn off and then a millisecond later turn it to turn on again it'll probably get quite upset whereas if you do all of your on's first then you're never going to be in a situation where you turn off then on again you're already on so the worst case scenario you turn everything off that's fine radiator's happy but telling it to turn everything off and then turning one radiator back on again immediately not going to make it very happy okay so the very last piece of the script basically you remember we turn off all the thermosensors and then we copy the very last bit of heating.log to lastlog.txt just so I can get the very last cycle very easily so and that's a not the full screen print but that's basically the directory layout so I've got one script which you've just seen called onoff.shell which occasionally calls from various other ones you've got the relay python there and then each room's got its own bit that deals with the schedule what values, what temperature you want and what temperature you presently have so heating pi 2.0 this is where I'm going so yes we've already talked about possible radio control of the valves custom boards whatever right the major thing is the way I did this I wanted to understand it which I felt was important because it was my project that's why I went for bash that's why I stole various bits of python from other people that's why I did not use a database because I've never used a database and quite honestly I had enough on just doing this lot so next iteration probably will give me databases with user account control because I think of something that may be sellable to people in the future so you send out your pi with the SD card already loaded and you can set it up yourself at home possibly I don't know so maybe there's possibility of making some money and managing this for people I don't know I haven't really thought about that far I'm just using raspberry OS so maybe I can strip some of that out and make it smaller because why wouldn't you and then yeah this whole thing with writing out to text files all the time and reading back in again maybe I could just do that and ram save a few writes to the card and what not maybe help with reliability and maybe there's just no need to do it that way anyway so yeah middle board could be a pi hat I'd like to make some money out of this and I know the OpenTRV guys have had various grants along the way and I'm actually quite interested in that so that basically is your lot does anybody have any questions thank you