My Arduino is freezing/locking up, sometimes after running for a few hours, sometimes quickly (under a minute). The quick lockups seem to always occur following a reboot from a previous lockup. The freezing will prevent it from making any further readings and decisions and inputs will not function.
The project:
I am using an Arduino Uno with Ethernet Shield to monitor the water levels in two 150 gallon tanks using ultrasonic sensors to determine which one has enough water to pump out and be used. One of the tanks will be hooked up to City water in the end result so I really only check to make sure the other one does not get empty.
-
All of the valves and the pump are controlled by beefcake relays which are on their own power line separate from the Arduino. SparkFun Beefcake Relay Control Kit (Ver. 2.0) - KIT-13815 - SparkFun Electronics
-
The ultrasonic sensor readings for tank level are being smoothed over 10 readings on both tanks. http://www.maxbotix.com/products/MB7052.htm
-
There is a flow meter on a Pulse input that is not currently being smoothed (code commented out for now) http://www.gemssensors.com/Products/Flow/Electronic-Flow-Sensors/Rotor-Flow/~/media/GemsNA/CatalogPages/RFA-cat.ashx
-
Values are being read by the sensors and sent by the Ethernet Shield to a website that is storing values via simple GET requests. This happens hourly when the system is not running and otherwise while pumping and at any time that an event happens (pump on/off, valve change etc).
-
Currently each event records name, description, timestamp (server side), tank1 level, tank 2 level, flow meter Hz, and Free Ram and when the board is not frozen this is working perfectly.
Potential Freezing Issues I am researching:
-
I thought I might be running out of SRAM due to all of the variables and especially the char arrays. I was about to convert everything to PROGMEM but then I found a quick snippet to display free memory and turns out I am only using about 800 bytes of the 2000 so that should be ok.
-
I also looked into string concatenation errors but I am not using the String library, sticking to char arrays and strcat().
-
Some people have Magnetism issues from relays but ours are fairly far away from the board so not sure if that is the issue, also there is no correlation to when lockups happen and the relays are being used.
-
This Arduino has been uploaded to and reset a LOT over the past two weeks, is there any residual effect on the Flash memory from this that could be causing lockups? We are getting another board this week so that will rule this out as a possibiliy
-
Ethernet Shield freezing? http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1248929726/all. I am not sure it is just the shield.
Any help on this would be appreciated!
Anything that causes lockups would be a great help, this is my first real micro-controller and C project (I have a Python and web development background) so I am unfamiliar with a lot of the usual hangups.
Here is a link to the code (I blanked out the urls it is posting to and anything else identifiable):