first of all I would like to introduce myself, as I have just registered. I am Johannes from Germany and my interests are CAD, CNC and additive manufacturing. Unfortunately I have only little experience with Arduino. I have programmed boards for 3d printers 15 years ago, but so much has changed in that time that I need your help.
About my project:
I would like to run a 12V water pump for 10 or 20 seconds after pressing a button. I assume the time can be set exactly in the software/code?
Can you tell me what to look for on google to get help? Or even better, does anyone here know which Arduino board I need and how I can possibly create the code with ChatGPT? or is that not how it's done? I am infinitely grateful for your help! This is a home and hobby project so there is no time pressure and I can spend some money without any problems.
Download the IDE to Your computer.
Look into the example codes for buttons, and look for motor or solenoid examples.
Any Arduino would manage but needs a driver for the motor.
To accomplish what you’ve described is a very simple project. It wouldn’t even need an Arduino at all, just a few basic components.
But if you also want to renew your interest in Arduino and electronics as a hobby, then as @Railroader says you should start with the basics. I would suggest stepping through the example sketches at your own pace until you know enough to build your pump project.
Precisely enough for controlling a water pump, yes.
I would recommend a Nano V3 (ATMEGA328) for beginners. Don't buy an Arduino kit, they are full of junk. Get a large breadboard on which to build your prototype circuit. Also some resistors with values like 330R, 10K, a few 5mm LEDs, a few 1N400x diodes, a few pushbuttons...
No Arduino can control a 12V pump directly, so you will need a component to go between the Arduino and the pump. An IRLZ44 MOSFET would be a suitable choice.
Best avoided. The code will not be difficult for someone with technical skills. There are lots of code examples available in the IDE menu. The forum can help as needed if you get stuck.
For wiring your circuit on breadboard, I would recommend using solid-core hook-up wire and avoid Dupont wires as much as possible. Get several colours including red and black. Get a wire cutting & stripping tool and a pair of small, fine pliers. You can then cut wires to the correct length and lay them flat on the breadboard. This results in a much neater, robust breadboard prototype.
Were you able to cancel the order for Pro Mini? If not, don't waste them. Just get a USB-Serial adaptor. A few more wires to connect, but once you have done that, it's almost exactly same as Nano.
You don't need to buy 4x USB-Serial adapters, you can re-use the same one with the other Pro Mini in other projects.
If your PC/laptop runs windoze, it may be safer to go for one that uses an FT232 chip. If you run Linux, you can alternatively choose CP2102 or CH340 chips, they all seem to work well with Linux.
I now know again why first I ordered the Arduino pro mini, it can also get 12v directly...
It doesn't matter now because the nano is here and the motor drivers are here and the stepdown 12v to 5v have also been delivered.
Unfortunately I have cancer and have to go to the doctor a lot this week, so I won't be able to put the parts into operation until the weekend.
const int ButtonPin = 2;
const int RelayPin = 3;
void setup() {
pinMode(ButtonPin, INPUT_PULLUP);
digitalWrite(RelayPin, LOW);
pinMode(RelayPin, OUTPUT);
}
void loop() {
if (digitalRead(ButtonPin) == LOW) { // If button to Ground is closed
digitalWrite(RelayPin, HIGH); // Turn on relay
delay(13000); // Wait 13 seconds
digitalWrite(RelayPin, LOW); // Tun off relay
}
}
this code works fine!!!
but I can't get it to run with two buttons. I have tried it with definition of button1 and button2 triggering the same output and the same relay.
I want it to run like this:
When I press button 1 (PIN2) - the water pump runs for 13 seconds.
when I press button 2 (PIN4)- the water pump runs for 20 seconds
Relay Pin is PIN3
two buttons, but only one output to the relay for the Motor control.
I just tried to add a new switch in the same scheme, but I don't think it works that way...
I feel so stupid, I just don't understand the basics anymore.