[Hack] Completely revised - Add local Zigbee control to Switchmate

After building the initial Zigbee Switchmate, I found there were significant issues with the way the buttons for pairing and reset were connected that caused erratic behavior when you even got near the device. This also would eventually result in its dropping from the network. I've completely changed the way the button is mounted and revised the procedure for reset and pairing. There's no longer a need for two buttons and assembly is dramatically simplified.

Since I have a habit of posting my thoughts instead of a simple step by step, I've decided to revise the previous post and add the module removal detail together with build instructions. I hope this will make the project more approachable for those with an old Switchmate and some spare Sengled bulbs.

Zigbee module

Sengled bulbs BR30 bulbs are incredibly easy to hack. I mean, really easy. It takes less than a minute to open the bulb and extract the Zigbee HA module. The module can then be driven by a standard 5v DC source, and you can trigger an Arduino relay or, as this post describes. a Switchmate.

Since the original intended use case is mains powered only, they draw 30mA at 5v DC, and so are not suitable for battery powered use, but are easily powered with a common 5v DC USB power adapter.

How to open the bulbs

Recommended tools to make the job easier - (left to right) Diagonal cutters, needle nose pliers, small blade screw driver, small philips screw driver, plastic spudger

  1. Start by using your thumb nail and run it around the circumference of the bulb until you find a spot where there is a small gap between the defuser and the bulb housing. In every one of these bulbs I’ve opened, this has been very easy to find.

  1. Once a gap is found, insert the blade end of a spudger into the gap.

  1. Work the plastic spudger around the circumference of the diffuser. The sealant/adhesive used on the diffuser is very easily parted from the housing. There are four locations on the diffuser where it also clips to the housing. They will become evident as you begin to pry the diffuser away.

  1. Pry the diffuser away from the housing and you will see how it was sealed and clipped in place

  1. There are now 5 Phillips screws (circled in RED) that must be removed. The 3 in the center hold the LED heat sink to the housing, and the 2 outer screws hold the Zigbee radio antenna to the housing.

  1. Now the Edison screw base must be detached from the bulb housing. The Edison screw is crimped at several points to the housing. Removal is simple, but be careful here and wear gloves so you do not cut yourself. Start by using a small flat head screwdriver to pry up at one of the points where the Edison screw is crimped to the housing. I've found that there will be a slight gap where the neutral wire is sandwiched between the housing and the Edison screw, and this is an easier place to start prying. The metal is very thin, so I've even just cut it with a utility knife.

  1. Once you get a bit of the Edison screw pried up, you can use needle nose pliers to simply peal it back, and this will release it from the housing.

  1. Now that you have the Edison screw detached, you can see where the HOT wire is soldered to the base of the Edison screw. Simply take diagonal cutters and cut the wire from the base.

  1. Now just lift up on the housing to reveal the LED driver board with the Zigbee HA module attached.

  1. The LED driver and Zigbee module simply unplug from the LEDs and heat sink. You can also attached wires to the module and the LED/heat sink assembly to create your own custom LED fixtures, allowing the LEDs to be mounted flat with ready made screw holes and supplied screws to hold them in place. If you're curious, the output voltage from the driver with the LEDs under load is 70v DC at 100%, and 62.3v DC at 1%.

It is also possible to skip the removal of the module from the driver board, and instead use it attached to the driver board with a 110v relay. AC relays work fine. However since the bulb was originally designed to fade to off, a mechanical relay attached to the driver output connections does not turn off instantly. If you don't need the device you're controlling to turn off instantly either, then this is a viable solution and less expensive to build.

  1. The Zigbee HA module unplugs from the controller board by simply pulling it away. Use the flat end of your spudger to pry up at an angle on the antenna plug from where the wire is attached to it, separating it from the Zigbee module.

  1. The LED array is not glued to the heat sink. It lifts easily away, since once the screws were removed in step 5, the only thing left holding it in place is thermal paste. The paste is messy, but it's not caustic.

  1. The antenna connector is easily crushed, so I do not advise trying to remove it by forcing it through the hole in the heat sink. Instead, de-solder the antenna wire from the antenna board, or if you are not going to reuse the LED heatsink, you can likely just use large diagonal cutters to carefully cut through the aluminum without damaging the antenna cable.

  2. Once the antenna is free from the heat sink, re-attach it to the Zigbee HA module. You will not be able to pair or control the Zigbee module if the antenna is not attached to it.

Zigbee HA module operation

Here are the operational pins.

From left to right:

5 volt input from your power supply.
The most logical choice is to cut off the micro USB end of a USB power cable, and supply power to the circuit by plugging the USB A connector into the power adapter. These cables seem to come with all kinds of devices today, and typically have just two wires in them, making the task very easy. Quite often I've found that these USB power cables have a RED insulated (+5v DC) and either a BLACK insulated or bare wire (negative or ground wire).

PA6
When the module is paired and turned ON either manually (as described here later) or via the Sengled bulb driver, Pin PA6 supplies 3.4v DC. When the module is OFF, there is no power on Pin PA6. This is a high level output, suitable to trigger a solid state relay or Arduino relay with a very low trigger amperage. It doesn't have enough current to drive just a relay by itself.

Ground
AKA the negative power terminal, but more accurately, it is ground. Ground is where the negative wire from your power supply goes,

PB0
I was able to determine two uses for Pin PB0. The first as mentioned before is that it functions as a manual ON/OFF for the module output. So if the Pin PB0 is closed with the ground pin and held in that state, the module will stop supplying 3.4v DC to Pin PA6. If the connection between PB0 and ground is again opened, this overrides an OFF state that may have been sent from the driver. The module state will now be ON, and 3.4v DC is supplied to Pin PA6.

Pin PB0 has a second important function, and that is when contacted briefly to the reset test-point on the Zigbee module 15 times in a row, the module will factory reset. When held for 5 seconds, upon release, the module enters pairing mode.

Zigbee module reset and pairing procedure

  1. Factory reset to prepare for entering pairing mode by shorting Pin PB0 with the reset test point on the board 15 times in a row. It's not possible to initiate pairing on the module without a factory reset first.

  1. Initiate pairing (always AFTER a factory reset) by shorting PB0 with the RST test point for 5 seconds. It is important to wait for 5 seconds after a factory reset. If you don't wait, the module will not enter pairing mode.

Practical Use

The module will pair with HE as a Sengled Element Classic bulb. Simply label it as the device it's installed in (i.e. "Zigbee Switchmate"). This post is focused on converting a cloud-based Bluetooth Switchmate into a local Zigbee Switchmate, but the module can be used with Solid State or Arduino relay boards as well.

Suitable Relays

This Solid State Relay module isn't cheap, but it works reliably.

I have built a switch with this Arduino Relay module and it works perfectly. I have had it controlling some low voltage lights in the garden for weeks now, and it's been perfect. It's a three relay module, and while only one channel is needed, this is what the seller had. It works so perfectly and it is so inexpensive, that I haven't bothered to look for a two or single relay module. The seller ships fast and the modules have arrived very quickly the two times I've purchased them.

Converting a Switchmate to Zigbee

Step 1:
I recommend these buttons for the task of pairing and reset of the module. It is important that the button be connected by a shielded cable and that it is kept short.

Step 2:
De-soldered the 4 pin header from the Zigbee board to make it fit easily into the Switchmate battery compartment and partially up through the slot widened in the top of the battery compartment. It isn't all that easy to de-solder the header pins and you'll see in the photos that on the second of these Sengled Zigbee conversions I built, I accidentally pulled the traces from the board while pulling on the pins and holding a soldering iron to it. It wasn't de-soldering easily and I got a little impatient. Fortunately there's a 5v test point I was able to use.

Step 3:

Solder a shielded cable to the button and then use a drop super glue to affix the button right onto the module board. The other terminal of the button should be positioned over the RST test point. Once the glue is cured, solder the button to RST.

IMPORTANT
You must use a shielded cable, with the braided shielding soldered to the Ground test point on the board. If you don't, the module will trigger every time your hand gets near it, and it will also drop from the network every so often. By using a shielded cable and grounding one end, the issue is illuminated and the module is stable. Some sources for very small shielded cable include the antenna cables for the WiFi modules in old laptops, old routers with external antennas, and Sirius satellite antennas for vehicles to name just a few.

Step 4:

Solder the center wire only to either the PB0 test point or where the header was on the board. It is unnecessary to solder the other end of the shield to the other ground point. I simply fold the shield back at the other end and used a small piece of shrink tubing to keep it from shorting against anything.

Step 5:

Widen the opening on the battery compartment so the module, including the antenna connector can easily slide through. This is a very tight fit, and in order for the Switchmate front cover/button to be re-installed and remain operational, the Zigbee module has to fit right in the center of the two middle support ribs on the battery cover and sit at an angle. The plastic is very soft and a sharp utility knife easily cuts through it.

Step 6:
Add a 5v to 3v buck converter. I've posted about how to use these before and where to get them. You'll need the 3v output for the Switchmate itself, but you'll need to tap into the incoming 5v supply to power the Zigbee module. The 5v supply I used here is just an old Samsung phone charger with the micro USB connection cut off.

NOTE: This is an older photo. Just use it for reference of the power solder points. Disregard the wires soldered to the module itself. That is the old way without shielded cable that caused problems.

Step 7:
Solder the output from PA6 on the Zigbee module to the button of the Switchmate controller board as shown.

Step 8:
Attach the antenna to the module and tuck the antenna board just under the Switchmate controller board on the right and on top of the battery compartment on the left as shown. I just put a piece of tape on one end to hold it still long enough to get the cover/button back on the Switchmate. After that, I just tucked the buck converter and any loose wires in the space above the motor. It all stays put nicely, and it wasn't necessary to hot glue anything in place. The antenna board just, clears the mechanism and the 110v wall switch that protrudes into the Switchmate slightly when in use.


9e1ad65b37c45a76128348c1583c85163c59f32b_2_690x378

Step 9:
Reinstall the top cover and center the Zigbee board in the battery compartment so it clears the reinforcement ribs that are molded into the battery compartment cover.

It's not perfect, but it works and the original Switchmate button is still functional, once the Zigbee module has cycled the unit one time after power up.

Step 10:
Using the smaller end of large round file (aka rat tail file) to cut a notch in the battery compartment cover so the 5v power supply cord would exit the battery compartment without interfering with the neodymium magnets that hold the Switchmate to the cover plate screws of a standard light switch.

Reset and Pairing

  1. Factory reset the Zigbee module by pressing the Reset button 15x. The Switchmate will cycle each time. This is OK and the module will still reset.

  2. Wait 5 seconds. This is important. If you reset and then try to proceed to pairing without a 5 second pause. the module will not enter pairing mode.

  3. Put the hub into Zigbee discovery

  4. Press the Reset button and keep it pressed for 5 seconds. When you release "Sengled Element Classic" should appear in Hubitat Elevation within a second or two.

Step 11:
Make a virtual switch to control the device and then make a rule so that when the virtual switch is triggered, the Sengled Element Classic Zigbee module will be set to ON for 1 second, then returned to OFF. This is needed to send a 3.4v pulse to PA6 and thus the wire soldered to the button on the Switchmate controller board as shown in Step 7.

Conclusion

Let me know how you make out with this project if you decide to build one. I've built two of these so far. I have two Switchmates still to convert, and it's been useful to control heavy loads without investing in a heavy-duty load controller. The only disadvantage to the Switchmates is they remain flip-flop controllers. Unless you solder the reed switch of a contact sensor to one of the limit switches, there's no way to know the state of the switch it's controlling without observing the load.

5 Likes

Don't think I'll be taking the time to do this project, but very cool indeed.

If you sold pre-soldered Switchmates I'd buy one!

2 Likes

I love your work man, and I'm going to use the inspiration to adapt it for my use. Which is, to mod this external Solar/Battery/Mains powered security siren I have so that I can trigger it and then reset it.
I've already determined I can remote the siren and have been wondering how best to drive the outputs. Now thanks to your work, I should be able to do it.
I'll create a new post,, linking to this one, when I get all the bits in place and implement the solution.
Whoo hoo

2 Likes