0

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:

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.

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.

C2

Finally, the output signal, absolute value and almost equal in amplitude.

enter image description here

Martin
  • 101
  • 3
  • Have you measured the actual signal? Do you have any pictures of that? – jay Oct 06 '21 at 19:06
  • 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. – Aaron Oct 06 '21 at 19:07
  • 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. – Martin Oct 06 '21 at 20:30
  • 1
    @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". – jay Oct 06 '21 at 20:46
  • @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. – Martin Oct 07 '21 at 10:44
  • As a test, you can make C1 much larger, like 10x or 100x and you should see the pulse stretch. If so, then your circuit is correct, and not random switching noise. It looks correct to me. – Aaron Oct 07 '21 at 13:27
  • @Martin I am not familiar with ESP8266, though, in order to wake up, the microprocessor should take the signal (interrupt) during sleep. All it needs is a signal. The rest is algorithmic matter. What would be the concern? – jay Oct 07 '21 at 13:43
  • @Aaron I did as you said in LTspice. I thought I'd spare you the images, but indeed the pulses were extended. The negative pulses at C2 are very small now, < .1V, but the opamps manage to amplify them - to working voltages if I increase R5. – Martin Oct 09 '21 at 13:03
  • @jay Appreciate it! I googled "edge detection" and came up with this https://electronics.stackexchange.com/questions/519758/improving-edge-detector-with-latching-circuit-for-esp8266 That's more or less exactly what I'm trying to do. What do you think about his solution? – Martin Oct 09 '21 at 13:06
  • The author of https://electronics.stackexchange.com/questions/519758/improving-edge-detector-with-latching-circuit-for-esp8266 has confirmed that it works. With some modification it should work for me also. Thanks everybody! – Martin Oct 11 '21 at 07:43
  • @Martin I am probably not a right one to answer, not understanding what the concerns are, if ESP8266 can wake up when input changes. The simplest would be giving the signal by connecting the wake-up pin to ground or vcc. Have you tried? You may pull-up/pull-down to the default state first. – jay Oct 11 '21 at 15:23

0 Answers0