We present to you a small smart switch that, at first glance, seems to offer nothing new but is, in fact, different from anything we’ve encountered before. This little device called SwitchC6 from M5Stack surprised us. The concept isn't new, but the fact remains that this smart switch, as far as we know, has no direct equivalent on the market.
The SwitchC6 smart switch comes in a slightly different housing than what we are used to from this manufacturer. The plastic casing is "milky" and translucent, hiding more than it reveals. It is designed to be mounted on a DIN rail in a distribution board, though it can also be screwed down or simply left in a junction box as is. On the sides, there are two spring-loaded ("Wago-style") terminals, labeled L-In and L-Out, which can accept wire cross-sections from 0.5 to 4 mm². These are the only terminals through which any wires can be connected to this switch. But more on the connection later.

Opening the casing—not an easy task—we see that a relay capable of handling a maximum of 16 Amps at 250 Volts is used to break the phase (L - Live). The relay operates at five volts, provided by a tiny transformer located right next to it. On the top side of the PCB, there are several tall components, such as capacitors. One of these tall components is the ESP32-C6-MINI-A module, mounted sideways, which gives this switch its "gateway to the world." We have written about this MCU several times before, so we won't repeat ourselves. The ESP32-C6 comes pre-loaded with the appropriate firmware, though we’ll cover that later too. PTH pins for (re)programming are exposed if you wish to use the switch outside of M5Stack's intended ecosystem. A button on the side serves two purposes: it can toggle the relay or be used for broadcasting/transmitting signals or data. There are also two LEDs: Green, which indicates the relay status, and Blue, which indicates the capacitor charging status.
As mentioned, this smart switch does not use a classic power supply via mains voltage as we would expect (like the device in the following text). For example, in typical situations, we would have one connection for mains voltage (Live and Neutral) if mains regulation exists on the device, as is the case here. We would then have one input and one output—the line to the load (hereafter: the light bulb)—which we would break using the relay.
Here, we have only a Live input and an output to the load. So, how does this device work? How is the electronics powered? Where does it get its Neutral from? As we know, for energy to flow, the electrical circuit must be closed. And it is—through the light bulb. M5Stack has resorted to a very interesting trick. The Neutral is already connected to the bulb, and we provide the Live via the switch as needed. This means that the wire coming to the switch pulls the Neutral through the bulb, which is always present at the switch while it is off. Therefore, at the switch location, we always have the Live, but also the Neutral through the bulb, while it is off. When we close the contacts on the switch, we send the Live to the bulb, "closing" the circuit between Live and Neutral, which heats the filament and produces light. Okay, if the relay is off, we have Live at L-In and Neutral via the bulb at L-Out, so it's clear how the switch gets its power. It is worth stressing that even when the relay is off, the device should not be treated as fully de-energized; before any installation or maintenance work, the upstream main breaker should be switched off. But what happens when we activate the relay? At that point, the Live flows through the relay, through L-Out, and goes to the bulb. Where is the Neutral then?
To lift the veil on this topic, we need to shift our thinking from red and black wires to brown and blue—that is, from low/direct current to high/alternating current. If we connect one bulb to the switch, it will work at full power. However, with one switch, we can connect multiple bulbs in series and/or parallel. If we connect them in parallel, meaning each bulb has a direct connection to Neutral and a direct connection to Live via the switch, both will shine at full intensity because they have an identical power supply. If one burns out, the others will work without a problem. Only the contacts on the switch might suffer from a higher number of bulbs. If we connect the bulbs in series, the circuit behaves like a voltage divider. The voltage is divided between the bulbs as consumers, so they won't shine at full intensity; they will be partially dimmed, regardless of a stable mains supply. How much they dim depends directly on the number and wattage of the bulbs. If one bulb burns out, the circuit is broken, and the others won't light up either.

The series connection method is also used in this switch, but since the switch itself is an extremely low consumer, the voltage drop across the bulb will not even be noticeable. For this purpose, M5Stack used the BP8006, a single-phase, single-wire smart power panel IC. Unfortunately, the complete documentation for this integrated circuit is in Chinese, so we cannot tell you more about it. When the switch is first connected to the mains, it is necessary to wait a few minutes for the capacitors to charge, which we will know when the blue light turns off. The ESP32-C6 and the electronics on the PCB will draw power from the capacitors if, for example, the bulb has burned out. If we don't replace it for a long period, the capacitors will discharge; after replacement, the capacitors will begin their charging cycle again. Power to the switch can also be cut if we add a classic switch upstream that we turn off as needed. We are very interested in the schematic, but we haven't found it for this switch. Keep in mind that in the "off" state, the switch receives both Live and Neutral, but it does not send the Live through its transformer windings to the bulb.
The firmware on the switch uses an ESP-Now Mesh network. We haven't written about ESP-Now yet, and we owe you that. For now, we'll just say it's internal communication between two or more ESP devices, through which data is exchanged via a 2.4 GHz radio link. For pairing with the controller that will manage this switch, the MAC address printed under the DIN rail mount is used.
To control the switch with the factory firmware, M5Stack suggests using, for example, the CoreS3, which we already have. We use the existing firmware on the switch, and for the CoreS3, we add the M5SwitchC6-ESP-NOW library, which comes with two examples: Broadcast_Scan and Controller. The first example scans for available switches and ESP-Now transmissions in general, while the second is used to control the switch. Within the example, it is necessary to modify the local network data and the switch's MAC address. There is a template for how communication works, where the switch and controller send data to each other. The entire packet consists of MAC addresses, relay state, communication channel, and capacitor voltage. With certain additions to the example, we can add more of these switches and use the CoreS3 to send statuses to a server and synchronize with the server state. This would allow us to use a mobile phone to manage the switch.
The M5Stack SwitchC6 is a very interesting solution for situations where only one wire is available. We tested it with a classic bulb and an LED, and we had no problems; everything functioned perfectly. Finally, we should add that the wireless module comes with an unpopulated header through which we could use two additional IOs, isolated via a CA-IS3642HW digital isolator.
Source: SK LABS
Author: Dejan Petrovic
