Hi, i am working on a egg incubator. Because arduino freezes sometimes because of emw, i need some kind of external reset circuit.
So i already have indication led on arduino with 60hz frequency blinking and i was thinking to use it as signal for external circuit. I was thinking about a circuit which would reset arduino if blinking signal stopped. A professor suggested me a dogwatch circuit with 2 NOR gates and in parallel another circuit with 2 NAND gates to ensure reset if arduino freezes in 1 or 0 signal.
I tried this circuit in couple simulators and IRL and it didnt work because once square signal comes on the gate, potencial changes and it triggers gates, capacitors starts charging/discharging and since NOR or NAND cant be triggered untill capacitor fully discharges/charges, this circuit isnt useful to me because it reswts every time there is a change in signal.
You can make one with a '555, it may be what your professor was aiming for.
Google it, You will see '555-based solutions, and you may see one like you are working with.
You may be failing because the time constant implied by the exact component values is not matched to your input frequency and duty cycle.
You said 60 Hz, shoukd we assume a square wave at the system voltage for high and low? OIC, you have said.
60 Hz is not a good indicator, not for human consumption anyway. A lamp blinking way slower woukd be mor informative. Do you have control over that? How is the indicator being created in you code.?
So at first i was using relay and light bulb (230v) then i switched on 12v heater, it was better but not the best, I moved psu further away and arduino stopped freezing so frequently. Then i used shielded wires etc... and as i remember high current, switching... equals EMF
It could be bug somewhere in 1600 lines of code, i dont know what else it could be..
Arduinos have a watchdog timer built into them that will internally reset the controller if it is not periodically reset. Enable the internal watchdog, then put the reset all throughout your code (but NOT in an independent timer interrupt). Now if it gets in a weird state, the watchdog will timeout and reset it.
Yes, this is why more modern microcontrollers (e.g., STM32) often have multiple watchdogs. So there might be a "regular" watchdog that's driven by the system clock, and an Independent watchdog that's isolated on its own circuit. Failure to manage either of them will cause a reset. The independent watchdog has a useful quality in that after you turn it on, there's no way to turn it back off other than resetting the system. So, your code can't accidentally disable it after it's running.