I'm pretty new to Arduino (UNO), but not to µCs as I built a few things with Microchip controllers, but the Arduino is a more complete package and thus much faster to develop.
But now I have a (big) problem and no Idea how to go on...
First the project:
I built a little device, which consists of a Arduino UNO, two Relais (one of them is used for a heating wire), 3 DS18B20 Temperature Senors, 1 DHT 22 Sensor and a DataLogger Shield (SD-Card slot an RTClock)
The data of the sensors is logged and if the internal temperature (DS18B20 Nr. 3) is lower then 5°C and the temperature of the heating wire (DS18B20 Nr. 2) is not too high (35°C) the heating wire gets active (external 9V source), when the temperature of the wire gets too high(50°C) or the internal temperature is higher then 10°C the heating wire gets deactivated.
The problem:
I noticed, that the wire gets deactivated even when none of the limits are reached. I already figured out, that the reason is, that the arduino restarts and thus the conditions for activating the wire are no longer met, which means it will not be activated anymore.
I now added some debugging code wich logs restarts, saves and loades all variables in the internal EEPROM of the Arduino and logs addtional data (e.g. the temperature of the microcontroller).
But I still dont have any clue whats wrong...
My guess would be, that the internal temperature of the µC is too high... but 28°C is not so much, and it even increases when I force it to go on.
As you can see in the log file, it does one complete circle and logs the data correct, but then restarts (which takes sometimes up to 10s)
Does anyone have any idea what the problem could be?
Probably spikes from the relay heater circuit interfering with the Arduino,
or inadequate power on the 3.3V SD card supply - SDcard take a lot of power.
Is the relay opto-isolated?
What voltage and current is this heater?
Do you separate the the Arduino from the high power wiring?
How is everything powered?
Have you monitored supply voltages and currents at all?
You need to provide full details on the setup really.
The power comes from a 9V/2A power adapter which is splited. One goes directly to the arduino board, the other one to the relais, which is opto-isolated, yes!
the heater is drawing about 1A (the coil has circa 9 ohms)
Do you think the supply voltage drops too much? I thought about this too, but:
the thing is always working within the first few minutes of operation and the resistance of the coil goes up with temperture, which means power consumption reduces, which means the danger of inadequate power supply decreases...
Sorry for not providing all info. I'm not sure what is really relevant for you
I dont think that this is necessary, because it works fine for about 10 mins (see log file), at a certain point (which I dont fully understand at the moment) it starts with, well, restarting until the load (heat wire) is shutdown.
The relay coil power comes from the 5V supply on the arduino board. Between HW+ and HW- there is the heating wire, it is just a resistance wire with about 9ohms. as mentioned above, IN1 and IN2 are directly connected to the pins of the arduino (pins 4 and 5)
It is a bit difficult to reproduce the operating conditions, but as soon as it is possible for me, I will check if I can reproduce it and if so, if the voltage decreases.
But I really cannot imagine, that this is the problem... it is just unlogical...
You could be overheating the 5V regulator on the Arduino. 9 volts is a bit high if you have a lot of current. The coil power is coming through it, so it might be getting hotter and hotter until it cuts out. As long as the relay is on, it keep re-booting. As soon as you turn off the relay, it seems to be fine. That might be because it can handle lower currents fine.
Check the regulator and see if it is getting hot? Touch it with your finger if you don't mind getting a blister or two. If it's hot, try a heat sink on the regulator?
Or you could run 3 or 4 diodes between the 9V and the Arduino. If each one reduces the voltage by 0.7 volts and turns it into heat, they could dissipate some. See if that solves your problem.