Run a pulling motor for 10s and turn off

Hello everyone,

I have a pulling motor as you see

I want to turn on this motor for 10s and then it turns off

the motor needs 12v, so I will use a 5v relay.

I am thinking of using this code

int timed_pump(int max_time)
{
   start_pump();
   int initial_time = millis();
   int elapsed_time = 0;
   while( (elapsed_time < max_time) && (!digitalRead(pin)) )
   {
      elapsed_time = millis() - initial_time;
   }
   stop_pump();
   return ( elapsed_time );
}

any ideas?

Thanks...

What are you going to do with the relay ?
How about a wiring (schematic / circuit diagram of what you're intending to do.

btw, that photo is a solenoid.

That is SOME solenoid..... (b expensive too) .....0.5hp rated and one supplier commented, only power on for 2 seconds maximum due to temperature rise.
No idea what the off time would be under those circumstances, might be difficult to find out also.

Bottom of the page....... https://www.newegg.com/p/1NJ-0018-00R21?item=9SIA27CAK83298&source=region

Assume the battery is 12v. the relay is that because I want to connect 5v to the Arduino. I do not know where should the green wire go exactly.

Excuse my language, English isn't my first language.

I have the solenoid and I make it to work for more than 2 seconds(manually), no issue.

And no wonder, as the relay module you indicate is designed not for an Arduino at all, but for a WeMOS D1 Mini! :astonished:

Not to mention you fail to indicate where you get 5 V to power the Arduino.

It seems everything is wrong here. A relay is a poor way to implement this, you should be using a logic-level FET.

It looks like the battery will be shorted when the relay is energized. :open_mouth:

Minor detail :grin:

1 Like

So you know more about it than the manufacturers..?? .....ok....

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.