KaufHA / kauf-rgbww-bulbs

Files for the KAUF RGBWW Smart Bulbs
42 stars 18 forks source link

Would anything prevent deep sleep mode, if an add-on is wired correctly? #32

Closed canadaduane closed 1 year ago

canadaduane commented 1 year ago

Hi! I'm trying to create an "offline bulb" that can wake and do a little computation every minute or so. To accomplish this, I'm planning to add a coin cell battery, and connect EXT_RSTB (pin 32) to XPD-DCDC (pin 8) to accomplish hardware wake after deep sleep.

I'm wondering if there is anything already wired that might prevent this setup from working? I imagine that the circuit board for a light bulb in a socket is not necessarily anticipating having to be particularly energy conscious at this level. Is there anything I should be aware of before getting my hands dirty (and various things ordered)?

Thanks!

bkaufx commented 1 year ago

I don't really know how to answer this. I don't know that the XPD-DCDC pin is exposed in such a way that it could be connected to easily. I also don't understand what you want to do. Are you going to have the bulb connected to AC power? Why does it need to go to sleep? What does "offline bulb" mean? Not connected to network or not connected to power? What kind of computation are you trying to do every minute?

canadaduane commented 1 year ago

(I sent an email earlier that may have been sent to spam, but I'm reposting the relevant parts here in response to your questions):

I'm making a light bulb that mimics sunlight based on the time of day, without being network-connected. Basically, I want the privacy of a "regular lightbulb" but with just enough smarts to be a daylight bulb during the day and an evening bulb during the evening, with a smooth (imperceptible) fade during the hours in between. When the light is off, it isn't secretly communicating with anything. When I turn the light on, it knows the time of day (because it has been secretly waking up every minute or so) and correctly initializes as a cold white or warm white light as appropriate (or in-between temperature).

Here's what I'm imagining:

bkaufx commented 1 year ago

Why do you need to recalculate every minute and not just do it when the bulb turns on? Can you just keep the bulb powered all the time and use a smart switch to turn on the light? I'm sure you could hard-code in the adaptive lighting algorithm or something similar (https://github.com/basnijholt/adaptive-lighting). Keeping track of time might be the hardest part here.

bkaufx commented 1 year ago

Regarding your question about waking, I don't really know. You'd have to open a bulb and see if it is possible. There is no terminal labelled XPD-DCDC or similar. You'd probably be better off trying to design this through more general esp8266 sources than with my help.

canadaduane commented 1 year ago

Why do you need to recalculate every minute and not just do it when the bulb turns on?

EDIT: AFAIU I just need to keep track of time, and "every minute" is one way to do that. No computation is necessary other than an increment of some kind to track the passage of time. An on-board RTC would be better, but bulky, so... I'm trying things :)

Can you just keep the bulb powered all the time and use a smart switch to turn on the light?

No, my goal is to create a smart bulb (i.e. microcontroller with light capability) that is not network connected--i.e. for people like me who don't want networked smart devices (aka "threat vectors" to the paranoid) in the home. I also just enjoy a challenge.

Keeping track of time might be the hardest part here.

Yeah, as far as I understand it, if the mcu is powered off completely, there is no way to track time. Hence the coin cell idea.

There is no terminal labelled XPD-DCDC or similar.

I'm basing the pinout from this diagram. Is it incorrect?

image

You'd probably be better off trying to design this through more general esp8266 sources than with my help.

No worries! Your bulb is amazing for this project, as it is so much more hackable than anything else I've seen--plus it uses esp8266 which is a chip I'm more familiar with.

bkaufx commented 1 year ago

I think I'd hook up an RTC module to TX/RX and/or IO0. I think any of those 3 can be used for i2c but not 100% sure. They have a million on Amazon that are powered by coin cells. I'm sure you've seen them.

On the bulb, have a routine that runs on boot that checks the time and sets brightness and color temp accordingly. There's no reason to go to sleep and wake up at all. The bulb can just figure out the right color whenever it's time to turn on.

On Tue, Mar 28, 2023, 7:34 PM Duane Johnson @.***> wrote:

Why do you need to recalculate every minute and not just do it when the bulb turns on? Can you just keep the bulb powered all the time and use a smart switch to turn on the light?

No, my goal is to create a smart bulb (i.e. microcontroller with light capability) that is not network connected--i.e. for people like me who don't want networked smart devices (aka "threat vectors" to the paranoid) in the home. I also just enjoy a challenge.

Keeping track of time might be the hardest part here.

Yeah, as far as I understand it, if the mcu is powered off completely, there is no way to track time. Hence the coin cell idea.

There is no terminal labelled XPD-DCDC or similar.

I'm basing the pinout from this diagram. Is it incorrect?

[image: image] https://user-images.githubusercontent.com/129/228411426-208339d4-99d8-43de-9d82-65570618b580.png

You'd probably be better off trying to design this through more general esp8266 sources than with my help.

No worries! Your bulb is amazing for this project, as it is so much more hackable than anything else I've seen--plus it uses esp8266 which is a chip I'm more familiar with.

— Reply to this email directly, view it on GitHub https://github.com/KaufHA/kauf-rgbww-bulbs/issues/32#issuecomment-1487862653, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHSV2PVGGDWJTE5VP6OMADTW6ONRPANCNFSM6AAAAAAWJ335NA . You are receiving this because you commented.Message ID: @.***>

canadaduane commented 1 year ago

You're right, if I can mount an RTC inside the bulb, that should work. The heat may affect its performance or accuracy, but it's worth a shot :) I've ordered a ChronoDot 2.0 and I'll see how it goes. Thanks for the suggestions.