So this is Christmas, and what have i done? I’ve spent some time messing about with ESPHOME and had some successes, some failures, but a lot of fun along the way.
Anyway, when pulling the decorations out of the loft my wife explained how many will need double AA batteries putting in. This isn’t in itself a problem - but what is a problem is walking around the house twice a day switching them all on and off like a literal caveman.
So - whats the smallest, cheapest, least power hungry ESP I can get that I can wire in. This is just going to switch on a few hours a day and switch the lights on if its early evening, and off after bedtime.
These are largely powered from two AAs giving 3v - is an ESP01 the right way to go or is there something better? I’ve read they can be powered from that low a voltage.
Actually ive just realised - if i put the ESP into deep sleep, the lights will go off again, right? Is there a way of making them switch on and stay on?
2 aa batteries is not enough to run an esp + relay + whatever lights it’s too much. Esp on 2 aa usually have a few sensors, that come on take a couple of readings and then sleep again. AFAIK the relay will need constant power.
If you set up a stepper motor and a physical thumb switch. The switch needs to be mechanical to hold one position over the other without power.
This will in my experience be more difficult than you would think. Because the ESP-01 is pretty power hungry, you cant leave it on, batteries would be dead tomorrow. So you have to use deep sleep, and wake it 2x a day once to turn on and once to turn off. You will have to program this into the esp, as well as a way to determine the unequal deep sleep times, between on and off(it works on interval not time of day) As a bonus the deep sleep times are not accurate and drift. So you probably have to wake it every 15 minutes or so, check the time, decide what to do and deep sleep again. But they won’t wake up from deep sleep with out doing something like this: ESP8266 ESP-01 Low Power Mode - run it for months | QuadMeUp . Then you will need to use 2 relays in a latching arrangement to keep the relay on while deep sleep is happening, search on-line lots of info for that, however, most double relay boards, with an esp-01 on board, like the one suggested above, need 5 volts which you don’t have. You could buy a booster board, or add batteries…or a 5v wall wart…or design an electronic latch, anyway… then you have to package all this up nice( at least at my house -) )You can get 3.3 volt boards, but they may or may not reliably work at 2.4 volts from 2 AA alkaline batteries. You could use lithium batteries at 1.5V (the esp-01 will likely work, but the GPIO’s are really close to the on/off voltage for low/high). All this is going to kill the batteries even sooner, so you will be cavemanning that too, lol. There’s more, but you get the idea; perhaps a small child can be trained for caveman duties, freeing you up to do all this… (never worked for me). Have a good holiday anyway, sorry to be a downer, maybe someone else has a different experience.
Thanks for your advice everyone - seemed like a simple, fun idea before I actually thought about it. The timers on these things wouldnt be critical - i was planning to have it sleep for 8 hours, wake up, sync time, if its after 4pm turn on, if its after 12 midnight, turn off.
But yeah, actually switching stuff ‘on’ with a mechanical motor or something is more than I fancied doing or spending.
My kids are untrainable (when it comes to things I want them to do) so i’ll instead stomp around the house grumbling about it, while my hands develop callouses as theyre forced to use a physical switch over and over again.
I had the same problem a few years back, this is what I came up with(but never had the time to use…)
nrf24l01 modules have a interesting feature (from datasheet)
REUSE_TX_PL
Used for a PTX device
Reuse last transmitted payload. Packets are
repeatedly retransmitted as long as CE is high.
TX payload reuse is active until
W_TX_PAYLOAD or FLUSH TX is executed. TX
payload reuse must not be activated or deactivated
during package transmission
with a short payload this will send out thousands of messages per second, max time the nrf can do this around 2 seconds, so when you want to turn on or off just send for lets say 1.1 second
so if you listen once per second for long enough to pick up a message you can sleep the rest of the time and hardly use any power at all
this was the setup I had in mind:
on the battery powered side:
a nrf24l01 with a attiny13 or attiny85, sleeping and waking up once every second and listening for a message for around 1ms,(total time awake with power up 3.5ms ) with on or off command and a transistor to control the lights
On the mains powered side a esp8266 (running esphome ) with a nrf24l01 module, and when you want the light to go off or on just use REUSE_TX_PL on the nrf and pump out thousands of messages for 1.1 second with on or off command
I have the code I wrote for this somewhere if you are interested I can try to find it.
I would use a MOSFET like a 2N7000 and a capacitor to switch the LEDs. The gate of a FET has a very high resistance that hardly drains the load in the capacitor. Wake the ESP every 30 min or so to recharge the capacitor over a diode. Stop recharging when you want the lights to go out. Nice side effect: if you stop the recharging cycles the LEDs will slowly fade out over some time.