Hello,
I am a developer and I am new to Arduino.
I'm not an electronic expert.
I would like to make a circuit with Esp-12 for power on and off Arduino and for hardware reset Arduino.
I used two relays, one to cut power to Arduino and one to reset Arduino.
I tried with two different power sources, like the attached "schema 1" and it works fine.
When I tried to use the same power source, like the attached "schema 2", the relay for powering on and off Arduino works well, but when I use the relay to reset Arduino (I connected the Arduino reset pin to the ground with a 1000 ohm resistor) the ESP12 crashes.
Why are you not using a transistor to pull reset low? Reset pulse should be clean, relay bounce
isn't a great idea for this pin. 1k ohm resistor is spurious - pull reset hard to ground for the minimum
pulse time and then release - that's what is needed.
The ESP chip crash suggests spikes on the supply when relays switch - you should almost nothing
in your diagram of power and decoupling arrangements.
Thank you for your answers, I'll buy the transistor and the capacitor and I'll try the solution proposed.
I'll tell you the result
I want to power off and reset Arduino, because I have an Arduino Mega with an ethernet shield (and an LCD and some sensors).
The problem is that sometimes (not often but it happens), the Arduino+shield crashes: when it happens, on the shield the power led is on, other leds are off and the top led blinks very fast.
I tried with a lot of Arduinos and a lot of ehernet shields but this problem sometimes happens.
Usually I buy components from Aliexpress, they are very cheap.
So I used the Esp-12 to test the Arduino+shield: every hour Esp-12 sends an http request to Arduino, if Arduino doesn't respond Esp-12 resets Arduino and sends this information to an http server to store this information to a database for analytics.
Sometimes the reset process restarts Arduino correctly.
But sometimes the reset hasn't effect, so Esp-12 sends another http request to Arduino, if Arduino doesn't respond, Esp-12 powers off and powers on Arduino, then resets Arduino (because it hasn't autoreset) and then sends this information to an http server to store it to a database for analytics.
I'd like to use the same power source for Esp-12 and for Arduino.
Do I recall there is a reset on the Ethernet shield that you need to connect as well as the Arduino reset?
It amuses me that if you are using WiFi, the ESP8266 is actually more capable than the Arduino, so you do not need the Arduino at all. But if you are using wired Ethernet, then the Arduino is useful.
I've had the same problem with an Ethernet shield, and my solution was to connect the RESET pin to one of the output pins, and the first thing you do in your code is to put this pin HIGH.
By pulling the pin low, the arduino will reset.
Tested on more than 50 devices with success! I'll try to find a code example.