DIY or buy? - Reed switches

Debating between DIYing with a 3d printed case, a bare reed switch and a rare earth magnet, vs buying a premade reed switch.

Anyone done both and care to comment? I’m going to need about 50 of them for an automation project I’m working on (window opening/closing) and want to do it right.

So far, my thoughts are:

DIY: cheaper (about 10 cents per switch) more customizable, but more work per switch, and might not be as sensitive or durable as a premade solution.
Buy: about 10x the price, ($1-$2/switch), most of the work is already done, just have to hook it up, proven, but can’t customize as easily (to fit where I want it to fit, wire length as I want it to be etc).

Would be interested how you are DIY-ing a switch at 10cts that can be integrated in HA, as the description of what you want to do is vague I assume that you did think about the electronics/pcb around it. For more support (maybe not by me), would need a bit more data…at least for me :slight_smile:

1 Like

Its part of a larger project. Thinking of 3d printing a case for the bare switch. (One of these https://www.aliexpress.com/item/1005003674539298.html?spm=a2g0o.productlist.main.3.5d3b1e5e0M3Bf9&algo_pvid=b43a27fb-6604-41b2-8eea-704701264bff&algo_exp_id=b43a27fb-6604-41b2-8eea-704701264bff-1&pdp_npi=4%40dis!CAD!0.91!0.91!!!0.66!!%402101f49e16928846911887306e42aa!12000026753056652!sea!CA!704989074!&curPageLogUid=dTXPLEMMbwE0 vs one of these https://www.aliexpress.com/item/1005002286864915.html?spm=a2g0o.productlist.main.77.5d3b1e5e0M3Bf9&algo_pvid=b43a27fb-6604-41b2-8eea-704701264bff&algo_exp_id=b43a27fb-6604-41b2-8eea-704701264bff-38&pdp_npi=4%40dis!CAD!1.14!1.08!!!0.82!!%402101f49e16928846911887306e42aa!12000019919323150!sea!CA!704989074!&curPageLogUid=42qmhhPhQflt )

The actual home assistant integration involves a d1 mini and possibly a custom pcb, which will of course add to the overall cost.

OK, from the text I though you had 1-2$ for a fully integrated switch, i.e. a esp per reed. Stil not sure what you want to achieve but the DIY allows a lot more freedom on the sizing. I myself would buy the ready-made as not interested in 50x fiddly stuff :slight_smile: And it is still not very expensive

1 Like

I remember a youtube video of a guy who made one for about $3 with an esp-01, a 3d printed case and a coin cell…

This one?

What about buy and DIY? :hammer_and_wrench:

image

This cheap Xiaomi (LYWSD03MMC) thingies can be extended easily with a reed switch. :rocket:

Bonus: For the price of a door/windows reed switch you get that plus thermo/hygrometer :thermometer:, clock :clock1: and a wireless display :signal_strength::tv: for HA sensor(s) if you want. It can run over a year on the CR2032 coin cell which were even included when I bought these for around $3.50 a piece years ago :battery:

1 Like

I really liked the look of the e-paper versions of those. But their update interval was so looong.

That would be the one…

Since you really haven’t described the project, just how you want to do it, you aren’t giving us any option to offer different suggestions. Is your bottom line reliability or price? How are you going to connect them to Home Assistant?

That’s pretty cool, so I’d just need to solder one of these to pin 08 and gnd. Is the update instant?

Not sure what data you’re missing thats important, happy to provide more, just not sure what it brings to the table.
So my project is to automate all the crank windows in my house to try to get some passive cooling going. The reed switches are to be used to detect current window state. One half will be mounted on the window, the other on the frame (possibly hidden).
The “brains” of the project is going to be a d1 mini, and probably an L298N motor controller (although have absolutely settled on that). I’m likely going to mount both to a custom pcb along with a dallas temperature sensor to give me current temperature at the window.
As I’m planning on 50 of them I don’t want to be tweaking each one constantly, but I’m Ok with a little more up front time to do things right.
Communication with home assistant will likely be done with ESPHome, but might do some custom mqtt thing if I get ambitious.

You have 50 windows in your house?
At any rate… Have you figured out the mechanics of opening and closing the window cranks? That’s going to take a lot of torque, and a lot of power.

I have moved my devices that used MQTT to the ESPHome API. It’s easier, in my opinion, to interface with Home Assistant and just removes a layer of potential failure.

How are you planning to handle a jam or other obstacle to the window operation? It will happen.

Yep 50 windows with cranks…. Yep, mechanics are all figured out and I have several working units (right now my main debate in that side is 12V vs 5V on the motor, both will do the job, 5V just takes a lot longer.
Main fault I’ve run in to in the testing is if I open the window too far it can sometimes come off the track. Solution - don’t open it that far.
Other issue is more subtle and I’m still working on - is what happens in a power outage, and recovering previous window states. Couple ideas for dealing with this, but nothing firm.
As I’m using the existing mechanism and just automating the crank, its pretty reliable as far as jamming goes. In the hundreds of cycles of my test setup I haven’t had a single jam.

This is (more or less) the mechanical side of things (based off Dr Zzs design) Parametric Window Crank by ibycus - Thingiverse

If it can go wrong, it will. At the most inconvenient time.

12V uses less current. But is it so fast that someone could have a body part in the way?

If it comes off the track, isn’t that a jam? Since you don’t have positive position feedback, you can only use timing to “not open too far”. If you use a Wemos D1 Mini at each window, you could add a tilt sensor to provide real-time position information.

Again, you do not have a positive position of the windows, so in case of a power reset, close all windows then open them back to their former position.

What happens if an occupant closes a window slightly that Home Assistant thinks is open?. I.E., Home Assistant opens the window and the occupant says “that’s too far open” and halfway closes it manually.

Also, if you use a D1 on each window, you can add a current sensor to detect a jam as a stalled motor usually draws more current than a properly running one.

Now your project is starting to make more sense. It appears that you would be replacing the crank with a motor? If so, then occupant interference would not be a problem. You could also add two buttons to the box for “open” or “close”.

Also, to get position feedback, add a magnet to the crank and Hall-effect transistor near it to count turns. Never make assumptions- start from closed then count turns as you open the window.