Hi
I have this project of creating a copy of my ceiling fan remote control.
I want to note that, contrary to most IOT project, my ceiling fan is controlled by a 433.92MHz remote and it's very good that way. I do not want to involve any bluetooth, wi-fi, or phone. Just a good old copy of my current remote. Because why not.
What I have for the moment: I bought an ESP32 and a CC1101 emitter. I can emit the "light on" signal with a code like this:
#include <SmartRC_CC1101.h>
#include <RCSwitch.h>
int pinTx = 4;
RCSwitch mySwitch = RCSwitch();
SmartRC_CC1101 myRadio;
int repetitions = 15;
unsigned int protocol = 1;
unsigned int rdelay = 256;
unsigned long encodedSignal = 3481482895;
unsigned int bitlength = 32;
void setup() {
Serial.begin(115200);
myRadio.Init();
myRadio.setMHZ(433.92);
mySwitch.enableTransmit(pinTx);
myRadio.SetTx();
Serial.println("Transmit");
mySwitch.setRepeatTransmit(repetitions);
mySwitch.setProtocol(protocol);
mySwitch.setPulseLength(rdelay);
mySwitch.send(encodedSignal, bitlength);
}
void loop() {}
I learned the "encodedSignal" thanks to the RCSwitch library example, and so I know all the codes I need (fan on, off, speed up, down, etc...)
What I want to do now is to turn this into a true remote control, and my main problem will probably be power management. For now, I'm connected via usb, but in the end I will want to be battery powered and that it last as years, if possible. (On a traditional remote, you can keep the same batery for years...)
Reading about consumption in deep sleep (~10µA? I'm not sure), I calculated: 100mAh battery vs 10µA deep spleep consumption, that is 10000h or a little more that a year. It doesn't seems a lot.
But then I though, I don't need deep spleep. I could be fully disconnected, and pressing the button will both power the board and select wich signal to send.
I have the ESP32 + Li battery (3.7V) + Step-Up Power Module 3.7->5V + 4 tactile buttons. The question is, how to wire all of that so that pressing the button will power the board for long enough to send the signal, and signal the board which button was pressed.
I'm also open to any other idea to achieve the same result. I might not have chosen the best approach.
Thanks
