I'm recycling this old power adapter I found lying on my house to power the Uno thru its Vin pin with its 12V pin and also to power a 12V water pump.
Everything works OK when its powered thru the USB, but when its powered with that power supply, i get wrong readings from the RTC. By wrong readings i mean everytime the hour is checked (every 20 seconds or so) i get a different hour.
I read something about analog sensor values being affected by external power sources, but i never thought this could happen to the RTC because its using digital pins to communicate with the Uno.
When the RTC works correctly, the water pump is not running ?
Or is the USB supply also enough to run the pump?
Anyway, if the problem is electrical noise from the pump, check there is a fly back diode across it.
The pump does work, its powered on by a TIP120 when a certain hour is reached. And yes the pump has its flyback diode.
The problem appears when i power it with the 12v, im planning to use the 5v pin the power supply has instead of the 5v pin of the arduino, in case im drawing too much current and the arduino cant handle it.
OK. The power supply connector looks odd with 5 pins. What are these all for ?
Anyway, a schematic, even a photo of a hand drawn circuit, would help to understand your explanation.
For example, it is not clear if the pump is connected directly to the 12 volt supply, or if it is 5 volt and powered via the Arduino's regulator.
Sorry im abroad and cant draw the schematic. The connector has one 12V pin, two GND and two 5v.
Yep, the pump works when the RTC randomly gives the right hour. The pump is directly connected to the 12V of the supply, and GND is controlled with the TIP120.
Everything works fine and is right connected, again the only problem is the RTC, giving only the right value when the UNO is powered via USB.
Ive already tried powering it with the 5V (supply) - 5V pin; 12V (supply) - Vin pin; 12V jack of the UNO; and even connected via USB a step down converter to turn the 12V from the supply to 5V.
If you disconnect the pump and replace it with a led and resistor, does the RTC function correctly ?
What I am trying to get at is if your problem is 'electrical noise', power surge etc. when the pump is started.
You said in the OP "Everything works OK when its powered thru the USB", but since then, you've now said that the pump is 12v so "Everything" did not include the pump. That is, if I understand you correctly.