Hi,
I have made a zone watering which opens instructs 2 solenoid valves and a pump to open and close in sequence as follows:
- first solenoid valve opens
- pumps turns on
- waits 10 seconds
- second solenoid valve opens
- wait 2 seconds
- close first solenoid
- wait 10 seconds
- switch off pump
- close second solenoid
- wait 12.5 minutes
At the moment I am using a ready made 4 relay board with the following sketch:
// Declare Constants
#define RELAY_ON 0
#define RELAY_OFF 1
//Declare Variables
#define PUMP_1 10
#define RELAY_1 11
#define RELAY_2 12
//#define RELAY_3 13
//Setup to turn off all relays
void setup()
{
digitalWrite(RELAY_1, RELAY_OFF);
digitalWrite(RELAY_2, RELAY_OFF);
//digitalWrite(RELAY_3, RELAY_OFF);
digitalWrite(PUMP_1, RELAY_OFF);
pinMode(PUMP_1, OUTPUT);
pinMode(RELAY_1, OUTPUT);
pinMode(RELAY_2, OUTPUT);
//pinMode(RELAY_3, OUTPUT);
}
//Loop
void loop()
{
digitalWrite(RELAY_1, RELAY_ON);
digitalWrite(PUMP_1, RELAY_ON);
delay(10000);
digitalWrite(RELAY_2, RELAY_ON);
delay(200);
digitalWrite(RELAY_1, RELAY_OFF);
delay(10000);
digitalWrite(PUMP_1, RELAY_OFF);
digitalWrite(RELAY_2, RELAY_OFF);
delay(750000);
}
I am powering the arduino nano using 12v at the Vin and GND - I know this produces too much heat and I want to be able to add a voltage regulator to give it the 5.5v feed it needs efficiently.
The pump is a 12v 5A diaphragm pump.
The solenoid valves are 12v 0.5A
The transformer is a 10A 12v transformer
The program currently cycles the solenoids with no problems when I run it without pumping water but under running conditions with the pump running, the arduino resets back to the beginning of the loop when the second solenoid is activated.
I am loving the arduino but am not an electrical engineer, but once I get the hang of it, I will virtually never leave my armchair!
My questions are:
-
How do I simply regulate the power to feed the board from 12v to 5.5v without producing too much heat?
-
Is the board stalling because the power supply is being swamped because the pump and solenoid are drawing too much power or could it just be because it is over heating with 12v at the Vin pin?
-
I really want to expand this idea so I want to go over to using transistors to switch the pumps and solenoid valves in my next project, so how do I choose the correct transistor or mosfet as a switch that will switch the gates directly off the output pins of the arduino?
-
Is there a way to make the code smarter so that I can just add a digit to a loop to declare how many relays there are that can also vary the spray time of every zone?
-
What is the best way to solder wires directly onto an arduino board? I can get them on but the joint often fails.
I hope this makes sense and any help would be really appreciated.
All the very best,
Jason