Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By trackerj
#53029 A RC Low pass filter combined with a debouncing technique migh solve your problem.
I have used this setup with success many times, in very noisy industrial environments.

In the Pushbuttons-and-debouncing post you can find the theory behind and a simple example on how can be done.
User avatar
By Awacks
#54950 After a few more weeks of testing and research, I still have issues with that circuit.

Things improved a lot when I coded a small "check" that checks if 50ms later of a button press, the button is still pressed.

But I guess that now, the issue is with the EMI generated by the motor. My environment is also a very noise industrial one, with lots of 220v 60hz motors and coils near by.

So I've researched a bit more about RC filters (thanks trackerj) and stumbled the concept of Snubber Circuits, and tried to implement that, with partial success, here is the circuit:

Image

Things improved a little, but sometimes if I turn the motor on and off a few times in a row (like 10 times) it gets the ESP to a corrupt state, not responding to button presses (but oddly still counting and updating the LCD).

Is the snubber really necessary ? Am I implementing it right ? Are the capacitor and resistor numbers right ?
User avatar
By rudy
#54988 The snubber is of no use where you have it. It is for a different application.

What kind of response time do you need from the contactor signal?

I consider 3V signals inappropriate for this kind of application, for a number of reasons. One is that Relays, and contactors, have a minimum rating. Most people only think of the maximum current and voltage ratings and are ignorant on the minimums.

This is what I would do. Use the highest DC voltage you have available and use that to feed the switch contacts of the relay/contactor. Use a low pull up resistor to keep the current high.

For example. If you have 12 volts then use 220 Ohms as the pull up resistor. That goes to one contact. The other contact goes to the ground at the power supply. Now in parallel with the 220 Ohm resistor you have an optocoupler LED and series resistor to limit the current. Use 1K for the resistor in series with the LED. In parallel with the optocoupler led use a 470 Ohm resistor. That makes the LED/optocoupler less susceptible to noise.

On the transistor end of the optocoupler connect the emitter/source to CPU ground. Connect the collector/drain to a pull up resistor connected to the 3.3 volt CPU power.

On the wiring to the switch contacts of the contactor/relay use twisted pair wire. Don't use CAT5 or other delicate network cable. Use something that is more rugged and appropriate for the installation.

Now that is all good but what also is important is how it all is implemented. But that can be said for your whole installation. You haven't described or showed how this is all put together. And that is important. Where and how things are routed is important. I didn't see anything about your power supply but that is a major problem for you. Just a schematic representation means nothing.

What I have suggested will take care of a lot of situations but if problems persist then there is more that can be done.


EDIT

I looked for a schematic (rather than draw one up) and I found this. Not the same but not bad.
http://m.eet.com/media/1196440/A1160%20fig01x600.jpg

Image

I think it would be much better to have the resistor R1 to the left of the switch contacts. So that the power supply does not get shorted if there was a short in the wiring. Notice the difference in ground symbols. That's intentional. While they might be at the same potential they would have different paths to the "ground" of the circuit.