Newbee here – I am using an Elegoo UNO 3 to replace a refrigerator/freezer logic board. My UNO has 3 relays attached that activate A/C contactors which turn on/off the compressor, evaporator fan and defroster/heater. I deemed Arduino relays to be insufficient to handle the load so I used AC 30 amp contactors. The UNO relays turn on the contactors which are connected to the compressor and heater.
Attached is an LCD to provide status info plus two sensors measure freezer & refrig temps. The sketch checks the temps and decides when compressor, fan and defroster/heater r needed. On/off code includes “delays” to avoid noise. It works great but occasionally, after several hours of successful operation, the UNO reboots. I assume that means it’s unstable. It also appears to be getting worse. It takes less time for the UNO to reboot.
The source of power is a USB cable attached to a 2.4amp phone charger. Reboot also occurs when USB is connected to my laptop. I tried using a separate outlet on a different breaker for UNO power to no avail.
I await the arrival of a 9v power supply.
Should I power all 3 relays from a separate 5v power supply?
Should I add a capacitor to the 9v circuit on the UNO (or whatever electronics will stop the reboot)?
What are the specs of the cap I should order and where does it attach? Pls indicate pos & negative if u supply a schematic.
I never realized how eloquent C++ is and REALLY enjoy the programming.
My guess is you are drawing too much current through the microcontroller... verify every device is receiving the right power, and verify everything is grounded to the same potential.
It's also possible that the code you've not presented is not 'perfect'. While you may think it is, wouldn't a second opinion be desirable?
Secondly, if it IS hardware, you really need to show a schematic of the whole system, so that any vulnerabilities or deficiencies there can be discussed.
It is rare on this forum that the OP presents their problem and proposes the right solution, just so you know.
That is an excellent comment. No, I do not have "snubbers" primarily bec I had no idea there was such a thing. I recall the first rebooting occurred when I added the heater contactor & it engaged so the coincidence is "telling". The htr contactor is 10" away from the UNO whereas the compressor contactor is several feet away.
To learn about snubbers, according to Perplexity (AI): "Snubbers are used to suppress electromagnetic interference (EMI) and voltage spikes generated when switching inductive loads like contactor coils. They can be placed across the contactor coil terminals to suppress noise from the coil itself and across the switched load to suppress arcing at the contacts".
I will research what I need to accomplish both. The solenoid on both contactors is 120vac. The load is 120vac.
Perhaps if I move the heater contactor away from the UNO that will attentuate some of the noise. The heater power 120vac cord is right next to the temp sensors. Perhaps the jolt is occurring because of the proximty.
If you intend to use that instead of USB power, it might not give the desired results. That 9V is converted to 5V by the onboard regulator which has very limited current capacity due to lack of cooling.
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
Interesting to know if you get the same problem with that, but 9V is not the best source of power for an Arduino because it then goes through the on board linear regulator, which gets hot. 5V is always going to be better.
Delays don't avoid noise, delays just cause nothing to happen for the period of the delay, but 'nothing' doesn't include stopping a reset if something is causing a problem.
It's perfectly stable, but incorrectly used will give problems.
Correctly configured what you are doing should be OK, but to judge that we need the things specified in the introductory tutorial mentioned by @TomGeorge . Oddly enough I wrote that tutorial to encourage people to provide enough information to get to a quick and successful answer to any query.
Thank you Perry. Wilco. Per Tom, I am rewriting my hand drawn schematic for posting. I'll figure out how to post my sketch which was the most time consuming part of the project.
My sketch works perfectly. Been running for > week. I replaced the mechanical relays with SSR, added an external power supply for all peripherals, and eliminated A/C contactors. Admittedly, that's a brute force approach. The scope I assembled confirmed there was lots of noise being emitted. The mechanical relays were the most likely culprit so I approached it like an airplane. Fix everything in sight and avoid off field landings.