[Advice] How to go about building a window opener with ESPHome

Hi all,

I don’t know if this is the best place to post this, since I don’t even have a yaml to share yet, but anyway.

I would like to build a device that opens a windows, and integrate it into HomeAssistant using ESPHome. Used with my existing temperature sensors, it could open windows strategically to create a through-draft, and used with my existing wind and rain sensors, it could close windows when a storm is brewing.

I am aware that commercial options for this exist, but they are terrifyingly expensive, and none that I have found online are available in my country anyway. So I have to DIY it if I want this. Also, it cannot be terribly ugly, or my wife will press the abort button.

Now, all of my windows look like this: https://imgur.com/TxuUX1p

There is a handle mechanism for closing it, which I will probably just remove. But at the bottom, there is an arm. When you open the window, it slides along a rail, and you tighten a screw to hold the window open. I don’t remember seeing windows like these any time I was overseas, but they are standard here.

Now, it seems to make the most sense to me to add a motor to the existing hardware, or at least, to piggyback on the existing concept. The reason for this is that the mounting points for this hardware are standardised and built into every windowframe in my house, so there are points I can pass bolts through without modifying the windowframe.

What I have thought of doing is this: put a servo motor at the fulcrum, like this: https://imgur.com/NbaiWul

It will swing the arm outward, sliding the locking head along the rail and pushing the window open. Given the dodgy state of the brass, it may be that friction will be too high to work well, but I can easily replace the old rail with a smooth rod - or even a linear rail.

I have a couple of metal gear servos that I picked up on sale a few months ago that apparently have 20kg/cm of torque, which seems like it should be powerful enough to move the window. However, what I am concerned about is that a servo would get wrecked doing this kind of work regularly. Surely it would need to remain powered the whole time if it is to hold the window open? Wouldn’t the stress of wind on the armature translate to stress on the gears?

Is there a more suitable (affordable) motor to use? Or a better way of opening the window entirely?

Or a method of relieving stress on the armature? I thought of using a second small motor to turn the screw of the locking mechanism, or replacing the locking mechanism with something mechanically similar like a peg through a hole in the sliding arm, which could be inserted/retracted with a solenoid.

Any kind of input or ideas would be appreciated, I’m spitballing here.

1 Like

I have seen windows like that here in NZ, but they are quite old fashioned now and you see less of them these days. Particularly in Christchurch where many old homes have been demolished.

My first concern would be that the latch is usually what makes the window really water/air tight when it is fully closed.

Secondly from a mechanical point of view, turning a pivot at or near the fulcrum is always going to be the hardest way to do it. I would be more inclined to put a motor somewhere around the screw thingy with a gear. As I am writing this and googling, I find this sort of thing - perhaps not this exact one, but something like it.

1 Like

Nick is on the right path but I would go with one of these below. Simply choose the length appropriate for your window to get it to fully open. Looking a the photo I’d image you will only need about a 200mm stroke, maybe less. Simply install this in place of the existing rail setup. They are much nicer looking.

You could easily include local buttons as inputs to your ESPhome node to allow for higher WAF too.

1 Like

@sparkydave to the rescue :slight_smile:

As usual, the hardest thing is going to be WAF, especially with the need for a 12v power supply somewhere along the lines, then a wire from that to the motor itself.

1 Like

Yeah, I would mount the linear actuator at the top of the window so it’s more out of the way / put of sight. Then run the cable up into the ceiling space and install the power supply and ESP up there. Just run some wires down from it to the local buttons

Thank you @sparkydave and @nickrout. I’m not so worried about power, since most of the places I want to do this have power nearby, and also I have the kind of missus that doesn’t mind me cutting the walls provided I make good and touch up paint after.

The real problem is that a quick google reveals that a single linear actuator costs more than the entire windowframe did. However, the concept is basically sound, especially the screw motion thingy. I think if I could McGuyver one of those, we might be onto something. I’d replace the existing rail with a threaded rod. I think. I dunno. I’m still pondering.

I do own a 3D printer so WAF becomes easier if the thing can be disguised behind something with a nice acetone smooth finish.

Gah! Prototypes are necessary.

Yeah maybe, but bear in mind that this is your home’s security essentially. There is no point having a lock on the door if the windows fall open or can be opened/broken into because you went with some cheap as chips chinese actuator. I think we are all a bit spoilt by cheap electronics, but mechanical stuff still needs to have build quality.

1 Like

Not sure which country you are in but I don’t think AUD$57 for a 200mm actuator is too bad (and you get 15% off if you buy more than 3 at once or 25% off if you buy 5 or more. At that price I want to find a reason to buy some!).

As Nick said, this needs to be secure enough to prevent people breaking into your house.

That is an entirely fair point. However, the reason I might seem a bit cavalier about it is because I live in a rural area and windows are not my front line of defence. I’d prefer not to list my countermeasures here, but suffice it to say that they exist, and if an intruder got to the point where they were thinking about forcing open a window, I would already be aware of them, and would have far larger problems to deal with.

All of which is to say, I’m not trying to build something that can withstand a crowbar. I just want to open and hold, and close and hold. Which a linear actuator of some kind looks like it can do.

I one of the Saffers that stayed home and didn’t invade your country. You’re welcome :rofl:

As I said to @nickrout, there are other quite effective security measures in place. I mean, as it stands, a bloke can just kick out a pane and open it with the handle, so, the bar for functional equivalence is quite low.

$57aud is about ZAR600, which to be fair is not a lot of money, but is enough money that I’d have to think quite hard about getting more than one. Ideally I’d like my entire per-unit cost to be lower than that, particularly if I want to end up deploying house-wide.

But you’ve given me a cracking idea. I’ve got a mate at a bearing shop whose brain I’m now going to go pick.

Tapping into this older topic as this is exact the thing I am looking for. The Linear Actuator Motor thing looks great and I can see how it could work, but I can’t think of how to control it with an ESP, as the topic title states.
What I understand is that it opens on +=+ and -=-, and reverses when this polarity is flipped. But how to make that happen? Are there relays/relais with that functionality?

I have one running with this board

You just need 2 relays with access to the three poles, Common ( C ), Normally Closed (NC) and normally Opened (NO).

Choose 2 relays and connect both NC with ground and both NO with +12vdc, and each line of the linear actuator in the C of the relays. Meaning, when you want to open, leave the first one open, and the second relay as closed (+12vdc), do the oposite to close, you will get -12vdc.

Why I chose a 4 relay board? Because I use one of the relays to feed the 12vdc, just an extra safety feature.

Make sure your VDC power source has enough power, I went with 5 amps.

2 Likes

Thanks for your detailed reply @51Acorsi. I see how you use the relayboard, and smart do trigger the 12vdc as well. In my own research I came across this video from DrZzs. He uses a Stepper Motor Driver Board (L298N). Would that work in this setup as well? What I like about it is that it supplies the ESP with a 5v line as well, straight from the 12V power source.

You have mentioned you would like to use it with an ESP, if you pay attention to the specs of these Motor Driver Board, in the same way they provide 5v, it expects 5v as logical input. Meaning you will probably face issues trying to get it to work with ESPs 3.3v output. So, yes, you could use it, but not without additional components such as a level shifter or transistors. Still talking about the specs, check the power required from your linear actuator, the one I went with has 30w max power, as the Motor Driver Board is 25w max, it would also come in short.

1 Like

Thanks for pointing out the need to pay attention to the details. Will double check before ordering my set-up!

Thanks - this was a PERFECT solution!