Light switches are great, but when paired with ordinary bulbs, they have their limitations. Smart light bulbs are better, but require a different approach!

My main problem with light switches is that they aren’t always beside you when you need to flick them. 99% of the time it’s not a problem as you flick the switch when you enter or exit a room.

Sometimes, however, you want to turn on the light, but you’re nowhere near the switch.

My Idea

We had a new kitchen installed back in 2023. One of the features of this was a smallish overhang on the counter.

For this project, I wanted to try and build a light switch I could put under the overhang. One that was easily accessible, easy to use and yet completely invisible. Well, okay, not completely invisible, just really hard to see 🙂

I wanted it to run on battery too, so I wouldn’t need to run power to it. This meant that WiFi was out of the question.

To ensure the button wasn’t visible side it, it needed to be small and thin.

Technology

When it comes to low power and long battery life, two options presented themselves. Zigbee or Matter over Thread. I have *lots* of Zigbee devices, so I decided to give Matter a chance here.

I won’t go into the details, but Matter is an emerging standard for smart home devices. It resolves many of the problems with the current ecosystems as devices can be shared easily. It supports WiFi or Thread (a lower power network).

By accident I happen to have a Thread network in my house thanks to the Apple Homepods I own. Nothing users Thread, so again, a good excuse to try it out.

Hardware Choices

I had two micro controller units in mind for this: a Nordic nRF52840 or an ESP32.

The ESP32 comes in a few variants. only the H2 and C6 have the necessary radio for Thread, so they were options. The nRF52840 also supports Thread. I’ve been working with the nRF52840 on my radiator sensors, so figured I’d try the ESP32.

I picked up an H2 developer kit to get started. As always, bigger than I expected!

For the button, I decided to give a capacitive button a go instead of a mechanical button. They are thin and small. They consume power, but I thought they were a good starting point. I picked up an AT42QT1010 from PiHut as a starter for 10.

I opted to use the espressif frameworks instead of Arduino as I’ve always had a better experience. Espressif have their own Matter library, which was easy to get setup.

After a lot of hacking around with the samples, I got the capacitive button wired up and generating button presses! Espressif made this easy with their IoT espressif/button component.

You can see the IoT button triggering events

I paired the device with my iPhone. With an automation, I used the capacitive button to turn the lights on and the “button” to turn them off. Apple’s HomeKit can’t *toggle* lights, hence the need for two buttons!

Power Consumption

With the general idea working, I turned my attention to power consumption. Matter has the concept of an ICD or Intermittant Connected Device. These are designed to limit the power needed and only transmit when there is something to say. It piggy backs on the Thread concept of a Sleepy End Device.

After much reading, I found the espressif/button supports a power saving mode. I worked through another of the espressif samples and got the device working on battery.

The capactive button draws another 1mA, which is a considerable amount of power

Initially, I thought it was drawing 2.5mA when asleep (which is good!), but it turns out that is the lower limit of my multi-meter!! The power consumption when the device is asleep is actually less than this.

That said, at 2.5mA, the 3500mAh battery I had in mind would give almost 2 month’s runtime. More than enough for an amateur like me!

With the button now working under low power mode, it’s time to expand its capabilities! That allows me to bring long press and multi-press support into play!!

Multi-press supporting working as expected!

Trying the C6!

The H2 development kit was working well, but for installation, it was a little bloody big!

My favorite MCU maker Seeed have a XIAO ESP32-C6 unit, which is nice and small. It also has an external antenna connection, which I figured might help.

I had lots of pain getting my code working on this device. I spent a lot of time debugging my code and trying to get it running. It just never seemed to work when on battery.

It turned out that the power consumption was *so* low, the resistor in my multi-meter was essentially blocking the power!!

After that *ah-ha* moment, I moved to the 10A input on my multi-meter and the problem went away!! This only confirmed the low, low power consumption, which was good news!!

I soldered some wired onto the battery terminals on the back of the C6 and we were in business!

Next Up

Next step is adding some longer wire between the C6 and the capacitive button, before installing it!

I have the perfect place in mind under the kitchen sink. There is a nice gap between the worktop and blanking drawer. I can also use some velco to fix the battery to the back of the blacking drawer.

I’ve just installed a new spot, which shines onto the sink, so it’s an ideal test setup!

More to come!

Be sure to check out my YouTube channel.

15 responses

  1. […] I mention in this blog post, I started out with a multi-meter to measure the consumption of my devices. I love my little […]

  2. I’m thinking of trying to put something similar together but in my case it’d be a Matter over Thread temperature sensor (BME280 or BME680 perhaps). I’d be _really_ interested to see what the power draw of the ESP32C6 board you’re using is using your fancy power profiler though!

    1. I powered it up using the PPK and it wasn’t good. 29mA was the average consumption!

      Two things to note:

      1) That was powering it via the VDD pin, so I expect there is probably power regulator of some description in the way. I need to solder onto the battery terminals.
      2) I haven’t spent any time optimising the code. My cheap multi-meter was showing a tiny draw, so I hoped it was all working out of the box. Obviously not!

      I’m currently focused on my Zigbee temperature sensor, so once I get that project finished, I’ll be back to my Matter device. Thought I might try and implement my button project in Zigbee on an nRF, since I know the consumption is tiny.

  3. […] Whilst I wait to take delivery of the PCBs for my Zigbee F.A.R.T. sensor project, I returned my attention to my Matter switch project. […]

  4. […] I immediately connected up the breakout board with an ESP32-H2. I used the ESP32-H2 as it happened to be connected to my PC at the time (for a Matter protocol project) […]

  5. […] learning all about Matter as I’m in the process of making a few Light Switches of my own for different things in my house. Purely hobbyist, but knowing the fundamentals never […]

  6. […] are certified by the Connectivity Standards Alliance (CSA). It’s also the reason that DIY Matter devices with ESP32 get a warning from iOS says the accessory isn’t […]

  7. […] part of my little idea of a touch-based Matter button, I plan on using a small capacitive button. They are slim and silent. Perfect I […]

  8. Wait, so… you basically drew long cables to some place for the touch sensor and mounted the device somewhere close to the light?

    1. That is the plan. I haven’t actually *done* it. The device will be mounted in the cupboard under the sink and ran along the cupboard.

      I have got a working Matter enabled switch now, but I need to test it. Honestly, I’m not sure how well it will work under the worktop as people’s legs will probably come into contact it.

      I will do another post once I have tried it out!

  9. Interesting project! Can you share the code?

    Best,

    Andre

      1. I’ve also made a video:

      2. Thanks! You did not use light or deep sleep, right?

      3. I didn’t know a lot when I cobbled this together!

        I have it running off a USB supply at present, but in reality it should be running on battery, using Matter LIT (long interval time).

        I will be making another version of this, using a nRF54 instead of an ESP32 as it’s more efficient. I just need to figure out the capacitive touch again. That’s the most power hungry bit!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.