Using LTSpice and uninformed dabbling I've managed to produce positive spikes from a wall switch that I hope will wake an ESP8266 for use to control hue lights. Once awake the IC will debounce, read the switch state and send the appropriate messages to the bridge.
My question is, will it really work? I'm using a voltage controlled switch to simulate my wall switch on/off actions and I'm worried that I am only amplifying encoded artefacts like current creeps.
Note: this is not supposed to be connected to mains, it is a DC project unless considering arbitrary hue lamps which is not within the scope of the question.
Note: the idea is to wake up the IC by pulling up the reset pin. Once awake, code will take care of everything.
The question was originally posted here and the ltspice-file is attached to my final comment.
Here is the schematic:
The left part originates from this hue project which is similar to what I want to do but with toggle-switches. The voltage controlled switch simulates the on/off action of the wall switch.
The right part is an op-amp absolute value circuit the rectifies the signal. The IC, voltage regulator and pull up circuit is not included in the schematic but should be similar to the already mentioned hue project.
First here is the signal at the resistor marked R8.
Next the input to the op-amp circuit, at C2. As you can see, switching on results in a large spike with a negative overshoot. Switching off results in the opposite, but smaller.
Finally, the output signal, absolute value and almost equal in amplitude.
-
\$\begingroup\$ Have you measured the actual signal? Do you have any pictures of that? \$\endgroup\$jay– jay2021年10月06日 19:06:50 +00:00Commented Oct 6, 2021 at 19:06
-
\$\begingroup\$ Where is your AC signal? You did say wall switch right? Also, you need to put in a transistor model, right click Q1 and pick one (2n2907) and same for the diodes. The link to the HUE project is broken. \$\endgroup\$Aaron– Aaron2021年10月06日 19:07:47 +00:00Commented Oct 6, 2021 at 19:07
-
\$\begingroup\$ Thanks @Aaron and jay. Clarified and corrected link. Note, no AC. It could be any two state switch. I selected the transistor and picked 1N914 for the diodes. The plots turn out the same. \$\endgroup\$Martin– Martin2021年10月06日 20:30:13 +00:00Commented Oct 6, 2021 at 20:30
-
1\$\begingroup\$ @Martin, You do not need any of the circuitry, except the switch, a pull-up resistor, and a small capacitor. Your code "debounces" and "detects edge". \$\endgroup\$jay– jay2021年10月06日 20:46:21 +00:00Commented Oct 6, 2021 at 20:46
-
\$\begingroup\$ @jay Yes, provided the IC is awake, no? The circuitry is to wake the IC (on both on and off actions) as in github.com/diyhue/Devices/tree/master/HueTapSwitch/ESP8266. \$\endgroup\$Martin– Martin2021年10月07日 10:44:27 +00:00Commented Oct 7, 2021 at 10:44