# Wall Panelling Calculator

This week my girlfriend has decided she wants wall panelling. I’m not much of a DIY man, but give me 10 minutes, a YouTube video and a cup of coffee and I’ll become an expert in any domain.

## Wall panelling

Wall panelling seems to be the craze right now, you wouldn’t see an empty wall on an influencers Instagram that’s for sure. It’s simply planks of MDF nailed or glued to the wall and then painted to give the appearance of a panelled wall.

There were a few things that I needed to figure out to get this panelling right.

• How do I determine the distance between each panel, ensuring it’s equidistant and there’s a panel on the left-most and right-most part of the wall?
• How many panels should I have on the wall?
• What about my plug socket? If I find the optimum number of panels, what if one of the panels has to go through the plug socket? I really can’t be arsed with moving the socket.

To play around with these numbers, I decided to create a tool to do just that:

I wrote the program using p5.js, in the p5.js editor.

## How to use the calculator

The calculator uses CMs, so measure your wall’s height/width as well as the skirting board. Then find the height/width of your panels and pop them into the calculator. Then it’s just a case of playing around with the panel count to see which looks the best.

### Obstructions

If you have an obstruction such as a plug, toggle “Show obstruction”. Then specify the distance from the left wall and the distance from the ceiling. Then choose the width/height of the obstruction.

## The maths

First of all, we need to figure out how many gaps there are, the gap is the bit between two planks of wood:

This is just the number of planks – 1. So there are 5 gaps above because there are 6 planks.

``gap = planks - 1``

Next, we need to calculate the gap between each panel, whilst still ensuring we have a panel on either end of the wall.

``spacingWidth = (wallWidth / gaps) - panelWidth / gaps;``

This will give us this:

And to calculate the gap width, all you need to do is take away the width of a panel.

``gapWidth = spacingWidth - panelWidth``

Hopefully, other people can make use out of the calculator, it’s definitely made my life easier.

I hope you enjoyed this blog, don’t forget to sign up to the newsletter – Be the first to hear when we release new content, participate in weekly coding challenges, listen to more of my drivelling.