Welcome to ned Productions

by . Last updated .

Welcome to ned Productions (non-commercial personal website, for commercial company see ned Productions Limited). Please choose an item you are interested in on the left hand side, or continue down for Niall’s virtual diary.

Niall’s virtual diary:

Started all the way back in 1998 when there was no word “blog” yet, hence “virtual diary”.

Original content has undergone multiple conversions Microsoft FrontPage => Microsoft Expression Web, legacy HTML tag soup => XHTML, XHTML => Markdown, and with a ‘various codepages’ => UTF-8 conversion for good measure. Some content, especially the older stuff, may not have entirely survived intact.

You can find the posts here replicated onto Diaspora, if you prefer to subscribe there instead.

Latest entries: Feed icon

Sunday 19 June 2022: 22:29. A little later than usual due to me being so busy recently, here is the annual update to my periodic comparison of storage bytes per inflation adjusted dollar for magnetic hard drives, flash SSDs, and Intel Optane XPoint devices (you can find all the past posts here), which I have done every June since 2012:

Raw data: http://www.nedprod.com/studystuff/SSDsVsHardDrives.xlsx

This time last year I predicted:

I expect this time next year hard drive prices will have dropped back onto their long term trend line, and SSD prices perhaps will be flat. We shall see!

I called it right for hard drives, but I called it wrong for SSD prices which saw a better than trend improvement. Optane remained not just flat, but inflation adjusted flat which means Intel are proactively marking up Optane’s price with the inflation rate. Which explains why Optane remains a niche technology, as the performance per dollar gap between it and SSDs continues to grow .

Inflation in the past year in the US was something like 8%, so it is surprising that US dollars buy more hard drive and SSDs given the lack of inflation in the East where both are made. However, most raw materials and international trade is denominated in US dollars, so maybe inflation in the home market doesn’t necessarily mean loss of purchasing power outside it. After all, nobody is getting paid more, so Americans are getting poorer quicker than the Asian manufacturers whom only have to deal with raw material and energy price increases. In other words, the West is getting poorer quicker than the East because the West is seeing more generalised inflation, and I suppose that translates into a transfer of relative wealth from the West to the East. Thought about in those terms, I guess price drops could make sense from a Western relative viewpoint.

Looking forwards, it seems all but inevitable that price inflation will exceed 10% in the US and maybe even in the EU, though in Europe non-energy non-materials price inflation is being tamed by war’s effects on energy and materials supplies where outright lack of availability at any price means GDP is impacted, and that in turn dampens price inflation because the economy is weakened overall. I suppose where things get interesting is that lack of energy and materials supply also pushes up prices in the East, so I would assume that where computer components get manufactured is going to become rather more like Europe in the next twelve months i.e. everybody getting noticeably poorer because the cost of living substantially increases. That, in turn, probably means less demand for hard drives and SSDs, but also increased costs to raw materials and wages, so I’m going to suggest that both hard drives and SSDs will improve again this time next year as surplus capacity fights cost of manufacture.


Saturday 28 May 2022: 02:01. Last post I mentioned that final grant of planning should have been issued by early May, however delays in the planning office meant that didn’t happen for a few more weeks than expected. However, it did eventually happen, and I am glad to report that as of this week, I am now the owner of the land upon which I got planning permission! I signed the final transfer deed this week, it’ll take a few months before the Land Registry is updated, and that is indeed a huge weight off the shoulders given how much price inflation building sites have seen recently, never mind their scarcity.

The land transfer starts a countdown: In Ireland when you purchase land, you pay a stamp duty of 7.5%. If you commence the building of a dwelling house within thirty months from that date, you get a rebate because your stamp duty drops to 1% of the cost of the land and the building of the house less VAT. In my specific case, that’s worth about €1,500, so it’s worth aiming for.

The other big deadline is the end of this year: if I commence build before then, I get a €30,000 subsidy from the government. I very much doubt if we can get construction detail done before then, so we may have to think of some way of commencing a build before we know the precise detail of what we’re building. We’ll see how it goes.

A full nine months has elapsed since my last update on my P2P earnings #mintos! We’re running towards the end of this now I intend to start spending it – indeed, end of this month I’m going to disable the auto-invest and start letting the loans pay back into cash. It’ll take a few years for them to full pay back out, but from past experience a large majority will get bought out well before loan maturity.

MonthMintos annualised return for each monthMintos non-earning capitalMoncera annualised return for each monthAfranga annualised return for each month
August 2021 10.91%27.4%11.42%
September 2021 6.78%27.2%7.28%
October 2021 11.96%18.9%10.17%
November 2021 9.22%46.1%11.88%
December 2021 6.02%58.5%9.66%
January 2022 5.31%58.3%11.19%7.11%
February 2022 6.12%20.6%10.03%11.10%
March 2022 5.85%20.5%9.58%15.25%
April 2022 9.62%20.3%8.15%9.33%

A reminder that some money is tied up in non-earning Polish lender Capital Service, who will repay it eventually, but for now it drags down the annualised return rather significantly. If you exclude that non-earning capital, Mintos still does pretty well – I reckon about 11.5% in April, and I’m only investing in the super safe loans from DelphinGroup, which https://explorep2p.com/mintos-lender-ratings/ recommends highly.

Moncera (Placet Group) has been a bit of a disappointment since I started investing with them in March 2021, they’ve actually returned a touch under 10% annualised since the beginning. Around November 2021 I moved money out of Mintos because all the high quality loans there dropped to below 10% annual return. I moved them onto Moncera because they claimed theirs were over 10%. However there have been some cash drag issues, plus quite a lot of them have gone late, and that’s dragged down total return quite markedly. It’s not just Moncera, Afranga also saw cash drag and a large increase in failure to repay, most noticeable in the reduced return in April. So I suspect the war in Ukraine, higher living costs, and all the other kinda-recessioney stuff is beginning to bite in Eastern Europe.

Obviously, with inflation now running in the EU at 7% and climbing it rather ruins my strategy of keeping a portion of my cash in these p2p loans to offset losses to inflation. One is losing value in any case, and I’m going to need all my money by next year for the house build, so time to start winding all these down.

This may or may not be my last post on P2P investing. I may be coming into an amount of money soon which cannot be remitted into Ireland which will need placing somewhere. To explain, under Irish tax law non-domiciled people such as myself only pay Irish tax on monies I remit from outside Ireland into Ireland. All the money in these P2P investments to date has been post-tax money saved from income, but if I do come into money from outside Ireland then I’ll need to keep it outside Ireland so I don’t pay tax on it. These P2P lenders are domiciled outside Ireland and the loans are not invested in Ireland, so once my post-tax money has been paid out, I may reuse the accounts for pre-tax money. All this is months out whatever the case, but it may generate a few more posts here next year maybe.

(You may wonder why not put the unremitted money into an index tracking fund or mutual fund? Irish tax law currently ‘sees through’ non-domiciled status for investments in offshore funds domiciled in the OECD, which is pretty much all those which are safe, and taxes said offshore funds at a fixed rate of 41% rather than as income or capital gains. So you cannot put unremitted monies into offshore funds without creating a large tax bill. You might then think of shares in companies, but most countries charge a withholding tax on dividends, so they’re out. You’re now down to investing in gold, commodities or going synthetic with Contracts For Difference (CFDs) which are how you bet on the stockmarket – using CFDs you can synthesise an investment in something without doing the investment, and crazily enough the Irish tax authority is just fine and happy with that, which makes no sense to me. Because P2P lending is still too new, withholding taxes haven’t been levied on it yet, so for now at least this is an option)

Up until now capital preservation with easy access was the priority in my P2P strategy, so I have invested accordingly. If I wasn’t intending to remit investments for many years, then a very different P2P approach would make sense, one mainly based around secured lending. This should pay out around 11-12%, which is about what Mintos historically has done for me, but with much lower risk as collateral such as a building or a farm is used to guarantee loans. And if you want a bit more risk, you can also crowd purchase whole apartment blocks, take the rent from tenants as income, let the property value appreciate over a few years before exit. Then you can capture rising real estate prices in Eastern Europe, which is nearly a one way bet, at least compared to Western European real estate markets which see far lower growth.

And if you’re really keen on risk and have a long enough time horizon, there is p2p lending in aircraft leasing, artworks, sports cars and all sorts of niche things. Probably too rich for my blood, but glad to know it’s an option.

#mintos #p2p-lending

Sunday 17 April 2022: 23:36. Two and a bit months have passed since my last post in my series on my future house build where I showed computer renderings of the ‘shrunken’ seventeen metre wide house designed to fit inside one site of the two I hope to build upon. This was the conservative design intended to not be controversial to the planners, and last post I expected a final decision by June.

I am glad to report that the planners moved a bit quicker than expected, and we received notification three weeks ago that they intend to grant planning permission in early May if no appeals to the decision are lodged. If final permission is granted, then begins the process of purchasing the sites, which will take at least two months. I feel a little nervous about the purchase as sites have risen in price by about 15% since we agreed to buy them last year, plus I successfully cleared the previous planning blockers on that estate by getting local political representative John Paul O’Shea to intervene, so I have this horrible feeling that the sale will go wrong. Only when the land deeds are into my hands will I rest easier.

You can see the planning application and all the gory details at http://planning.corkcoco.ie/ePlan/AppFileRefDetails/224184/0, however to summarise there were only a few absolutely ordinary conditions imposed by the planner:

  1. The proposed development shall be carried out according to the plans lodged.

  2. A commencement contribution fee of €6,342.91 shall be paid to Cork County Council (this is based on internal square meterage of the property, and as much as it looks high, it’s less than half what it would be inside the city).

  3. All new planting on the site shall be native in origin.

  4. Any cutting of vegetation shall be outside the bird breeding season.

  5. No muck nor debris to enter the public road from the site during construction.

  6. Prior to commencement a connection to the public water mains is required.

To be honest, considering some of the conditions imposed by planners on previous developments in the same estate, these are very unimposing. Even only a year ago they were imposing a lot more onerous conditions. I suppose this is a new planner, from the preplanning feedback we really thought she was going to be even harsher, but in the end it turned out not to be so. I’m not complaining however!

The ecological report reckons the development could affect in the Blackwater Special Area of Conservation (these are protected under EU law):

  • Floating river vegetation.
  • Freshwater Pearl Mussel.
  • Sea, Brook and River Lamprey (Eels).
  • Migrating Salmon.
  • Otters.

Of these, the Freshwater Pearl Mussel is the most likely to be impacted, despite them being about 60 km downriver. Indeed, in the application as I described last post I submitted a Habitats Screening statement on said Freshwater Mussels and how this development would not impact them. At that time the Council didn’t employ an Ecologist, which is why everybody had to contract one in, so I took a stab at writing my own report. That turned out to be superfluous to needs, but there was no way of knowing that at the time.

I guess the most surprising thing about the planning approval was the decision to permit materials other than smooth painted render everywhere. They permitted the low stone wall at the front, the charred wood in the middle, the zinc roofed porch, and the expansive glazing element at the front. They also had no issue with the large greenhouse at the back, and the entire of the south facing roof being solar panels. Surprisingly open minded of them.

The planning application for the larger twenty metre house went in a month ago, but it got bounced because I didn’t use yellow paper when printing the copies of the site notice in the application (I did use yellow paper on site). So I had to pay for another newspaper advert, reprinting and reerection of the site notices, and a bunch of other stuff had to be adjusted in the six copies of everything in the application, before I was able to resubmit it end of last week. Assuming it takes three months, that means we’ll hear back about it mid July, which hopefully will be around when I should get the title deeds into my hands. Obviously, if they just go ahead and approve that planning application, then it’s off to the races in terms of getting started on construction detail, but if they don’t approve, then we’ll need to figure out what to do next based on whatever the planner writes in their report as the basis for rejection.

In any case, none of this is anything worth worrying about for the next few months, so I can go focus on other things. My next non-work work task is proposing standardised secure sockets for C++, specifically the proposal paper for WG21. I need to bang it out using my very limited non-work time, and get it submitted and then that’s off to the races as well.

Then it’s all the other stuff I had hoped to get done or even started and I haven’t. Sigh. If only there were more hours in the week!


Sunday 6 February 2022: 02:58. It’s been just under three months since my last post in my series on my future house build, and during which of course Christmas occurred. Since the New Year pretty much all my free time has gone on getting the planning application ready – it was submitted last Tuesday, and so I now have the time to write up what happened since mid-November.

The preplanning feedback came back the week of Christmas, so we didn’t really get much time to digest it before everything stopped for the holidays. Things didn’t really get going until mid January, whereupon we started acting on the feedback (which I have slightly edited for privacy and clarity):

I have reviewed the proposal submitted and I would have the following comments to make in relation to same.

  • I note that the governing permission on the subject site is 00/4700. I would draw your attention to condition no. 3 of the original grant which notes the following

    • The construction of traditional type dwellings the siting, design, external finish and architectural standard of which shall be to the Planning Authority’s satisfaction and in harmony with the environment of the locality.

      Reason: To ensure a satisfactory standard of design and layout for the proposed development in the interests of visual amenity.

  • I note the subject site is located within the development boundary, where the sites are zoned existing built up area. On this basis, the principle of the construction of a residential dwelling is acceptable.

  • In terms of the amalgamation of site no. 29 and 30 to facilitate the proposed development, I would have concerns in relation to the sustainable use of land and lowering the density of development within a defined settlement boundary. A strong justification for the amalgamation of the sites would need to be put forward at application stage, this should include analysis of no. of serviced sites available within the settlement boundary.

  • In terms of design of the proposed development, it is noted that the specifics of design and layout are usually addressed at application stage. However, I note drawings have been submitted with the preplanning request. On this basis, I would have the following comments in relation to same

    • I would have concerns in relation to the overall scale of the proposed development in the context of the existing housing estate. The overall scale of the proposed development would appear from the submitted drawings to be excessive given its context within the existing housing estate and it would not be considered to be keeping in character with the existing dwellings in the estate.
    • I note that the housing development comprises various styles of dwelling, however, there is still an overall general consistency of appearance. While a more contemporary dwelling could be considered at this location, it should still aim to be consistent with the general appearance and character of the dwellings in the vicinity of the sites.
    • I would also refer to the condition no. 3 of the governing permission set out above which required traditional type dwellings.
  • As an update on the WWTP in the village, it is considered that there is some capacity within the treatment plant. However, all applications looking to connect to the plant going forward will be referred to the Executive Scientist and Ecologist. There is not too much more that I can say on this at this stage, however, updated information may be included in the new Cork County Development Plan which is set to be published in early 2022.

If the above seems vague, non-commital and rather hard to discern exactly what they want changed, that would be normal for preplanning feedback – nailing colours to a mast removes later flexibility. That said, after a bit of thought and study their feedback could be rewritten into more concrete terms thusly:

  1. Despite that the current style guide is the 2011 guide (very shortly to be replaced with the 2022 style guide), we want this house to meet the 2001 style guide because that was the guide in force when the estate’s original planning was granted, and the existing houses were theoretically built according to that style.

            (The reason this matters a lot is that the 2011 style guide bans gables, whereas the 2001 style guide effectively requires gables. We designed towards the current guide (i.e. gableless), so now we need to redesign around gables jutting out everywhere!)

  2. No materials to be on the outside except light coloured smooth painted render, as that is what all the other houses in the estate are supposed to be (and which most certainly are not, as they acknowledged).

  3. They don’t like the idea of one house spanning two serviced sites in a way which permanently reduces housing density, but left open a possibility that they could be persuaded if it did not set a precedent others could later reuse.

  4. They think the proposed house and its framing too big.

  5. Planning applications submitted from 2022 onwards will require an Ecological Impact Assessment, and one will need to prove that how one connects to the WWTP will not impact the Blackwater Special Area of Conservation which is protected under EU law.

To deliver on these we did:

  1. Gable-ified the design, particularly the ‘shrunken’ house (more below).

  2. Removed most of the non-smooth-painted-render materials, and shrank the area of what remain.

  3. Made a second design of the house fitting into a 17 metre width rather than its original 20 metre width so it can fit into a single site. This ‘shrunken’ house became our fallback plan, the conservative option likely to get planning permission. It is this I submitted last Tuesday for Site 30 only.

    Also, given the phrase ‘A strong justification for the amalgamation of the sites would need to be put forward at application stage’ it became obvious that we would need to hire a specialist Planning Consultant to help us write the planning application for the 20 metre house i.e. a former Planner who knows how to write in Planner-ese. Alas, Planning Consultants are expensive, quotes came in between €800 and €5000 some with long lead times. We ended up choosing a lady who could get started within a few weeks for €3000.

  4. Removed the extended framing from the 20 metre width house and built it up higher with gables in order to make it look shorter and less different from the other estate houses.

  5. I wrote a Habitats Directive Screening statement which followed the EU framework for describing how we will impact the Blackwater Special Area of Conservation both during construction and during the lifetime of the house. One normally pays an ecologist €800-1000 to write one of these, I cobbled mine together by exhaustively assembling all the Habitats Screening statements from preceding planning permissions in the same area, and I replicated the same points they made using similar language, but also customised it slightly to describe how our rainwater harvesting tanks are good for the Freshwater Pearl Mussels 64km downstream in the Blackwater by attentuating stormwater surges to the WWTP etc etc. We shall see if that sticks!

The ‘shrunken’ design

This 17 metre design looks very much like the 20 metre design submitted for preplanning I showed pictures of last post, but we had to make a fair few changes:

  1. The loss of three metres of width means more spillage of floor space into depth, so both front gables come out a little further and a whole new gable appears in the back.

  2. As we no longer have the width to put the home office over an internal bridge into the upper floor west, the eastmost front gable goes to two storeys and the home office goes into the upper floor there instead.

  3. As the internal bridge no longer makes sense, the main vaulted living space area gets both wider as well as shorter. This makes a master bedroom infeasible in the westmost front gable, so we move the plant room in there as it is now comparatively small. The master bedroom now goes into the rear gable.

Otherwise, apart from size changes, things remain as they were, though energy efficiency according to the PHPP takes a dive of about 20% because there is much more surface area than before for less internal floor area. Also, the margin for minor builder error in airtightness to reach the Passive House Plus standard shrinks from 40% to a mere 24%, a 67% reduction .

I am fortunate that Twinmotion 2022 beta had come out since the last post, and using it I was laboriously able to make ray traced images this time. They look a lot better than those from the previous post, though I had to dial down the quality settings severely given my emaciated graphics card. Note that these are missing the greenhouse on the back and a few other minor changes.

My ray trace of the original Twinmotion file setting correct latitude and longitude for our house’s location and orientation. Sunbeams are for 12pm on the 1st March. Pictures progress top left to top right downwards, finishing from bottom left to bottom right: (i) view from living room towards kitchen; (ii) view from front door at kitchen; (iii) view from front door at kitchen and living room; (iv) view from front door at living room; (v) view from mezzanine library reading area downwards into dining table and living area; (vi) view from mezzanine library reading area out front windows of house.

There is also the master bedroom and the games room:

Heading out of the master bedroom, which has a door opening into the back garden, the back of the house is remarkable only for the number of solar panels on the roof:

A reminder that the lean-to greenhouse on the back was yet to be added, and the green ethereal building next door is a hypothetical house. Moving around to the front:

As you can see, we have hacked back the surface area of unapproved materials severely, with the northern glazing column reduced from three wide panes to two narrow ones, and the bottom half broken into a forward extended metal porch, albeit without much metal showing. This shrunken design surely should tick the planner’s boxes.

What’s next?

Now that the shrunken design on the single site 30 is submitted, our next task is to prepare the planning application for the 20 metre wide house in collaboration with the Planning Consultant. No doubt she will write the application in a way that if it gets rejected, it is designed to go straight into An Bord Pleanala, the national appeals mechanism for planning. That takes a further four months and yet more money in fees of course.

However there is a third option – submit a third planning application for the same land, this time with the shrunken house occupying Site 29 but with the boundary around both sites, possibly also with the outhouse from the slightly larger house. It can thus be argued that Site 30 has not been consumed nor made unavailable for future development in any way. Whether this is worth doing, or is feasible, depends on how the Planners react to the 20 metre wide house: if their primary objection is that the extra three metres of width renders the other site permanently consumed, or that three metres longer makes the house too bulky compared to neighbouring houses, but otherwise they don’t object, that would seem the obvious path forwards. If, on the other hand, it is the fundamental principle of granting planning on amalgamated sites at all as it would set a precedent, then it probably doesn’t matter what you put on those two sites. We’ll only find out when the Planners deliver their verdict.

Assuming that getting a verdict on the single site application will take four months, that puts a decision into June, with a decision on the dual-site application probably landing in July. Completing the purchase of the site might take two months starting from June, so nothing more could happen anyway until August. If it then goes to An Bord Pleanala, I suppose concurrently we submit planning application number three and we should hear back from both of those around December 2022. We then could begin detailed construction drawings which I can’t believe would take anything less than four months, probably six months, given that the Energy Consultant will be in there, as will a M&E consultant and probably a garden designer. Thus only in June 2023 would one be ready to approach builders for construction quotes as the upper bound, with the lower bound no earlier than January 2023.

Both are rather a long time away, though almost certainly by then price inflation should be getting tamed by interest rate rises and a slowing economy should debottleneck materials and labour supplies. I’m also not entirely sure that even if we booked construction by the end of this year would it actually speed anything up given the backlog in the self build industry, though it would almost certainly cost us more. So, in all probability, it will be 2024 no matter what we do before construction begins.

My original plan was to build the outhouse first and install services into it, this would let me commence building and thus be eligible to draw down €30k of government subsidy, lest the government reduce that next budget. I’m also minded that commencing the mortgage sooner rather than later would lock in a lower fixed interest rate for the first five years. Might it be doable by September of this year, give it two months to get approved, then submit commencement for December in order to claim the subsidy? Maybe, though it’s a bit tight.

Let’s just hope that the government extends the subsidy into 2023!


Thursday 18 November 2021: 22:47. Last post in my series on my future house build I described the house we have designed and submitted for preplanning feedback using Virtual Reality via the Oculus Quest 2, and I did some rough ‘back of envelope’ energy modelling to see if it would meet Passive House energy consumption standards. I concluded by looking forward to seeing if a PHPP model of the house (PHPP is the computer modelling software for Passive Houses) would match my crude calculations.

So yeah, I just went ahead and inputted the house design into PHPP v9.6 straight away and this post is about what it spat out, because it contains quite a few surprises. To remind folk so later makes sense, we intend to meet the Passive House Classic standard and the RIBA 2025 challenge for this house, with stretch goals for the Passive House Plus, the RIBA 2030 Challenge, and the Passive House Premium minus PV generation:

Irish 2019 NZEB BER A1 House
German Passive House Classic
RIBA 2025 Challenge
Stretch goal 1:
German Passive House Plus
Stretch goal 2:
RIBA 2030 Challenge
Stretch goal 3:
German Passive House Premium
Heat & Ventilation Energy:≤ 25 kWh/m2/yr≤ 15 kWh/m2/yr
(40% better)
≤ 15 kWh/m2/yr
(40% better)
≤ 15 kWh/m2/yr
(40% better)
Air Leakage:≤ 3 m3/hr/m2≤ 0.6 air changes per hour
(72% better)
≤ 0.6 air changes per hour
(72% better)
≤ 0.6 air changes per hour
(72% better)
Wall & Floor Insulation:≤ 0.18 W/m2K≤ 0.15 W/m2K
(17% better)
≤ 0.15 W/m2K
(17% better)
≤ 0.15 W/m2K
(17% better)
Window Insulation:≤ 1.4 W/m2K≤ 0.8 W/m2K
(43% better)
≤ 0.8 W/m2K
(43% better)
≤ 0.8 W/m2K
(43% better)
Total Energy Use:≤ 120 kWh/m2/yr≤ 60 kWh/m2/yr
(50% better)
≤ 60 kWh/m2/yr
(50% better)
≤ 45 kWh/m2/yr
(63% better)
≤ 35 kWh/m2/yr
(71% better)
≤ 30 kWh/m2/yr
(75% better)
Embodied lifecycle carbon emissions:≤ 1200 kg CO2e/m2≤ 800 kg CO2e/m2
(33% better)
≤ 625 kg CO2e/m2
(48% better)
Potable water consumption:≤ 125 litres per occupant per day≤ 95 litres per occupant per day
(24% better)
≤ 75 litres per occupant per day
(40% better)
Indoor CO2 levels:≤ 900 ppm≤ 900 ppm
Indoor VOC levels:≤ 0.3 mg/m3≤ 0.3 mg/m3

To clarify:

  • Passive House Classic is a low energy house, approximately twice better than the current best rated house under the 2019 EU Near Zero Energy Building (NZEB) regulations (Passive House Classic long precedes EU NZEB, and indeed strongly influenced the design of EU NZEB which is why they look so similar).
  • Passive House Plus is a net zero energy house, over a calendar year it generates about as much energy as it consumes by generating energy in summer and consuming an equivalent amount in winter.
  • Passive House Premium is a net generating house in that it contributes much more to the grid than it consumes. Because in Ireland there is no feed-in tariff for solar PV, and when they introduce one next year it will pay at desultory rates and has a low annual cap for maximum payment, it is not economic in Ireland to generate much excess electricity on-site. One can still aim for a stretch goal of ≤ 30 kWh/m2/yr total energy use however, and to put that in perspective, what an Irish BER A2 rated house uses only for space heating is what a Passive House Premium uses for everything – cooking, showers, all electricity use etc.

How I configured my PHPP model

Firstly, I must stress the following:

  • I have never taken the Passive House Designers Course.
  • I basically just filled in the PHPP v9.6 spreadsheet using common sense, a fair bit of head scratching, and occasionally peeking inside the equations to figure out what the hell they mean and/or what the error messages were going on about.
  • I did not invest time on inputting detailing such as thermal bridges nor exact shell layer composition.

What I modelled:

  • Climate: PHPP defaults for Cork Airport in Ireland, albeit with altitude reduced to my site’s.
  • U-Values: Three building assemblies of a single 0.5m thick shell giving a u-value of 0.147 W/m2K, each for ground floor, first floor, roof.
  • Areas: Fairly close approximations of shell areas from plans.
  • Ground: Fairly close approximations of shell areas from plans with u-value of 0.11 W/m2K. I left all other values at suggested defaults.
  • Components and Windows: I approximated Munster Joinery’s Passive House range of windows and doors, Velux’s Passive House range of roof windows, the Zehnder ComfoAir 550 as the MVHR, and the ShowerSave 20 ltr/min waste water heat recovery unit. As per the design described in earlier posts, there is no heat pump employed here.
  • Shading: I put full temporary sun protection on the south facing roof windows, as these will have external mechanical shutters. I put 70% shading on the south facing wall windows due to an external mechanical blind on the games room and the summer plants in the greenhouse.
  • Ventilation: As my site is windy, I chose a moderately protected site with wind hitting it from all sides. I set the worst possible air tightness, 0.6 ACH, and made the shell air tightness layer somewhat elastic by 10 m2 for the whole house. I configured 30 m3/hr of ventilation per person, and chose its suggested default of 180 m3/hr of ventilation for the house. I told it to run that constantly for 24 hours per day. I chose two metres of inlet and outlet air ducts, and a subsoil heat exchanger to represent the earth tube with efficiency of 60%. It reckons that with all that combinated, the total ventilation system should achieve 75.2% effective heat recovery, with the earth tube basically paying for the other losses around the 75% raw efficiency of the MVHR unit.
  • Summer Ventilation: I configured an automatic bypass of the heat recovery on the MVHR, and set a 0.32 ACH for ventilation which is +50% of the winter ventilation, as suggested by the help box. Unfortunately the subsoil heat exchanger doesn’t appear to be factored in, so to account for it reducing the incoming air by maybe 60% of the difference to ground I increased that ventilation to 0.66 ACH to make the numbers come out about what look to me about right for a 0.32 ACH via a long deep earth tube.
  • Domestic Hot Water + Distribution:
    • For Space heat distribution I configured 10 m of distribution pipe of 15 mm diameter with 24 mm 0.04 W/mK insulation @ 75 C temperature. Radiators are best run at 55 C to prevent them producing a scalded metal smell – or indeed burning people – but a thermal store sits at 75 C, so I have to choose 75 C here (in practice one would use a thermostatic mixer drawing from both the top and bottom of the tank to reduce the radiator temperature).
    • For DHW useful heat I left the defaults as was (16 ltrs/person/day for showers, 9 ltrs/person/day for hot water) but configured a shower drain water heat recovery unit as described earlier for a 16 ltr/min ten minute long average shower with heat recovery into the cold water feed for the thermal store’s DHW inner tank and the shower cold water feed. This gave a 55% whole system shower heat recovery.
    • For DHW distribution I left the flow temperature at 60 C, and configured 20 m of circulation pipe of 15 mm diameter with 24 mm 0.04 W/mK insulation. I added a further 10 m of individual pipes off the DHW circulation pipe with six tap openings per person per day every day of the year.
    • For Storage heat losses I chose a DHW and heating tank with 5000 litres capacity @ 75 C to represent the thermal store. Assuming a 2x2x3 metre airtight box insulated with Kingspan Sauna Satu with a u-value of 0.023 W/m2K = 20 m2 that gives a heat loss rate of 0.46 W/K.
  • Photovoltaics: I configured sixteen of my cheap 375w Trina honey solar panels on the south facing roof at a 35 degree slope under the assumption that more cheap panels is better than fewer expensive panels. This has a maximum generation capacity of 6 kW. PHPP lets you enter their detailed functionality such as crossover voltage and the inverter’s details, and it thinks this install in my climate and this house would generate 6023 kWh of electricity per year for a materials cost of €4.7k, which is equivalent to €0.04/kWh if amortised over twenty years.
  • Electricity: I left the defaults for all the appliances as-is, except to add an always on computer server consuming 875 kWh of electricity per year.

My PHPP model results

Yeah, so PHPP is ridiculously detailed:

Heating degree hours - External10.
Heating degree hours - Ground6.
Losses - Exterior14281281130711349236434864886529431173138211840kWh
Losses - Ground1971852071961801621561491421651681862093kWh
Solar gains - North648017025736439837927920412172482436kWh
Solar gains - East89193239413728231486264kWh
Solar gains - South3553355357437266876406026364733952956421kWh
Solar gains - West2735681141291261149989553524914kWh
Solar gains - Horiz.0000000000000kWh
Solar gains - Opaque52631242032402482261851549562421695kWh
Internal heat gains4584144584434584434584584434584434585396kWh
Utilisation factor99%99%92%72%56%41%35%39%51%84%97%99%66% 
Heating demand 6705422524171003913606992667kWh

Of the heat losses due to the shell, 929 kWh per annum is lost by ventilation (both intentional and unintentional). The southern glazing accumulates the most heat for obvious reasons, however due to the extensive raised high northern glazing it’s not a small accumulation there, which I found surprising. Internal heat gains (appliances, showers, cooking, people etc) are substantial, and you’ll note they are constant throughout the year. This is ‘baseline’ heating, and too much of it will cause overheating in summer.

Speaking of overheating, PHPP thinks it will be minimal, on four days per year (0.9%) in July might internal temperature exceed 25 C. If I add external blinds on the northern glazing that does fall to 0.5%, which probably isn’t cost beneficial.

Of the 5396 kWh per annum of internal heat gains, 4127 kWh is from electrical appliances and the remainder comes from the thermal store losing heat (222 kWh), domestic hot water (1055 kWh) and the remainder is distribution losses. In terms of monthly, that’s 344 kWh/month electrical appliances and 88 kWh/month domestic hot water.

Finally let’s look at the photovoltaic gains from the roof solar panels month by month, and note that the solar panels will generate more electricity than the house uses for everything for the months of April - September. This will be important, as you shall see later:

JanFebMarAprMayJunJulAugSepOctNovDec Year 
Solar radiation on tilted surface445195147160158145127116755235kWh/(m²month)1204.9kWh/(m²a)
Ambient temperature667911141616141187°C10.5°C
Total monthly yield221258478742800784715629577377262179kWh/month6023.2kWh/a
Losses through shading situation000000000000kWh/month0.0kWh/a

Does PHPP think this house design meets our goals and stretch goals?

PHPP thinks this house design has a Primary Energy Renewable (PER) demand of 38 kWh/m2/yr, which is well under 60 (Passive House Classic) and 45 (Passive House Plus). It is not low enough (though see later) for RIBA 2030 nor Passive House Premium.

Showers and sinks it thinks will consume 25 ltrs/day/person of hot water, which is about 30 ltrs/day/person once mixed with cold down to 40 C. Toilets are supplied by rainwater, so most of the remaining potable water use will come from washing dishes or clothes. Assuming the washing machine and dish washer are run once per day, that adds 15.5 and 4.5 ltrs/day/person, giving a total of 50 ltrs/day/person. Assuming that cooking and drinking water wouldn’t exceed 25 ltrs/day/person, I’d say the RIBA 2030 challenge for potable water use should be met.

The RIBA 2030 Challenge embodied lifecycle carbon emissions is mostly down to what building material you choose – concrete is very bad, wood is good. If you choose wood for everything, unless your builder does something really weird, one should come in easily under 625 kg CO2e/m2.

Finally, because 6kW of PV panel doesn’t generate enough electricity, we don’t meet the generation requirement for Passive House Plus (it requires generation ≥ 51 kWh/m2/yr if PER demand ≤ 38 kWh/m2/yr, which ours just about meets). We would need to fit +50% more solar panels to meet the generation requirement.

Correcting the Primary Energy Renewable (PER)

As I mentioned on a few occasions now, PHPP assumes that you feed your excess PV generated electricity back to the grid. It has no facility for indicating that you’d want to do anything else with that excess electricity e.g. heat the thermal store so nighttime electricity doesn’t have to. An added wrinkle for Ireland is that there will be a cap on the payment for your contributions to the grid, at the time of writing the details are not clear, but it seems that the rebate will be capped to 30% of your total including PV electricity consumption (how they are going to validate this is beyond me, but that’s the current thinking apparently).

We need therefore to correct PHPP so as little nighttime electricity to heat the thermal store is used as possible, which by definition will lower total direct electricity usage and therefore reduce PER demand.

My 5000 litre thermal store if completely full @ 75 C contains 322 kWh of space heating or domestic hot water. One would keep no less than 50 kWh of space heating hot each night, so that leaves 270 kWh to buffer sunny days across overcast days. I thought it would be interesting to also model a 3000 litre thermal store, which contains a maximum of 193 kWh and so its buffer is 143 kWh.

Annual figures from above:

  • Total electrical appliance usage: 4128 kWh
  • Total space + DHW heating: 3723 kWh
  • Therefore total house electricity consumption: 7851 kWh (+ 841 kWh for pumps, ventilation etc)
  • Estimated electrical appliance replaced by PV solar during daylight hours: 1296 kWh
  • Estimated ‘spare’ PV solar electricity which normally would feed into grid: 4727 kWh

From this we can say that the feed in payments will be capped at 2355 kWh per year, which at €0.065/kWh is €153.

Estimated night time electricity savings for 3000 litre (193 kWh) thermal store
Max electricity supplied by solar for electrical appliances during daylight4755102158172170156137125815638
Solar electricity remaining174203377584628614559492452296207141
Domestic hot water heating888888888888888888888888
Space heating670542252417100391360699
Tank days between sunshine671330303030303024105
Thermal tank contribution-671-52837454533526471404361117-345-717
Thermal store capacity5050871931931931931931931935050
Mains electricity contribution8710118834853352647140436111710371
Mains electricity demand-968-818-242-186-172-174-188-207-219-263-490-1023

You might notice the ‘Tank days between sunshine’, this is the average number of days that the buffer in the tank can supply all space heating and domestic hot water for the average day in that month. So, if in December it were -6.8 C, the store would run out twice quicker as that is double the differential from the monthly average, whereas if were +13.3 C, the store would run out twice slower (this being half the differential from the monthly average). The 3000 litre tank gets you a bit less than a week in winter average i.e. sunny days, which tend to come in bursts in the Irish winter, need to occur at least once per week. From experience I find this rather too optimistic, so I’ve assumed that due to the limited spare capacity in the thermal store, in the winter it will only capture half of the sunny days and the rest goes back to the grid.

Annual for 3000 litre tank:

  • Estimated mains electricity contribution as thermal store was full: 3310 kWh (45% reduction, due to cap earns €153)
  • Estimated mains electricity demand from appliances or because thermal store was empty: 4951 kWh (37% reduction, or €288 of night rate electricity saved)
Estimated night time electricity savings for 5000 litre (322 kWh) thermal store
Tank days between sunshine111324303030303030301810
Thermal tank contribution-584-42737454533526471404361117-242-646
Thermal store capacity5050873223223223223223223228050
Mains electricity contribution00021953352647140436111700
Mains electricity demand-881-716-242-186-172-174-188-207-219-263-288-922

‘Tank days between sunshine’ is nearly double for the 5000 litre tank, and I think it likely that a burst of sunny days would occur every ten days or so in winter, so the thermal store should be able to absorb all excess PV.

Annual for 5000 litre tank:

  • Estimated mains electricity contribution as thermal store was full: 2631 kWh (44% reduction, due to cap earns €153)
  • Estimated mains electricity demand from appliances or because thermal store was empty: 4459 kWh (43% reduction, or €339 of night rate electricity saved)

Something interesting here is that a 5000 litre tank is only about €600 more than a 3000 litre tank, so that is a payback time of twelve years or so given the electricity savings of €51/yr.

In any case, for either size of tank diverting excess solar to the thermal store makes a big difference to mains electricity consumed, primarily because all domestic hot water is covered by solar PV. If we adjust PHPP’s PER worksheet to add a ‘Thermal storage’ offset of mains electricity consumption, with 100% of DHW supply from the solar panels throughout the year and the remainder offsetting space heating:

  • For 37% demand reduction (30% of space heating, 100% of DHW) of 3000 litre tank, PER demand drops to 26.9 kWh/m2/yr.
  • For 43% demand reduction (48% of space heating, 100% of DHW) of 5000 litre tank, PER demand drops to 24.4 kWh/m2/yr.

Both of these are under Passive House Premium’s maximum energy consumption of 30 kWh/m2/yr, so in this sense both stretch goals 2 and 3 have been reached. However because the generation of electricity by the house is far below what it consumes (1627 - 2188 kWh), it does not meet the minimum generation requirements, and therefore Passive House Plus (let alone Premium) is not achievable.

As much as fitting +50% more solar panels looks tempting to reach Passive House Plus, that adds an additional capital cost of €2.2k or so, and because of the feed in cap, the effect of the added generation on our annual electricity bill of a mere €1000 or so is not going to be much. In other words, it’s not economic. Equally, for just a small added capital outlay one might fit an oversized solar inverter, and if the government in the future remove that cap, adding more solar panels later is easy.

Why did my crude model overestimate total energy consumption by so much?

Summary of my hand made crude model from the last post:

  • Primary energy demand for the proposed house would be around 11,000 kWh.
  • This is for 260 m2 of living space, which gives a 41 kWh/m2/yr which is well below the limit of 60 kWh/m2/yr required for Passive House Classic, and is even below the 45 kWh/m2/yr limit required for Passive House Plus.

PHPP came in at 79% total energy use of my crude model. There were two main causes:

  • My crude model assumed far more DHW goes on showers. This is because I forgot to scale the numbers for hot water consumption only (I used total flow), and also because I modelled five adults, whereas PHPP hardcodes modelling 3.2 adults.
  • My crude model assumed more air leakage due to doors being opened and closed etc.
  • I had basically put a smoothing estimator for the thermal store rather than anything more rigorous like the above, and whilst not a bad estimation for me effectively sticking my finger in the air, it was a bit off.

If I fixed those, it pretty closely matched PHPP which was reassuring!

#house #energy-modelling #PHPP

Monday 8 November 2021: 03:49. Today I’m going to divert from my usual focus on embedded systems in my series on my future house build. Last post I said I’d been quite fatigued during the two weeks since I fell ill, and I’m sorry to say these past three weeks have not been much better. Apart from sleeping and working, I have had no energy to do much else – no WG21 papers, no open source, no embedded systems programming, no custom Home Assistant integration work, no gym nor anything outside work and sleep. I am slowly on the mend, but it’s certainly going slowly. I originally had thought I had contracted just a head cold, but given these weeks of fatigue … well, it probably was in fact covid, and I’ve since had a mild dose of long covid.

Anyway, I’m glad to report that our house design is finally done. After a mere five months to secure the rights on our site, our architect Stephen O’Leary from Cork based Rebel Design Studio only could get started these past few weeks. As you may remember, in my original post in August, I had already had a crack at designing the whole house, including layouts internal and external, designing its ventilation, heating and electrical systems, and I had prepared a thirty-five page brief dense with detail. Stephen took that design and rendered it into 3D, along with a few variants and then finally a fourth design which was entirely his, albeit thematically similar.

Getting the VR headset to view architecture

I had bought an Oculus Quest 2 specifically to wander around these concept designs in VR, so I tried importing the Twinmotion renders into Unreal Engine 4 and then generating an Android mobile binary targeting the Oculus. Unfortunately, Oculus’ Android doesn’t implement Mobile HDR, and when you disable HDR, all the Twinmotion assets render as sheets of entirely all white or all black – i.e. useless. If you enable Mobile HDR, the binary doesn’t work on the Quest 2 at all.

This was rather unfortunate, so I had to fall back to the Oculus Rift emulation function of the Quest 2 whereby a PC renders the VR and the image gets blitted over a USB cable to the headset. Alas the Windows Oculus software sucks monkey balls, it just silently refuses to work if you don’t get everything exactly right, and it provides zero help messages nor clues as to what is wrong with it. Literally trial & error black magic to get it working. Awful experience, but I got there in the end mainly through a lot of Google searching of people having the exact same awful experience as me. Thanks Facebook .

Unreal Engine 4, at least if you stay on the PC, works really rather well in VR with very little added effort, and my recently bought AMD Radeon 6600 XT renders such simple 3D models as these like butter. Without me coding anything up, it’s a very basic experience, you esssentially fly around with the keyboard and you have free range look with the headset. But, it’s enough to get the job done in terms of evaluating the concept designs.

Yes, Twinmotion also has a VR viewing option, but if you try it you’ll find it sucks. As it’s also UE4 based, I have no idea how they managed to make it suck so badly. In any case, importing your Twinmotion file into UE4 is so straightforward it’s the obvious workaround. Also, if you package up your UE4 game into a standalone binary, even a laptop with Intel integrated graphics will do a passable job of rendering it, whereas for some reason Twinmotion’s standalone viewer binaries suck badly on Intel integrated graphics. Again, same bloody engine, no idea why it’s so bad.

(Incidentally, if you’d like UE4 to make it look really pretty, try turning on ray tracing. Looks gorgeous on the outside, but inside everything’s too reflective, and I didn’t find the time to figure out how to dial back so much reflection. The pictures below were rendered actually by my laptop’s Intel integrated graphics using a standalone packaged game without ray tracing enabled)

My original design

Stephen had rendered my original design mostly as I had it into 3D. The general design was that of a bungalow, but with victorian style raised ceilings on the ground floor, and a reduced width loft conversion upstairs spanning three quarters of the house length. The design showpiece was a roof to floor open vaulted space for the living area, with a raised mezzanine reading and library area overlooking it. I had chosen the golden ratio for width to length, but I had been worried that it just wasn’t wide enough to have the ‘church hall’ effect I was seeking. Looking at the images without VR it seemed reasonable (note these are rendered by BIMx not Unreal Engine):

Once into the VR however, my fears were confirmed: the vaulted area felt ‘pokey’. Stephen’s rendition deviated from my original design, I actually had the vaulted space wider, and the mezzanine was lower and jutted into it around the middle, all of which was going to require expensive steel beam structural support. However, his wasn’t a million miles away. The problem was – and it was only really obvious once in VR – that the height to width ratio just wasn’t there, and as the house already had a 180m2 footprint, and I wanted all bedrooms on the ground floor, extending it another five metres just for the main living space seemed inefficient.

Another issue was that I had chosen a ten metre wide building, which leaves nine metres wide internally (the raised ceilings were to admit additional light to compensate for the added width). Stephen was adament that this would not fly with planning, who seek eight metre wide buildings. I know that some rural one off houses get away with ten metres, but as we are building on an estate, the best Stephen felt possible was a roof not peaking in the middle such that the front roof of the house would match the others on the estate, and the back roof would be consequently much longer and steeper as a result in order to stretch the width out to ten metres.

That seemed reasonable, but it rather ruins the roof symmetry of my original design in an unpleasing way. As you’ll see later, Passive House Plus (< 45 kWh/m2K) isn’t achievable without the ratio of total house shell area to floor space being below a certain ratio, and the eight metre maximum width requirement makes that virtually impossible. Passive House Classic (< 60 kWh/m2K) is still just about within reach however.

The final design as being submitted to preplanning

Stephen’s own design had taken my original concepts and done something rather different with them: If you imagine an S-shape whereby your living room opens up into the vaulted height as you approach the kitchen, the kitchen terminates the ground approach but then you sweep upwards onto your mezzanine library reading area, that’s pretty much Stephen’s design. The clever thing here is you now get the width proportional to the height that my design was lacking – actually, you get oodles of width, it’s about 2x width for the height, but as it’s an S-shape, it breaks up that width in a fluid flow.

My import of the original Twinmotion file setting correct latitude and longitude for our house’s location and orientation. Sunbeams are for 12pm on the 1st March. Pictures progress top left to top right downwards, finishing from bottom left to bottom right: (i) view from living room towards kitchen; (ii) view end of dinner table looking towards hallway upwards; (iii) view from kitchen towards living room upwards; (iv) view from mezzanine library reading area downwards into dining table and living area, with the bridge towards the right (v) view from top of the stairs over the bridge towards the living room (vi) view from the top of the stairs towards the mezzanine library reading area.

Obviously, using so much of the house’s length and height to achieve this effect leaves insufficient space for all of the rooms I had in my original design, so two of the four bedrooms get partially extended out the front of the house, leaving a space in the middle for a tree where the front door is, which is then brought as-if into the vaulted space by a whole ton load of glazing:

(If you’re wondering why there is a transparent house next door, it’s because the site next to us is empty. The white houses are existing neighbour houses)

To then round out the protruding bedrooms, we run a cage around the house to encompass the patio outside the living room:

You no doubt notice the greenhouse at the back – myself and Megan are keen on growing a fair proportion of our annual fruit and vegetables, so we have a full house length three metre wide lean to greenhouse. The house’s exhaust air from the MVHR vents into this greenhouse, filling it with extra CO2 and moisture, but also constantly ventilating it. You can see a full house width of raised tanks above the patio, these actually sit above part of the master bedroom and living room – they harvest rainwater from the roof for the greenhouse. It should be possible to store 8000 litres up there, with additional harvesting tanks for the greenhouse as the wind dominates from the south west, and thus it is the south and west faces which receive the most rainfall.

However that large greenhouse comes with a big cost: no direct glazing on the south side of the house, because where the greenhouse joins the house it must be wall. Equally though there is a big benefit: the extensive groundfloor glazing is almost entirely blocked in summer by all those plants, but for the rest of the year it permits significant solar ingress, as is obvious from the sunshine falling through in March. That means solar heating for eight months of the year, but no overheating in summer.

Finally, let’s look at my proposed back garden and the enormous thermal store I want (as explained in in my original post in August):

You may have noticed that the site is actually two sites joined together, yet even with the 0.35 acres that affords, there isn’t really that much of a back garden. The brown walled patch is a walled garden for growing things perfectly happy outdoors and for which valuable greenhouse space is a waste – potatoes and carrots are excellent examples, they grow even better outside than in a greenhouse. That leaves not a massive garden once everything else is considered. It’ll do, but given all the money I spent on two rather than one sites, it does feel a little underwhelming. At least it’ll keep the mowing effort down I suppose.

(Indeed, the most likely reason we think this planning proposal will be rejected is ‘inefficient use of serviced sites’ i.e. we used two serviced sites for one house, which therefore deprives others of a potential house. Never mind how pokey small those sites are!)

Finally, witness my thermal store! It’s really massive. It dominates the utility/plant room. To the left of it will be the MVHR and any heat pump if it turns out we need one of those (we currently think that as a passive house, a heat pump won’t have cost benefit). The remainder will be washing and drying machines. But just look at how big that thermal store is, it’s 2m wide x 2m deep x 3m high including lots of insulation! Contains 5000 litres of water storing approximately 200 kWh of hot water. With the insulation I have planned, it should leak around 40 watts of heat into the house, so about one third of a human adult being in the house i.e. eminently tolerable.

As described in that earlier post, the thermal store gets heated by any excess left over from the solar array on any sunny days. As it’s so massive, and passive houses need so little energy, that thermal store if completely full is enough to provide domestic hot water and space heating in winter for around a week in a worst case scenario e.g. Beast from the East outside temperatures with mains electricity off for the entire week. In normal scenarios, it should be able to carry the energy gathered from a few sunny days in winter for up to a month, thus offsetting the need to top up the thermal store using cheap night time electricity.

It’s a very simple system, albeit highly unconventional when almost everybody else would just fit a heat pump. However my maths says that oversizing this tank only costs a bit more than a grand more, whereas a heat pump costs at least eight grand including commissioning. Sure, the heat pump might deliver up to 5 kWh of heating for 1 kWh of electricity, but because it requires periodic expensive servicing and probable replacement after fifteen years or so, and you really don’t need much heating for a passive house which reduces the return on investment, if you work it out it makes more sense to oversize the tank and solar panels and use cheap nighttime electricity to charge the tank if needed. Also in favour of this is that a heat pump can always be fitted later (ideally when they’ve become cheaper), whereas a tank this large has to be designed in from the beginning.

Anyway this is the design being submitted to preplanning this week. We shall see how it goes!

Incidentally, so later makes sense, we intend to meet the RIBA 2025 challenge for this house:

Irish 2019 NZEB BER A1 HouseGerman Passive House ClassicRIBA 2025 Challenge
Heat & Ventilation Energy≤ 25 kWh/m2/yr≤ 15 kWh/m2/yr (40% better)
Air Leakage≤ 3 m3/hr/m2≤ 0.6 air changes per hour (72% better)
Wall & Floor Insulation≤ 0.18 W/m2K≤ 0.15 W/m2K (17% better)
Window Insulation≤ 1.4 W/m2K≤ 0.8 W/m2K (43% better)
Total Energy Use≤ 120 kWh/m2/yr≤ 60 kWh/m2/yr (50% better)≤ 60 kWh/m2/yr (50% better)
Embodied lifecycle carbon emissions≤ 1200 kg CO2e/m2≤ 800 kg CO2e/m2 (33% better)
Potable water consumption≤ 125 litres per occupant per day≤ 95 litres per occupant per day (24% better)
Indoor CO2 levels≤ 900 ppm
Indoor VOC levels≤ 0.3 mg/m3

Getting from my original design to this final design

Once it became obvious that Stephen’s design was much superior to my original (hardly surprising!), we dropped my design and focused on bringing into his the essential features we wanted.

Poor Stephen had to work very hard these past few weeks. Our initial round of feedback took me three hours to type out and it was pages and pages of text. As he modified things to meet our feedback, the amount I had to write each round of feedback iteration kept shrinking until it reached zero. There was also quite a fair bit of teaching, as what I’ve designed here is non-standard, and I needed to explain why what I wanted was sensible, or indeed how it even works at all. Because it’s an overall systems based design, everything relies on everything else to make sense, no single item makes sense on its own. Stephen in fairness to him kept plugging at it until we got over the line this past week.

Stephen has taken the Passive House Institute’s design course, but this will be his first Passive House. To be honest, Passive House is a touch overkill for the mild Irish climate, most of the value is their PHPP software for modelling the house which is orders of magnitude better quality than the 2019 NZEB DEAP model. I can see most clients getting the most value from generating a high fidelity PHPP model rather than actually going for full Passive House certification, which greatly limits your construction choices whilst also adding on cost.

Most of the changes to the original concept were induced by the master bedroom. In VR, it was originally obviously too small, and purely to solve that we ended up extending the ground floor house length from 18m to 20m. In order to add in a porch to prevent heat loss when entering and exiting the building, we ended up having to rotate the master bedroom en suite to the middle of the house, and combined with the added two metres that made the master bedroom wide enough and long enough. However in terms of compromise over our original design brief, it has been the master bedroom which has taken the brunt of things. Stephen very much wanted us to move the master bedroom upstairs where there was a lot more design freedom, so in the end we had to choose compromise if we were to stay on the ground floor.

The other significant design change was to raise the mezzanine upwards in order to form storage for the games room next door, but also to raise the reading and library area further away from the living space so it is more separated and peaceful.

Estimated materials cost of this final design

One can fairly easily estimate house shell areas from the plans: Total wall area: 301 m2; Total roof area: 285 m2; Total floor area: 181 m2; Total wall glazing area: 61 m2; Total roof glazing area: 9 m2. Total indoor volume: 1243 m3. Total living floor space: 269 m2.

Straight away from those one can calculate:

  • Heat Loss Form Factor (HLFF): 3.11
  • Surface to Volume Ration (SVR): 0.674
  • Glazing as a percentage of footprint: 39%
  • Percentage of roof is flat: 31%

A passive house aims to get HLFF below 3.0 and SVR below 0.8. As you can see, we achieve the latter but not the former thanks to the vaulted ceiling taking away a good deal of floor space, which hurts HLFF. SVR is well below 0.8 however, so the design is ‘compact’ relative to the typical Irish build which is around 1.0. Unfortunately energy requirements are per m2 of living floor space, so as you can see this vaulted ceiling will hurt us.

If one estimates the following materials costs inc VAT: Wall 0.15 W/m2K €250 per m2; Floor 0.11 W/m2K €100 per m2; Roof 0.13 W/m2K €300 per m2; Wall glazing 0.8 W/m2K €700 per m2; Roof glazing 0.7 W/m2K including mechanical external shutter €1,550 per m2, then we arrive at a materials cost estimate of €239,571 inc VAT.

They say for a typical Irish house that materials are usually 40% of the final all-in bill, so that suggests a total build cost of almost exactly €600,000 inc VAT. That is about €200k more than I am able to raise in terms of finance, so I’m really hoping I’ve overestimated my costs here. Another common ratio for passive house builds is that passive house grade materials will be 55% of the final cost excluding professional fees because most builds are manufactured in a factory offsite and assembled onsite in under two weeks which significantly reduces onsite costs. If so that is €436k, which is still €50k more than I can raise. I guess we shall see!

Estimated energy efficiency of this final design

What I’m about to do next will be very inaccurate compared to a DEAP energy model let alone a PHPP energy model, but let’s take a guess at energy efficiency.


  • There are 0.1 uncontrolled air changes per hour due to leakage, which for the above indoor volume is an uncontrolled ventilation rate of 124 m3/hr.
  • The indoor temperature is 21 C and the outdoor winter and summer temperatures are 2C and 15C respectively.

Then assuming air carries 0.33 W/m3K of energy and the component W/m2K listed above, the shell heat loss in winter would be -3.763 kW and in summer it would be -1.188 kW. Note the lack of time in those numbers: we are saying that if inside is 21 C and outside is either 2 C or 15 C, then that is how much heat is leaked from inside to outside by the shell materials and air leaking through the shell (note that 0.1 ACH for a passive house which cannot exceed 0.6 ACH in a hurricane would be quite a windy day, however don’t forget people opening and shutting doors).

Let’s go a bit further by assuming:

  • The MVHR unit has a heat recovery efficiency of 80%.
  • It runs at 150 m3/hr.

Then we can calculate that the heat loss due to intentional ventilation will be -0.188 kW in winter and -0.297 kW in summer. That might seem surprising – the reason why is that the MVHR in summer will be in bypass mode i.e. not heat recovering.

Let’s go even further by calculating heat gain from solar radiation. According to the PGIS database for our site location:

  • In winter 50 kWh/m2/month lands on the roof, and 10 kWh/m2 will land on a vertical window. As there are 730 hours in a month, and glazing might retain 50% of the heat entering the house, this is 0.034 kW/m2 and 0.007 kW/m2 respectively.
  • In summer 140 kWh/m2/month lands on the roof, and 80 kWh/m2/month will land on a vertical window. This is 0.096 kW/m2 and 0.055 kW/m2 respectively.

Applying this to my glazing:

  • In winter, the roof and wall glazing would add 0.724 kW to the house.
  • In summer, with the external shutters covering the roof glazing and plants in the greenhouse covering half of the ground floor southern glazing, the wall glazing would add 1.19 kW to the house.

What remains now is how much heat the house generates from being lived in. I can tell you that for my current two storey 60 m2 rented house, between cooking and various devices using electricity, we consume 0.534 kW, which excludes showers or heating. Add in five human adults’ body heat 0.38 kW and five 75 litre showers per day with wastewater heat recovery @ 75% = 0.182 kW, I reckon there is a minimum baseline heat generation of 1.096 kW, which may be an underestimate given just how much illumination I plan to fit to this future house.

If you now tot up this baseline internal heat generation with the solar heat gained by the glazing, the shell heat loss, and the ventilation heat loss, you get:

  • In winter, there is a negative 2.13 kW.
  • In summer, there is a positive 0.802 kW.

Or, put another way, in winter we must add 2.13 kW, and in summer we must remove 0.802 kW, to keep the house at 21 C.

You now may understand why I intend to fit an earth tube which I reckon will subtract -0.97 kW in summer, thus turning an overheat into a negative 0.168 kW. Most will point out that a heat pump can just as easily run in cooling as in heating, however note that my cooling here comes completely free of electricity cost, it’s just the considerable capital cost of installing an earth tube here (they cost only a bit less than a heat pump, though as a dumb pipe in the ground their service life well exceeds my lifetime).

It’s an interesting question whether a thermal store + earth tube + wastewater heat recovery will beat a heat pump. I think it will, which is why I chose this design, but for a BER A1 Irish house, because it uses twice as much energy, a heat pump really does make sense as its return on investment is much better. A heat pump does deliver up to five free kWh for every one kWh of electricity used, however a thermal store lets you capture all those occasional sunny days you get even in winter in Ireland, and an earth tube lets you cool your house without any electrical cost at all. Wastewater heat recovery means long showers aren’t dumping energy down the drain. So once you factor in how hideously expensive periodically topping up the refrigerant gas in a heat pump is vs the added expense on night rate electricity, and given a thermal store + earth tube + wastewater heat recovery unit has identical capital cost to a heat pump, I reckon they’ll come out pretty close in terms of total lifetime financial cost.

Indeed, from a passive house calculation perspective, the heat pump is definitely preferable because its embodied carbon cost (which is very significant) isn’t included, nor is the fact its refrigerant gas which slowly leaks out is a known climate warming gas. This is why the RIBA challenge is important – it makes you consider that exchanging improved energy efficiency for much worse impact on the planet is not a good deal.

Note in all of the above that our site is unusual for Ireland in that having two river deltas to either side makes an earth tube unusually effective, most sites in Ireland would see nothing like as much benefit from an earth tube. This made my choice here much easier than it would be for most other sites.

Note also that wastewater heat recovery makes sense only in a passive house where domestic hot water consumption is a large proportion of the total annual energy consumption. In an Irish BER A1 house, you effectively get hot water as a side benefit from the heat pump. It’s a different set of tradeoffs.

Estimated annual bills for this final design

Firstly, 31% of the roof being flat puts a fairly heavy loading on home insurance. One might expect to pay 40% more annually, maybe +€160 a year.

The baseline electricity load is what it is, including standing charge of €300 and assuming more of it lands in the expensive daytime rate (€0.25/kWh daytime vs €0.10/kWh at night) I’d estimate the baseline electricity bill at €1,118 inc VAT per year.

If it were winter constantly for three months of the year i.e. 2C throughout, and no space heating were needed for the rest of the year, and solar diversion from occasional sunny days supplemented 20% of the space heating during that time, I’d estimate the electricity needed for space heating charged at night time rates to cost €501. This gives an estimated annual bill of €1,619 inc VAT.

To put this into perspective, for my current two storey 60 m2 rented house I spend €840 a year on electricity and about the same again on kerosene for space heating, which is about 11,500 kWh in total giving 192 kWh/m2/yr which is a BER C2 rating, and I can absolutely guarantee you that the indoor temperature is nowhere near 21 C in winter e.g. as I type this right now at 3am it is 18 C in this room. This, incidentally, includes a solar domestic hot water collector which they say reduces your annual heating bill by 10-15%, without that this house might be BER D1 rated.

Can this design be passive house certified?

If any of the estimates above are anywhere close to correct, primary energy demand for the proposed house would be around 11,000 kWh, almost the same as for my current rented house. However, this is for 260 m2 of living space instead of 60 m2, which gives a 41 kWh/m2/yr which is well below the limit of 60 kWh/m2/yr required for Passive House Classic, and is even below the 45 kWh/m2/yr limit required for Passive House Plus.

That no doubt it an underestimate. If preplanning smiles on this proposed design, I look forward to seeing what PHPP returns for this house and how it compares to my very rough workings above!

#house #energy-modelling

Sunday 17 October 2021: 23:08. For several recent posts now in my series on my future house build I have been hoping to implement a custom Home Assistant integration for the custom logic I wrote in my keenly priced industrial grade scriptable PIC32-based Devantech dS3484 ethernet relay and input board. Last post three weeks ago I said I was feeling pretty burned out from all this post-day-job work, so I was going to take a weekend off, which I did. Alas, I then fell ill that following week, sufficiently badly that I had to take a few days off work, which is unusual for me. Since then I’ve been feeling rather under the weather, such that come end of day, I just go to bed, and similar early nights at weekends. This has made progress glacial.

Despite feeling crappy yesterday, today I was feeling energetic enough to finish off that custom integration for Home Assistant, and to write this virtual diary entry. The custom integration is a bit different to most Home Assistant integrations in that it asks the board what sensors and knobs it exports, and it then dynamically configures those items in Home Assistant according to whatever the board tells it. The custom integration starts off initially with a polling based update mechanism, but it asks the board for push subscription, and if the board says it supports that then the Home Assistant integration switches to push updates. From everything I can tell from Google, nobody appears to have implemented an entirely dynamic Home Assistant integration like this before, so I intend to properly write it up here and exactly how each bit of it works, for the benefit of everybody else on the internet, because it would save others several very late nights with coffee figuring this stuff out from first principles. Anyway, here’s the custom integration with push notifications in action – the potentiometer simulates a dimming switch, and my custom logic on the Devantech board appropriately dims the overhead LED strip cove lighting, but now ALSO pushes updates to any subscribed client. That, in turn, means Home Assistant is dynamically updated:

So that’s definitely working quite well then. I also updated the HTML dashboard published by my custom logic on the Devantech board to show push subscription details:

It’ll take me a week or two to write everything up properly, so watch this space!

Incidentally, for the past month the LED cove lighting automated by the Devantech board has become ‘the’ lighting for the main living space. It fades itself in when it gets dark outside, fades itself out when it gets light, automatically turns on when a person enters the room at night, turns off when no movement has been detected for five minutes. Everybody in the family likes the new ‘smart light’ a great deal, especially my son Henry who being a bit short struggled to turn on the light switch downstairs in the morning, and now he walks in and it turns on automatically. He’s very pleased with the improvement.

Last post I did a survey of the market for cheaper home automation with ethernet solutions and I settled upon the STM32F401 + W5500 as my ethernet microcontroller approach for €12 inc VAT each and the Raspberry Pi Zero + USB2 to Fast Ethernet as my ethernet microcomputer approach for €20 inc VAT. I mentioned in that post that the ESP32 is considerably more bang for the buck, if you can put up with its shortcomings in implementation quality. I thought that instead of assuming, I really ought to empirically test my assumptions, so I bought this, or rather, these:

This is an ESP32 wrapped into an Arduino compatible board for a mere €4.55 inc VAT delivered, which is a good bit cheaper than even the STM32F4 clone. Paired with it is a W5100 Ethernet shield for Arduino – or rather, a Chinese clone of the real thing (more later) – costing ~€11.50 inc VAT delivered, so the pair cost me €16 inc VAT. For this money, I get 250Mhz clock speed, 512Kb RAM, 4Mb flash, 11n Wifi, BT 4.2 and lots of flexible i/o, albeit that the Arduino compatible wiring limits me a lot on this. To my knowledge, there is only one prebuilt presoldered ready-to-go board cheaper than this with ethernet: the WT32-ETH01 which can be found for ~€14 inc VAT delivered, and my combination would appear to be better bang for the buck: same microcontroller but with proper power in socket, USB socket, existing Arduino IDE support – surely worth the extra €2 right?

Unfortunately, according to https://reedpaper.wordpress.com/2018/09/17/arduino-ethernet-w5100-how-to-fix-the-wrong-board/, the Chinese clone of the W5100 Arduino Ethernet shield has a wrong sized resistor on the ethernet port – it’s about 10x too big. This substantially weakens the signal on the LAN meaning you can’t use ethernet cables of any length without replacing the resistor. Using the information on that blog post, I have confirmed that my Shield is similarly flawed. So I suspect that apart from maybe a bit of poking at it to see how an ESP32 works in practice, this is probably €16 wasted, which is annoying. Had I known this before ordering, the WT32-ETH01 would have been my choice.

Anyway, I’ve received all the parts I spoke about last diary entry, but I discovered that the camera cable for the Zero is narrower than that for any other Pi board – thanks so much to whomever made that design choice, especially as the Zero board has enough space for the same connector as all the Pi boards. So I had to order special cables which connect the Zero’s narrow camera connector to standard camera connector. Those are still en route from China, and seeing as I’ve not been well anyway, I’ve done very little with all the new hardware yet apart from boot up Raspbian and get the Zero to hardware PWM dim a small LED via a MOSFET (and yeah hardware PWM is orders of magnitude better quality than software PWM, even on a 1Ghz CPU like the Zero’s).

Another thing that I need to do is port the ST time of flight software library to RaspPi, I bought the fancy software defined function ST VL52L3CX ToF sensor which basically returns raw data and you need a fairly substantial CPU plus the ST software library to interpret what the laser can see by doing lots of floating point math. The Raspberry Pi Zero is easily powerful enough, but no port of ST’s library to Linux exists yet as far as I can tell, though from inspection of the source code the port will be trivially easy. Anyway, once working, you should be able to ‘see’ everything within five metres of the sensor’s fifteen degree field of view, which is to say it yields (and I am paraphrasing here) how much of its view is obscured at what distance e.g. 10% of it is blocked at 1.0m, a separate 20% is blocked at 4.0m, and so on. It’s accurate down to the millimetre, and can tell when things have changed in its view i.e. it can take a sample of ‘empty room’, and tell when ‘empty room’ gains a new thing within it which doesn’t belong, and both how far that new thing is from the sensor AND how big it is. In other words, it should be able to tell when a human has entered a room, and whether that human is sitting or standing or lying down. I am hoping to use these instead of cameras for the bedrooms to detect the difference between an occupant sleeping in their bed, sitting up in their bed, and vacated their bed. We’ll see how empirical testing goes.

Finally, you may remember when I installed HEPA filters in multiple rooms throughout the house to improve the air quality in this quite mouldy and damp house with the added benefit of scrubbing the air of virus particles, such that the kids bringing covid home from school might not infect us adults quite as quickly. Those Xiaomi Air Purifier 3C’s which I automated with a Python script have proven themselves to be excellent – still no rattle off them, they are quiet and efficient and judging from the amount of lint they collect, they are plenty effective too.

The kitchen purifier gets by far the worst of it as it regularly has to spin up to maximum to scrub the air of PM2.5 generated by cooking. I noticed the grille on the top where the clean air comes out was getting dirty, so obviously the filter had become spent – unsurprising after eight months of cooking! So I replaced the filter (Xiaomi very helpfully place OEM replacement filters on German Amazon at RRP prices which are cheaper than Aliexpress prices, though they do go out of stock very quickly after new supply arrives), and that left me with a dirty filter heading for the trash.

So I, probably like all of you, was wondering what these Xiaomi filters look like on the inside, and just how dirty is this filter? So I cut it open to have a look:

The first layer after the outer plastic grille is a dense paper-like filter thickly folded in concertina. A brand new filter has dark grey outside and I would assume a clean white inside -- this filter has mottled grey outside and obvious discoloration inside. The concertina folding is held taut by a tensioned rubber string which is actually glue, very clever.

Peeling back the densely woven filter material:

Held in a dispersed lattice after the filter materials are granules of activated carbon arranged with holes in the middle.

As mentioned in the original post, the grey filter is Xiaomi’s highest end filter with a claimed HEPA specification of 99.95% efficiency. Unlike the EPA purple or green filters which have added filtration layers for other pollutants, the grey filter is more like the basic EPA blue filter: just activated carbon and filter, nothing extra. The +29% price difference (€31 inc VAT delivered for the blue filter, I paid ~€40 inc VAT delivered for the grey filter from Amazon Germany) reflects the difference in quality of filter material only, with no difference in feature set apart from claimed 10x better filtration efficiency.

As much as €40 for a filter seems a lot (about half the price of the entire purifier unit itself!), having cut one of these open I was impressed by its heft and quality – in fact, cutting it open took quite a bit more effort than you would think so dense are the materials. The way they’ve arranged the activated carbon granules in that pattern and with cleverly differently sized pores in the multiple layers of plastic mesh aids slow moving air ingressing past the filter material to hang around the activated carbon for a bit longer before getting sucked up and out. I’ve no idea how these filters compare in quality or effectiveness to ‘western’ filters, but in terms of what I think a HEPA filter ought to be these subjectively tick all the boxes. I also like that they’re simple and yet so clever: that’s the mark of good design.

I have four purifier units in total in the house, and I intend to replace their filters around the twelve month mark as they don’t receive anything like the gunk the kitchen purifier receives. As I was remarking to Megan last night, Xiaomi do a really great job of making consumer goods 80%-90% as good as western brands but for 50% of the price. We’ve now got smart watches, robot vacuum cleaners and air purifiers from Xiaomi or its subsiduary brands and we find them all so far to be excellent value for money, and we really like that Xiaomi makes available spare parts AND makes their stuff easily maintainable as a matter of course. Indeed, we only wish that Western manufacturers took more of a leaf from Xiaomi’s book – and if they continue to fleece the Western consumer with unmaintainable, expensive, products with built-in hard coded death times, then Xiaomi is going to supplant and replace them, and rightly so.

#house #home-assistant #air-purifiers #xiaomi

Sunday 26 September 2021: 23:11. In the last post in my series on my future house build I had hoped to get a custom Home Assistant integration implemented this weekend for the custom logic I wrote in its proprietary language dScript for my keenly priced industrial grade scriptable PIC32-based Devantech dS3484 ethernet relay and input board. I can say that its learning curve was too steep for me to conquer this weekend – though I made excellent progress and it’s just a question of more time to finish it – but ultimately there is only so much completely new material that one can grok through and master after midnight, even after drinking coffee (I honestly can’t think of the last time I drank coffee so late in the day, but it really was needed if I was to make any decent attempt at all that Home Assistant programming documentation).

Anyway, once finished that will be the topic of a future post here in the series. This post is more about what prototyping and empirical testing needs to come next after the Devantech board. Firstly, I want to be clear that my experience with the Devantech board has been very positive. Yes its dScript language definitely could do with a lot more polish – there are a lot of weird things missing or syntax not permitted for no obvious reason – I suspect a single person designed and implemented it, and it has never received much feedback which was acted upon with respect to the programming language itself. Still, it’s definitely powerful enough to get almost any job done – for this Home Assistant integration I am writing I created a small TCPIP control server in dScript which was quite straightforward, as was getting it to push state change updates to any arbitrary third party IP address which registers with it. Implementing that part took only an hour or so, what I got bogged down in this weekend was Home Assistant programming itself.

Still, the Devantech board isn’t the right solution to some of the things I need solving in my future home automation. Firstly, the lack of high frequency PWM was a showstopper for dimming the LED cove lighting in a quality way – the maximum 1Khz software PWM just isn’t enough. Secondly, there are a bunch of sensors I want to use which either can’t fit into the Devantech board (any I2C for example), or aren’t well suited to the volt free digital inputs (though note that the bigger Devantech boards do offer switchable volt free or TTL digital inputs, and I now wish I had bought one of those instead). Finally, these boards are way overkill for use cases not involving > 7A current loads, and as I’d expect we probably will need at least one board per two rooms, that’s excessively expensive given they’re about €100 inc VAT including case each. What I really want is one or two Devantech boards for the high current stuff, and something much cheaper everywhere else.

Cue thus lots, and lots, and lots of research to figure out a solution which can do:

  • high frequency PWM LED strip dimming.
  • can read light switch digital inputs.
  • have an I2C bus for ‘is there a person in this room’ sensing.
  • maybe an ADC for analogue sensors like temperature.
  • LAN connected.
  • PoE powered.
  • either no Wifi at all (security risk/spectrum interference), or can act as a decent enough local Wifi AP, which means ‘can run OpenWRT and can at least do 2x2 11ac (Wifi 5, 866 Mbps) and have true Gigabit Ethernet’.

And obviously do all of this for as cheap as possible both in terms of money and my precious free time in wiring it all up, commissioning it, and maintaining it!

Survey of the market as of Q3 2021

I went through many options: all the Small Board Computers (Raspberry Pi, Rock Pi, Orange Pi, NanoPi etc), all the Microcontrollers (PIC32, ESP32, STM32 etc), dedicated PWM boards, adapting Wifi AP boards to do GPIO. So I can say something about the current cost-benefit balance and tradeoffs in the market as of Q3 2021.

Firstly, the absolute cheapest board capable of true Gigabit Ethernet and 11ac Wifi is the Orange Pi Zero 2 currently going for €30 inc VAT for the board and €5 inc VAT for a 16Gb sdcard = €35 inc VAT. However it’s an Allwinner H616 chipset, it’s not well supported, and there are big question marks over its Wifi implementation quality.

The second cheapest is the venerable Raspberry Pi 4 Model B for €40 inc VAT, assuming you can find one in stock (I could not). It is Broadcom based, which isn’t the best story for being an AP under OpenWrt but thanks to its huge popularity it has been made to work. It has 1x1 11ac Wifi. You need €5 inc VAT for a 16Gb sdcard = €45 inc VAT.

The next cheapest is the Radxa Zero currently for €50 inc VAT, it’s Amlogic S905Y2 based so it’s got really really good software support (e.g. OpenWRT ‘just works’ on this board) and its Wifi AP implementation is excellent. It also has 8Gb of onboard flash saving me needing a sdcard. However it lacks an Ethernet port though it does have USB3, so you’d need to add a USB3 Gigabit ethernet adapter for €15 inc VAT, so it costs €65 inc VAT which is getting close to the Devantech board, and we still don’t have 2x2 Wifi, only 1x1 Wifi.

The next cheapest is the Rock Pi 3A currently for €57 inc VAT + €5 inc VAT for a 16Gb sdcard = €62 inc VAT. This has gigabit ethernet and two PCIe M.2 slots, so you can fit your own 2x2 Wifi card which is certainly another €20 inc VAT if you want Wifi 5 or another €40 inc VAT if you want Wifi 6, so now you’re at €82 - €102 inc VAT.

Add in a Gigabit PoE splitter for €15, and €100 per room is rather a lot of money when there are many rooms in the house.

So what about instead fitting fewer but better APs e.g. the TP-Link Mercusys MR70X is a 2x2 Wifi 6 AP with three gigabit ethernet ports for €45 inc VAT with an Amlogic chipset already with early OpenWRT support, share one of those between a few rooms each, and then per room fit something much much cheaper for the lights and sensors?

The choices for further testing

Out of all the microcontrollers and small board computers I calculated all the bits which would needed and these two are what I have chosen for further investigation:

  1. Microcontroller approach:

    • STM32F401: 84Mhz ARM Cortex M4F, 64Kb RAM, 256Kb flash. €5 inc VAT delivered. Nicknamed ‘the Black Pill’.
    • W5500 ethernet connected by SPI. €7 inc VAT delivered.

    Total: €12 inc VAT each


    • Up to four hardware PWMs capable of > 20 Khz frequency, or up to five SPIs, or up to three I2Cs, or up to seven 12-bit ADCs, or up to twenty digital inputs or outputs.
    • No OS nor filesystem, so hard realtime, once debugged maintenance likely will be very low.
    • Arduino ecosystem available via STM32duino.
    • Cortex M4 is ARMv7 and there is even hardware single precision floating point, which is nice as you can avoid fixed precision integer arithmetic for say percentage calculations.


    • I really can’t think of any, though I may find some once I actually use the board, and it’s been a LONG time since I last did work on a truly bootstrapped embedded microcontroller.

  2. Microcomputer approach:

    • Raspberry Pi Zero: 1Ghz ARM11, 512Mb RAM. €6 inc VAT.
    • USB2 to Fast Ethernet adapter. €9 inc VAT.
    • 16Gb micro sdcard for storage. €5 inc VAT.

    Total: €20 inc VAT each


    • Up to two hardware PWMs capable of 250 Mhz frequency, or up to two SPIs, or up to one I2C, or up to twenty-four digital inputs or outputs.
    • Camera connector. And the GPU can hardware encode to h.264!
    • Full USB stack on USB ports, so anything USB is available to you.
    • Half the current cost of the cheapest Raspberry Pi with ethernet, the Raspberry Pi 1 Model B+ currently going for €30 inc VAT.
    • Passable hardware single and double floating point, which Raspbian jumps through a lot of hoops on your behalf to make it appear seamless.
    • Full Debian, so I have plenty of up to date experience using this.


    • Despite how astonishing it is that you can nowadays get a full computer with full fat Linux for €20, it still costs 67% more than the Microcontroller option. Multipled many fold, that adds up.
    • No ADCs so no analogue inputs possible without additional hardware.
    • ARM11 (first gen ARMv6) is really ancient. Like twenty years old now. It’s full of weirdness and quirks, though Raspbian does a fabulous job at mostly papering over the cracks.
    • Runs a proper Linux and so will need security updates etc and other ongoing maintenance. It also won’t like sudden power loss much.

Why not the alternatives?

Why STM32F4 instead of Arduino? It’s simply a price-performance thing – that STM32F4 runs rings around an ATmega CPU, having orders of magnitude more RAM, Flash, performance, and being 32-bit not 8-bit, and having a modern C++ toolchain instead of a proprietary partial standard library compiler. Yes it costs 25% more – the STM32F4 is €5 delivered versus €4 inc VAT delivered for the ATmega – but am I going to sweat an extra euro here for how much more you get? No.

Why STM32F4 instead of ESP8266? For €3 inc VAT delivered – even less than the ATmega – you can get a comparable specification ESP-12E dev board, and for €2 more it can come with a really nice breakout adapter board which saves lots of hassle soldering. It also comes with built-in wifi and bluetooth, though only 2.4Ghz 11n, and I really have to hand it to Espressif that they’ve really thought through making it as nice as possible for people like me yet cheaper priced and better specced any other alternative. However whilst comparable in specification, there are fewer GPIOs, ADCs, I2Cs and so on which means I’d need to fit more them with more PoE power adapters which makes them more expensive overall.

Why STM32F4 instead of ESP32? This is much tougher to explain, because in most ways the ESP32 is far superior. Historically ESP32 cost a touch more and STM32 a touch less, so its better feature set was somewhat proportional to the cost increase. Recently though they’re both about €5 inc VAT delivered, and in most ways it’s not a fair fight: 3x faster clock speed, 2x more cores, 8x more flash, 8x more RAM, AND 11n Wifi and Bluetooth v4.2, plus up to sixteen PWMs, or up to five SPIs, or up to four I2Cs, or up to eighteen 12-bit ADCs, or up to thirty-four digital inputs or outputs – the ESP32 is a whole lot of microcontroller for the money.

But despite on feature set alone not being a contest, the STM32F4 still has a few big advantages:

  • It is ARM which has an enormous ecosystem, not Xtensa DSP which has not. This matters a lot – all my sensors have code examples, drivers or python modules written and tested on either ARM or ATmega, and usually both. Getting all of those working well on Xtensa with the current state of its ecosystem seems unlikely.

  • ESP32 makes better a lot of the quirks and surprises that were in ESP8266, but they’re not entirely gone. For example it still has non-linear and unstable ADCs, albeit less non-linear and unstable than the ESP8266, but you still get crappy resolution at the bottom and top i.e. they’re range constrained, a classic sign of a not fully mature solution, and they also experience a good bit of sampling and thermal noise normal ADCs do not. And it’s not just the ADCs which are quirky, ultimately Espressif just aren’t quite up there with the big boy league in terms of quality and predictability yet. Don’t get me wrong, they are constantly getting better, and every new product generation is another leap forward. But you’ll still be fighting their lack of ecosystem depth which just isn’t an issue if you’re on ARM.

  • Ultimately I don’t actually need all those features – I don’t have enough stuff to connect into them without running more cable than it’s worth. The STM32F4 has enough i/o for my use case, it also has enough RAM and enough flash. It’ll do.

If one day the ESP32 + RJ45 ethernet boards currently costing €15 inc VAT delivered came down to around €8 inc VAT, then I might see myself using ESP32 for various solutions e.g. it would be quite unbeatable for controlling irrigation in a greenhouse where accuracy isn’t so important. But at €15 the STM32F4 + RJ45 easily beats it at €12, even with the hassle of soldering and wiring.

Finally why the Raspberry Pi Zero? To be honest there is no close competitor at all in this choice of microcomputer – nothing else comes close to the bang for the buck you get for €6 inc VAT. Sure it’s two decade old and is quirks-ridden technology, but its ecosystem support is very, very deep and very, very wide. Even its Wifi edition which in my opinion is terrible value for what you get for doubling its price still has few good competitors for that price – the quality of the boards and their ecosystems on the market between the Zero W for €12 inc VAT and the Raspberry Pi 3 Model B for €30 inc VAT I don’t think are worth the money saved in terms of added hassle and working around poor QoI e.g. buggy USB stacks making your USB Ethernet dongle not work quite right.

Hybrid approach

You’re probably gathering that I’m currently favouring the Microcontroller approach, but I in fact expect to adopt a hybrid approach. Why? Well it’s that camera connector on the Raspberry Pi Zero, it means that I can fit to it a 5MP OV5647 camera with infra red lights for €10 inc VAT including delivery, thus saving me having to buy Hikvision cameras each costing €80-100 or so. Anywhere which is not a bedroom nor bathroom will have multiple cameras looking at it. This is partially for security, but it’s mainly because I believe I can estimate human motion and coordinates within a three dimensional reconstruction by combining images using something like https://github.com/alyssaq/reconstruction. This, in turn, means I don’t need to mount – and more importantly, not need to wire – distance sensors running along the walls to detect where people are within a room, and thus adjust the brightness of the lighting in that locality in order to conserve power (as my LED strips will consume rather a lot of power if fully bright).

There are, annoyingly, STM32F4 models also with a camera connector, but I don’t think the Chinese sell cheap clones of them yet. Also, even if I had a STM32 here, I very much doubt a ~200Mhz ARM CPU can do any meaningful compression on a 5MP video feed before it needs to be sent out on a SPI connected Fast Ethernet port, which at best probably can’t push more than 40Mbit, so that’s a max resolution of 1280x1024 @ 30fps (and likely less in practice). And even then, your Gigabit network will rapidly saturate with lots of 40Mbit video streams running along it. Whereas the original Raspberry Pi (which has the exact same SoC as the Zero) has h.264 hardware encoding, and for which there is a nice Python library to have the camera and video encoding acceleration hardware cooperate and write the output to a socket. It should be able to make at least Full HD @ 30fps for 8Mbit or so, and that seems to me a nice cost saving over standalone Hikvision cameras.

Thus, I expect Raspberry Pi Zeros in the public spaces wherever I also need a camera (approx three per space for triangulation), and Black Pills everywhere else including outdoors as they’re cheap and replaceable enough that I don’t need to care too much about them getting damp or full of spiders for example.


I have placed an order for both and a whole load of sensors for me to experiment with. Finding a Raspberry Pi Zero without wifi in stock for something approximating its proper price was tough, I ended up going with German BerryBase and they got it delivered with a bunch of sensors and cables where it was cheaper to get it from them than Aliexpress within a week for a good price. For the Black Pill and all the other sensors where after postage it was still cheaper, I went with Aliexpress and that’ll likely be in transit for a good few weeks yet.

After the next post likely on the custom Home Assistant integration, I’ll start testing sensors with the Raspberry Pi Zero and I’ll no doubt write a post on my experiences with each of those named by exact model number (I did a ton load of research choosing each of them very carefully). However next weekend I also intend to take a break from staying up until 4am doing this stuff, because I’m getting a bit sick of feeling like crap every weekend, and I’d like a break from the slog of it.


Sunday 19 September 2021: 22:54. Last weekend in my series on my future house build, I looked at the physical board of the keenly priced industrial grade scriptable PIC32-based Devantech dS3484 ethernet relay and input board, and I got a demonstration LED being PWM dimmed using a small program written in its proprietary dScript programming language. This weekend my goal was to get an actual solution to automating my prototype cove lighting up and working, including user selectable PWM dimming and automatic on-off based on outdoor brightness and whether there is someone in the room.

Firstly let’s look at how I have wired up the board:

The Devantech dS3484 board controlling a 24v AC power supply and MOSFET to PWM dim the LED strip

My LED strip is 24v, so that AC power supply is a 24v model (the box taped to the top is a 24v to 12v buck converter for 12v LED strips to be added later). Both its live and neutral have been wired into the first two 16A relays of the Devantech board. Hanging between the 24v power supply and the board and the LED strip is a cheap chinese clone of an IRF520 MOSFET costing barely one euro which is claimed to be able to handle up to 5A, but as a clone I’d not trust it with more than 3A (and indeed my 24v LED strip can draw an absolute max of 3A, which is not a coincidence). You’ll note that I added inline 5A car fuses for both the 12v buck converter and the supply to the IRF520 clone, just in case, and since that photo was taken I have added a heatsink to the MOSFET, because those IRF520 clones do run hot even on half their claimed amperage.

The IRF520 clone will switch at around 3v, so I wired the 5v output from one of the analogue inputs on the Devantech board to power the MOSFET, and using a 470 Ohm resistor I routed the same 5v supply via a digital i/o and in parallel to the MOSFET. This is because the Devantech digital i/o are NPN rather than the PNP typical in Arduino/RaspPi type boards, so when on they connect their input to ground, and when off they do not connect their input to ground (i.e. they don’t source, they sink). So, after the resistor, when off there is approximately 3.3v @ 10 mA remaining from the 5v input to switch the MOSFET on; when on that 3.3v gets drained to ground, switching the MOSFET off.

(Incidentally, due to doing all this stuff at ~2am after a full workday having risen at 7am, I foolishly shorted the resistor which delivered the full 5v to the digital i/o. The board, being i/o buffered and industrial grade, blew a small fuse on the individual digital i/o rather than blowing the board. That digital i/o no longer works, but it proves the quality of the board – had that been a Raspberry Pi, I’d have blown the chip)

Along the analogue inputs, I have connected a cheap TEMT6000 photoresistor which runs on 5v, outputting a 0-3.3v signal depending on how much visible light it sees (and I taped it to the room’s window). Next is a potentiometer, to simulate a wall rotary dimming dial which are just potentiometers wired into a triac (if you snip the internal connection and wire in a DC cable to the potentiometer, you can use an ordinary wall dimming dial switch very nicely). Finally, I wired a cheap HC-SR501 PIR sensor into analogue, despite it being a digital i/o, because the Devantech board’s digitial inputs are volt free, meaning you can connect up any voltage you like within spec (I assume <= 12v?), and the input will sense a 0-2v difference from ground as a zero and anything more as a one. Volt free is great for most uses cases e.g. just connect a physical switch, no power needed, the input ‘just works’. But when the input is a TTL device, the problem is when the signal is zero it isn’t connected to ground in a way the volt free input can detect (it basically needs a small current to flow, and none does), so the Devantech digital input can’t work with TTL inputs without additional circuitry. Whereas the analogue input ‘just works’ here, albeit you’ll need to poll it for new values. Luckily, this particular PIR sensor holds its digital signal high for three seconds per detection, so if you poll the analogue input every second or so, you’ll definitely catch it.

Last night I wrote this somewhat more complex than the last time dScript program to run it all:

digitalport LED_STRIP_PSU_RELAY1 1 ; relay 1
digitalport LED_STRIP_PSU_RELAY2 2 ; relay 2
digitalport LED_STRIP_PWM_DIMMING_IO 47  ; i/o 7
analogport LED_STRIP_PWN_DIMMING_SELECT_IO 4  ; analogue 4
analogport PIR_SENSOR_IO 1  ; analogue 1
analogport WINDOW_LIGHT_SENSOR_IO 3  ; analogue 3

; Increments monotonically at 1000Hz
int32 monotonic_count

; The current LED strip dimming. 0 = off, 8 = 100%
int8 led_strip_dimming_level_actual
; The desired LED strip dimming
int8 led_strip_dimming_level_wanted
int32 led_strip_dimming_level_wanted_ticks_remaining
; The last time we saw PIR movement
int32 last_pir_movement_monotonic_count

function set_led_strip_dimming_level(int8 newlevel)
  if newlevel != led_strip_dimming_level_wanted then
    if led_strip_dimming_level_wanted == 0 and led_strip_dimming_level_actual == 0 and newlevel >= 4 then
      ; fast start straight to 50%, spool up from there
      led_strip_dimming_level_wanted = 4
      led_strip_dimming_level_actual = 4
      threadsleep 250
      if newlevel == 8 then
        led_strip_dimming_level_wanted = 8
        led_strip_dimming_level_actual = 8
    led_strip_dimming_level_wanted = newlevel
    if newlevel != led_strip_dimming_level_actual
      led_strip_dimming_level_wanted_ticks_remaining = TICKS_BETWEEN_DIMMING_LEVELS

int32 last_pir_movement_delta_returned
function int32 last_pir_movement_delta()
  int32 ret
  ret = monotonic_count - last_pir_movement_monotonic_count
  if ret < 0 then
    ret+= 2147483647
  last_pir_movement_delta_returned = ret
  return ret

; Implements LED strip PWM dimming
; The i/o when on turns the lights off, so this is inverted
function software_pwm_dimmer_impl()
  int32 todo
  ; In case you're wondering why not compare the masked value to something to
  ; set todo as a boolean, dScript doesn't support comparison operations in
  ; variable expressions. No that makes no sense at all :(
  select led_strip_dimming_level_actual
    case 0 ; 0%
      todo = 1
    case 1 ; 12.5%, 125Hz
      todo = (monotonic_count & 7)
    case 2 ; 25%, 250Hz
      todo = (monotonic_count & 3)
    case 3 ; 37.5%, 125Hz
      todo = (monotonic_count & 7) - 2
    case 4 ; 50%, 500Hz
      todo = (monotonic_count & 1)
    case 5 ; 62.5%, 125Hz
      todo = (monotonic_count & 7) - 4
    case 6 ; 75%, 250Hz
      todo = (monotonic_count & 3) - 2
    case 7 ; 87.5%, 125Hz
      todo = (monotonic_count & 7) - 6
    case 8 ; 100%
      todo = 0
   if todo > 0 then

; Turns the LED strip on
function turn_on_led_strip()
  if LED_STRIP_PSU_RELAY1 == 0 then
    ; Set the MOSFET off
    led_strip_dimming_level_actual = 0
    led_strip_dimming_level_wanted = 0
    ; Set relay 1 and then relay 2 on, wait for the PSU to initialise
    threadsleep 20
    threadsleep 105

; Turns the LED strip off
function turn_off_led_strip()
  if LED_STRIP_PSU_RELAY1 == 1 then
    do until led_strip_dimming_level_actual == 0
    ; Set relay 2 and then relay 1 off
    threadsleep 20
    threadsleep 20

thread software_pwm_dimmer_tick(1)
  monotonic_count += 1
  if monotonic_count == 2147483647 then
    monotonic_count = 0
  if led_strip_dimming_level_actual != led_strip_dimming_level_wanted then
    led_strip_dimming_level_wanted_ticks_remaining -= 1
    if led_strip_dimming_level_wanted_ticks_remaining == 0 then
      if led_strip_dimming_level_wanted > led_strip_dimming_level_actual then
        led_strip_dimming_level_actual += 1
        led_strip_dimming_level_actual -= 1
      if led_strip_dimming_level_actual != led_strip_dimming_level_wanted then
        led_strip_dimming_level_wanted_ticks_remaining = TICKS_BETWEEN_DIMMING_LEVELS

; This coroutine samples the analogue inputs, so we run it at 0.1Hz
int32 outside_brightness
;int32 board_temperature
thread pir_control_tick1(10000)
  outside_brightness = WINDOW_LIGHT_SENSOR_IO
  ;board_temperature = TS1

; This coroutine samples the analogue inputs, so we run it at 5Hz
int32 chosen_dimming
thread pir_control_tick2(200)
  int16 pir_movement
  pir_movement = PIR_SENSOR_IO
  if pir_movement >= 512 then
    last_pir_movement_monotonic_count = monotonic_count
  int32 delta
  delta = last_pir_movement_delta()
  ; If it is bright outside, or no movement at all for an hour, turn off the LED strip and we are done
  if outside_brightness >= 600 or delta > 1800000 then
    threadsuspend ; we are done
  ; If the whole unit is off, and it's dark outside, only switch on
  ; if there has been movement recently
  if LED_STRIP_PSU_RELAY1 == 0 then
    if outside_brightness <= 500 and delta < TICKS_BETWEEN_PIR_SENSOR then
      threadsuspend ; we are done
  ; Unit is on, decide what brightness it needs to be
  if delta < TICKS_BETWEEN_PIR_SENSOR then
    ; Set to whatever the potentiometer says
    chosen_dimming = LED_STRIP_PWN_DIMMING_SELECT_IO
    set_led_strip_dimming_level(1 + (chosen_dimming / 128))
  elseif delta < TICKS_BETWEEN_PIR_SENSOR + 10000 then

thread main(const)
  ; upon boot, turn on LED strip immediately, but dim
  threadstart software_pwm_dimmer_tick
  threadsleep 3000
  threadstart pir_control_tick1
  threadstart pir_control_tick2

Hopefully the above is fairly self explanatory with the comments explaining anything weird looking – basically we physically disconnect the 24v AC adapter whenever possible, but we keep it running for 30 minutes after nobody being in the room so lights can be quickly started within 100 ms if somebody enters. I took especial care to never do too much at a time in a coroutine to keep the software PWM smooth and thus the flicker as least obvious as possible – you will probably also note the hard coded eight possible PWM dimming level choices, which is probably the most practically possible with a 1Khz clock. Here’s a video of me cycling the dimming down and back up again using the potentiometer:

The 500Hz 50% dim seems to not flicker on the phone camera’s sensor, but the 250Hz and especially 125Hz levels do. As mentioned in previous posts, this isn’t the Devantech board’s forte – the hardware PWM of the PIC32MX chip isn’t available to dScript, and I think given this is an interpreted bytecode running on a 80Mhz CPU even achieving smooth 1Khz software PWM is pretty impressive. Speaking personally, I am rather flicker sensitive, and I can easily see flicker at 500Hz. I find it quite offputting, though it is a lot less worse than the 250Hz and 125Hz PWM – that latter looks to me like a light pulsing on and off. Meanwhile my wife couldn’t detect any flicker at all except a little at 125Hz PWM.

Finally, as I mentioned last post, these Devantech boards have the unique feature that they can serve a HTML page of your design with AJAX updating fields pulled from global variables in your dScript program. I didn’t go nuts here, I made a simple HTML table and had it fill in various values to make a simple status dashboard:

All in all apart from the occasional head scratch all this work went smoothly, albeit that the low resolution software PWM dimming isn’t really good enough for my house build, so I’ll need something better. I didn’t get around this weekend to integrating this with Home Assistant, so next weekend that’s exactly what I’ll be doing: I’ll probably write a very simple local push integration for Home Assistant that lets this dScript push status changes to Home Assistant. I may also allow Home Assistant to override the board’s default logic e.g. put lights to 100%, or turn everything off.

Something else I’ll need to make a start on is researching alternatives for home automation. Something rather noticeable in this prototype is basically all the analogue inputs are full already, and given each of these boards costs at least €75 inc VAT, that’s rather too much money to be expending per room in the house. I need something much cheaper which can also do high resolution hardware PWM dimming and isn’t a pain to wire up and/or configure. I’m also minded that I have a bunch of sensors I want to test for my house build which require I2C, and the Devantech board doesn’t expose that.

Don’t get me wrong here, this Devantech board is absolutely great for automating high current stuff such as immersions, pumps, home heating water valves, that sort of thing – anything involving 12v DC or 230v AC and lots of current. The volt free inputs are perfect for wall switches etc. but not suited for wiring in Arduino/RaspPi focused sensors. This implies that my sought after cheaper alternative probably is going to be an Arduino or Raspberry Pi, exactly because the whole breakout board sensor ecosystem is designed around them, but also because they have the deep software support for enthusiasts which makes the experience a whole lot less painful than is usually the case with embedded systems programming.


Monday 13 September 2021: 01:25. I received my industrial quality Devantech dS3484 board which cost me €75 inc VAT, a fraction of near equivalent boards from National Control Devices or National Instruments, yet provides similar functionality and uses proper 12v powered industrial grade components same as they do. As I described in the last post on the topic of my future house build, this board is capable of running a proprietary BASIC-like scripting language called dScript which lets you program it to carry out a fair bit of local automation, thus reducing how much control complexity you need to encode into a network controller such as Home Assistant. As the last post mentioned, there is a lack of detail online about the Devantech boards, and whilst the Devantech website contains a board specification, description and you can glean more detail from its dScript programming manual, there is a definitely lack of subjective user experience of these boards i.e. people who have had a go off them, and wrote up their experiences on line somewhere where search engines can find them. Let’s hope this virtual diary post is therefore useful to others!

Firstly, high resolution pictures, because there aren’t any online that I could find and without these it’s very hard to figure out how the board is routed:

The overall dS3484 board, in its optional extra case

The processor, a PIC32MX795F512L, with a 2Mb flash from Microchip to its left

Above you can see the Ethernet PHY chip, the RS485 serial chip, and the 12v buck converter to 5v.

The board has very good build quality. Soldering and traces are clean, every input and output is buffered, and a very wide range of voltages is therefore tolerated. The Hongfa 16A relays are considerably better quality than the cheap Chinese 10A claimed relays normally in tinkerer boards and I think I’d trust them with 230V AC. I tried out the relays, the digital i/o both as input and output, and the analogue inputs. Analogue inputs looked very stable when fed a potentiometer, no noise, drift nor random walk, and the full 10-bit range was clearly present with equal resolution at the extreme low and high as in the middle (unlike ESP8266 for example). Ethernet came up and worked without issue. I plugged a cheap 12v AC adapter into it, found no issue. 5v output from the board measured at 5.1v, which is fine. I haven’t tested the RS485 port nor UARTs, but I intend to do so soon. The USB socket, incidentally, appears as a serial port to your computer. I don’t think you can use it for anything other than with the dScript IDE, which seems rather unfortunate.

All in all, I think the hardware great value for €75. This board is maybe 20% more expensive than the cheapest ethernet relay boards off Aliexpress, but it’s an absolute world of difference in build quality. I’d trust this to switch an immersion, which I don’t think a good idea at all with any of the typical relay HATs for the Raspberry Pi.

Regarding the software side of things, I didn’t get too much time to play with that this weekend – you’ll need to wait until next weekend for me to have a proper go off the proprietary programming language. On the one hand, this isn’t some dumb board with no locally programmable logic blindly obeying commands hitting its Ethernet port – it is quite programmable e.g. if five conditions are satisfied, connect to another computer and write some arbitrary payload to that socket, or accumulate statistics, analyse them and email a summary every day. On the other hand, its proprietary dScript programming language is a weird mix of features and capabilities, some big fat ones like the ability to send email, yet no time keeping better than a second unless you implement your own.

However I did write this little dScript program in the dScript IDE to test the board:

const STEPS 16
const DELAY 1000

int32 on_count
int32 off_count
int32 on_max
int32 off_max

thread main(const)
  int32 N
  off_max = STEPS
  off_count = 1

  threadstart Timer1
  threadsleep DELAY
  for N = 1 to STEPS - 1
    threadsleep DELAY
    off_max = N
    on_max = STEPS - N
    if on_count == 0 and off_count == 0 then
      on_count = 1

thread Timer1(1)
  if on_count > 0 then
      on_count -= 1
      if on_count == 0 then
        IO1 = off
        off_count = off_max
  if off_count > 0 then
      off_count -= 1
      if off_count == 0 then
        IO1 = on
        on_count = on_max

Which yields this on a RGB LED I hooked up to digital i/o 1 which uses PWM to reduce the brightness of the LED from 100% to 6.25% in even steps over sixteen seconds:

The video makes it look far worse than it is to the human eye, where any PWM flicker isn’t noticeable until the dimmest setting, and even then, only from the side of the eye’s focal point. The PWM flicker is due to the 16 ms duty cycle, which is only 62Hz, barely any better than a cheap diode based LED AC bulb flickering at 50Hz. But it’s the best possible on a millisecond granularity timing system, which is the finest timer granularity dScript exposes. This is unfortunate as even though dScript is an interpreted language running on an 80Mhz CPU, it should be able to pulse an i/o at 50Khz in software if the board isn’t doing much else.

In case you were wondering, yes the PIC32MX has hardware PWM. However dScript doesn’t expose that, and when I asked Devantech support if it could, I was told that the PWM capable pins are not routed to digital i/o, which seems to me a missed opportunity. Again, that weird mix of features and capabilities at work. Incidentally, I also asked how much current the 5v outputs could supply as it isn’t documented anywhere, and I was told around 500 mA. Which is very useful to know.

In any case, timers do appear to reliably fire bang on 1 millisecond – the PWM, despite the video where the phone camera’s own refresh rate is colliding with the PWM refresh rate – appears to my eye absolutely regular. No stutter, though obviously this is not a loaded system.

The proprietary language dScript seems to be a reasonable attempt at a coroutine based BASIC-like embedded systems language. What the language calls ‘threads’ are actually coroutine event handlers, so you declare what event you are interested in e.g. timer elapse, TCP/IP input, board boot, i/o state change and so on, and you write code which will be called when that event occurs. Digital i/o appear to be non-blocking (instant), but analogue input read, serial port read, TCP/IP read and so on appear to suspend the coroutine’s execution until the blocking input completes, upon which execution is resumed. Most writes go into asynchronously flushed buffers and so don’t usually block. Whilst your coroutine is suspended, other coroutines may run. The scheduler is cooperative, so if any coroutine executes for too long, it blocks the execution of other coroutines, and events for a given input after the first event may get dropped as there is no buffering, as befits a hard realtime implementation which cannot allow unbounded dynamic memory allocation.

This coroutine based fixed-at-point-of-compile approach suits well deterministic programming, though it is unavoidably a bit awkward to write code in as a result (think WinRT programming, but minus any dynamic memory allocation). As there is no preemption, there are never races on shared state, which is good because all non-local state is globally visible like say in a single translation unit of C. As all possible memory allocations are known at compile time in the dScript IDE, memory is preallocated for volatile and non-volatile RAM and program bytecode. Strings are supported, but you cannot create new ones programmatically at runtime i.e. with runtime determined length – anywhere you format numbers into a string it preallocates string space for the maximum possible formatted value. There is no floating point support, which is to be expected for such a low end CPU which would lack hardware floating point, but there is what appears to be an optimised boolean expression evaluator which I assume is expanded out into a finite state machine rather than sequences of bytecode for the logic, so if-then-that type logic can be tersely and very efficiently encoded into a constant state table.

An unexpected feature of these Devantech dScript boards is that they can serve a user defined website of your choice on HTTP and moreover, said website can call arbitrary dScript via AJAX from Javascript. This lets you build web based UIs or reporting or summary dashboards for your particular setup, which is very nice. In fact, the whole system config and setup web UI for the board is written entirely in dScript, which shows what is possible if you are willing.

Anyway, next weekend I’m going to have a go at writing an actual piece of control software for my particular project in dScript. It’ll have a summary dashboard served as HTTP, so you can always see what state it is at and why. I may or may not also have it push state changes to Home Assistant, e.g. current light brightness, and if I get the time, add remote automation by Home Assistant of the project. I’ll no doubt report on my progress here!


Click here to see older entries

Contact the webmaster: Niall Douglas @ webmaster2<at symbol>nedprod.com (Last updated: 2019-03-20 20:35:06 +0000 UTC)