This is my next effort to move away from the touchscreen and interact with our stuff in a seamless manner. Using sensors and some smarts. So that I don't have to sift through a smartphone app. And get an immediate response. (My previous experiment uses offline face recognition and gesture recognition with a little machine learning)
This time, using some inspiration from Kracov's "Gift of Life" in a mash up of a Philips Wiz Motion Sensor and a Philips Wiz Remote but adding more smarts, flexibility and efficacy. And some aesthetics.
The light switch, reimagined.
WHAT- Intentional Light ControlThe color of the butterfly touched is an indication of the scene (or action) that will be created by the lights associated with the device.
The top butterfly has a motion sensor to turn on the lights with the scene, temperature and brightness defined by the time of day and 9 stages as defined by:
The accessory operates as a standalone device running on LiPO battery and meant to hang flush against the wall in the room whose lights it's meant to control.
The ESP32 runs on deep sleep and is awakened by the interrupt of the touch sensors or the motion sensor. Using static IP & DNS plus some other tactics, the response time from detection to actioned light can be as low as 3 seconds, which is comparable to a standard motion sensor from the vendor (WiZ).
- Components & AssemblyAll bodies are designed in Fusion 360 and 3D printed with PLA filament. Butterflies are individually designed & printed and adhesive copper tape is added on the back for the capacitive touch effect. Where butterflies overlap, copper tape is not added to reduce capacitive cross talk.
The structure to hold the butterflies includes small pillars to glue the wings and a rectangular cavity to pass the wire to the back of the structure. Each butterfly receives a wire soldered to its cavity and is then glued to the front of the structure. All wires are then routed in the backside of the structure to avoid overlap and minimize or eliminate possible capacitive cross talk.
The structure to hold the ESP32 Feather board and receive the cables from butterflies and motion sensor, serves also to route the incoming cables.
Then, the battery is added to the Gift Box and these two structures are added on top, soldering the battery cables to the STDP switch.
Finally, the back cover for the Butterfly structure is added. This helps in setting the accessory flush on the wall but also protecting the cables from capacitive cross talk by creating an air gap. Lastly, the back cover of the Gift Box is added, providing hanging slots both on the Gift Box (bottom) and the Butterfly back structure (top).
Of course, no 3D printed design comes out just right the first time, so many iterations were needed. Add failed prints and you get a lot of this.
The ESP32 runs on deep sleep. The 2500 mAh LiPO battery should be good for 2 or 3 months. It wakes up for one of three reasons (i.e. interrupts):
- ESP_SLEEP_WAKEUP_EXT1: the PIR motion sensor goes HIGH, which triggers an immediate command to turn on the lights and after this, fetches current time either from one of the lights of from a NTP (network time protocol) server (whichever answers first) and then sets the lights according to the 9 stages defined. Wake up by motion is only set at first boot and if turned off by touch.
- ESP_SLEEP_WAKEUP_TIMER: the next time slot in the 9 stages is up, changing the light recipe accordingly. Timer is set if awakened by motion or by timer itself.
- ESP_SLEEP_WAKEUP_TOUCHPAD: one of the 8 butterflies was touched. Will set the required scene only if it's different from the current scene. Wake up by touch is always set up.
Only three variables are maintained in RTC memory: bootCount, lightsON (to know if the lights were set ON by the accessory) and prevScene.
The UDP methods to the WiZ Lights have been reversed engineered and documented in this Python connector, meant to be an integration for Home Assistant.
Full code, generously commented so that a future me (or a present you) can follow it, is available on github.
Cover ImageBTW, the image from the cover GIF, was generated using ChatGPT-4 using the prompt: "Colorful butterflies emerging from a touchscreen that is lying flat and facing upwards, with the screen appearing shattered as the butterflies break free. The touchscreen is on the darker side of a gradient background that shifts from dark to light blue, indicating the transition from digital captivity to freedom. The butterflies appear full of life and color, contrasting with the cold, broken glass of the touchscreen. The scene is free from any surfaces, focusing solely on the touchscreen and the butterflies' flight into the open sky".
Comments