Arduino Freezes Randomly, Memory Issue?

noweare:
I don't follow. You can reset the wd timer in any loop. The watchdog uses its own timer.

I know, but the sketch runs a heat-cooldown-heat-cooldown loop. If the wdt resets it during a heat phase, that phase would be prolonged and maybe run forever without ever reaching the cooldown phase. This may cause overheating and/or scorched goods. An arduino based project which requires the wdt to ensure stability is a broken project :slight_smile:

@OP: Do you see any patterne in the amount of time it takes for the thing to lock up? If it always locks up after X hours/minutes, this would indicate an issue in the code, and then you should re-post your entire sketch for ease of revision. If there is no pattern in the lock ups, that would indicate an electrical issue and for that you should seek help from the previously mentioned silverbacks! Giving up is not an option! :wink:

No pattern in the failures. Could quit anywhere, in 2 hours or 2 weeks. Last serial print this time was printing temp1, but did not print temp 2.(added a photo to the album in post 2, can’t post direct images from my phone)

I do have some load resistors for the 2A load a few feet away, and the oven is basically just a big coil of wire.... EMI is above me, even more than programming! I have had a similar program running with Millis for delay for months before without issues, but no EMI heavy loads nearby.

Draw a detailed cirquit diagram and post it in the electronics forum :slight_smile: Might be a missing capacitor, might be a missing diode, but if your diagram is good they'll find the problem in there!

well if the Serial monitor keeps crapping out, you may need to hardware disable the reset upon re-connection, or do the Serial monitor using a separate usb-ttl.

and the oven is basically just a big coil of wire...

but within a metal box i hope.

Deva_Rishi:
well if the Serial monitor keeps crapping out, you may need to hardware disable the reset upon re-connection, or do the Serial monitor using a separate usb-ttl.

Just curious what your reasoning you have for that.

sterretje:
Just curious what your reasoning you have for that.

so that one can reconnect without reset excluding the pc-connection to be the cause.

I just spotted something that makes me wonder; Is it intentional that "loadrelay" and "heatrelay" both points to pin 3?

I just caught that this morning too. D3 on the transistor board was connected to the 12V oven relays, but i needed a new pin for the load relay which left an open hole in the arduino board on 3... I dont know why i didnt catch both being 3 when the assignments are literally right next to eachother in the code.

Realistically it would not make much of a difference in functionality until you get in the link broken loop, but it froze up without entering this loop.

Having both heater relay and load relay registred to the same pin would most likely have caused a lockup. So the load relay is used to determine wheter the heater is drawing current? Does it work now after you have attached the load relay to another pin?

The load relay is turned on once the temperatures drop below setpoint to determine if there is a break in the DUT circuit.

Basically the flow in normal operation is:

If Temperature Too low -> turn on load -> 500ms delay to stabilize MAX31855 chips -> check current to verify circuit is intact -> if intact turn on oven for 5 seconds -> after 5 seconds turn off oven and load -> wait 10 seconds -> read temps again -> back to beginning.

So in normal operation the load is only on for 1500ms longer than the oven (500ms stabilization delay, 1000ms current sampling duration).

I moved the load current to pin 2 (after confirming for sure it is un-occupied :wink: )

Due to the failure this time, both my MAX31855 chips are dead. I will need to buy some more. My TC lines melted and came in contact with VAC from the load circuit. :frowning:

Sounds like your cirquit is defunct, I would draw a diagram and get someone in the electronics forum to check it.

Hi All! I have made some headway in solving this. I spoke with an EMI engineer who was confident that my AC power supply 4 feet from the arduino board was emitting a ton of EMI. He advised that i put the arduino in a very well grounded metal box, and use ferrite beads on all incoming and outgoing lines.

I have since implemented this fix, in addition to adding a few more indicator LEDs to remove the need of a serial comm. so i can know the status of the unit and whether it is still running (From Blink;)

The controller has been running for a few weeks flawlessly. Remembering back in December where i had a stretch of a couple weeks, i do remember the power supply was de-activated during this time as well which leads me to believe with a fair amount of confidence that the EMI of my power supply was the problem.

We can add this one to problem solved! Dang EMI gremlins!!!

BTW - By "Power Supply" i am not referring to my 12VDC to supply the arduino. I am talking about a big honking 6400VA AC regulated switching power supply.