Modified door sensor

I’m looking for some information about electronics and modifying a ZigBee door sensor. The door sensor is a Tuya TS0203.
The sensor uses a Bipolar Hall Effect Sensor with the numbers 23735 and 2242 on it. What I want to do is connect a switch between the Vcc and output so the switch can change the contact state. What I would like to know from the electronic experts is will this work or will it just break the sensor?
The reason for this is that I have a narrow architrave switch operating some lights and I can not find any smart switches that would fit. The TS0203 is small enough to fit behind the current switch so I intend to short the mains switch wires (so its permanently on) and connect the switch across the hall effect sensor. I can then use the state changes of the sensor to trigger the smart lights turning on/off.

NOTE: This is UK wiring so there is no danger of shorting live with neutral.

Nice!! Thanks for sharing..

I would in most cases avoid wiring a light or any other device that typically has a switch so as to exclude the switch (always on). When I automate my home, it must work 100% (or as close as possible to it) even when my HA system is down. Would it be possible for you to just install a larger surface mount box that can house a traditional smart switch? I am guessing you have considered this option but wanted to recommend it anyway as this would retain your local non-smart control as well. In the USA we have some wall switches/dimmers that have a “always on mode” and that send the button presses to the HA system so that it can control smart lights, but in the event of some system issue you can easily revert it to manual control. In the past I had lots of issues with my smart LiFX bulbs defaulting to on after frequent power outages in the middle of the night and waiting for all systems to be up so as to turn the lights out was very disruptive to sleep.

Anyway, I would recommend you search for a contact sensor that uses a “reed switch” instead of a hall effect sensor as shorting the terminals of the reed switch is obviously ok. While I can’t tell you for sure, I think it is a bad idea to wire VCC to the output of the hall sensor as I’d expect damage or some other issue. If the hall sensor just sends a high (check what it is without assuming it is VCC) when it detects something then if you remove it I would assume the Tuya sensor would work as you desire without being damaged (I’d add a resistor in series just for good measure but likely not really needed).

I’ve traced the connections to the sensor and there are 3: Vcc, ground and output.
I used a continuity tester on the sensor (with battery disconnected) and there was continuity (in one direction) between Vcc and output when the magnet was close enough. Since the continuity is only one direction I should probably include a diode.

What I would do is measure the output pin when the sensor is reporting off and compare it to when it is reporting on just to ensure that on is a high. Also check what voltage you measure when high. As mentioned above I would remove the hall sensor chip and then replicate whatever the hall sensor was outputting high/low when detecting something where the output pin was connected.

A few diagrams I found showed an amplifier and a digital output on those sensors so they appear to be very basic. Would be nice if an expert could chime in as I am just a long time DIYer.

Just to take a step back, what are you trying to achieve? I’m guessing you have a central light pendant in the center of your room, that then has a light switch fitted to the architrave of your door (presumably something similar to Axiom Architrave Switch 1 Gang 2 Way | Toolstation)

Shorting out the light switch as aruffell mentioned means you end up with non functioning lights if your home automation system goes down, I’m of the same opinion Home automation should add functionality, not remove and shift to wireless.

What light fixture do you have? how are you intending to control the light? if its a dumb bulb, something like a Sonoff mini in or the loft space above the light fixture may be the best way to go. As it can sense the state of the switch, and control a bulb.

I’ve wired up many of my light fittings with Sonoff and Shelly modules and even ZigBee relays and that is great for standard bulbs but not for smart bulbs (and I have tried it). The problem with smart bulbs being wired like that is that when you power them on you have to wait for them to boot and connect to the wifi before you do things like change the colour. They also lose their pairing if turned on/off to quickly. You can, of course, hard wire the light fitting to be always on and use the relay state to toggle the smart bulbs power, but that creates issues when changing to/from smart bulbs to standard bulbs.
These things are so small that they can fit into a light switch fixture which make wiring changes far simpler. They can also fit into other devices such as lamps.
I have also tried some “No Neutral” wall switches but the flickering was noticeable depending upon the bulb installed.

Shorting out the light switch as aruffell mentioned means you end up with non functioning lights if your home automation system goes down, I’m of the same opinion Home automation should add functionality, not remove and shift to wireless.

I do agree with the sentiment, but smart bulbs always need power and if the power control is separate from the bulb then there is always the problem with the start up delay. All my automations for bulbs I currently have like this have to have about a 5 second delay between powering the light on and changing the colour.

After a little experimentation I have worked it out. It looks like the device was designed to have either a Hall Effect Sensor or a Reed Relay but not both.

The image above shows the front and back of an unmodified one together with one I modified.

In the first image, halfway up the right hand side is the Hall Effect sensor, this needs to be removed. The are also 2 through board points where the Reed Relay would be connected. I soldered wires to each of these.

I’ve had one wired up, with the two wires shorted for a few days with no adverse impacts on the battery.

Here’s what it looks like connected up:

I bought 6 of these from AliExpress for £21 so it is a very cheap way of converting a standard light switch into a smart(ish) light switch.

1 Like

could you give more details on why the hall sensor should be removed? can i contact on of it’s input with “-” of the battery?

I first tried it with the hall sensor in but when the switch was closed it drained the battery. This doesn’t happen when the sensor is removed. I have a few of them installed in lamps and light fixtures without any issues.