I`m new to electrical engineering, so it's probably a newbie problem. I'm using a wall power supply(5V-2A) to power the [DC Motor][1] and the Attiny85. A C1 470uF to make the power more stable. I don't know if it is necessary, but it helped. A D1 green led to show if it's on. A reset button connected to ground to reset(Duh). One relay(833H-1C-C) connected to the digital pin 0 of the attiny to turn the motor on and off. Two rotational potentiometer connected to two analog pins(2,3) to decide how much time the mini water pump will be on(0-1023 to 1s-30s) and the other to compare to the humidity sensor to decide how dry the soil will need to be to turn on the motor. And one [humidity sensor][2]. #include "kPot.h" // my library, just analogReads #define HUMIDITY_PIN 1 //humidity sensor #define LEVEL_PIN 3 //rotational potentiometer #define TIMER_PIN 2 //rotational potentiometer #define MOTOR_PIN 0 //connected to the relay switch kPot humiditySensor = kPot(HUMIDITY_PIN, 10); //(pin, average of 10 reads) kPot levelPot = kPot(LEVEL_PIN, 10); kPot timerPot = kPot(TIMER_PIN, 10); int humidity = 0; int level = 0; int timer = 0; void setup() { pinMode(MOTOR_PIN, HIGH); humidity = humiditySensor.Read(); level = levelPot.Read(); timer = timerPot.Read(); } void loop() { humidity = humiditySensor.Read(); level = levelPot.Read(); timer = timerPot.Read(); timer = map(timer, 0, 1023, 1000, 30000); //1s to 30s if(humidity < level){ digitalWrite(MOTOR_PIN, HIGH); delay(timer); digitalWrite(MOTOR_PIN, LOW); } delay(300000); // 5min Update } [![enter image description here][3]][3] The problem: The mini water pump turns on and won't stop.<br> I removed the reset button to make sure that wasn't resetting, didn't help.<br> Maybe the motor is taking too much current and reseting the attiny?<br> I probably have to put a diode somewhere, but as I said, I'm a newbie, so... thanks. [1]: http://www.dx.com/p/hsyy01-water-pump-motor-w-hose-white-silver-236808#.VqvzTfkrKHs [2]: http://www.dx.com/p/soil-humidity-moisture-detection-sensor-module-blue-black-white-200142#.VqwBW_krKHs [3]: https://i.sstatic.net/4554d.jpg